
Minecraft clone in Python with Pyglet - edne
http://www.slideshare.net/rdonkin/pyglet-and-minecraft-v1-1
======
Kenji
What bothers me here is that people claim to program "Minecraft in X lines",
when in fact all they create is a block (voxel) game engine. Minecraft is much
more than that, it has redstone circuits, farming, mobs, structures, biomes,
potion brewing, netherworld, fire, etc... Mind you, I don't want to belittle
anyone's efforts. I think this is an awesome programming project. But its
description is misleading.

~~~
beering
Don't forget that Minecraft was originally just a game where you could walk
around and place or destroy blocks. None of the fancy stuff you're talking
about was added until the game started taking off.

~~~
TazeTSchnitzel
Right. Many of these clones are basically Minecraft Classic, which I would
call just Minecraft, I very much like it.

Though Minecraft Classic had multiplayer, which this does not.

------
fogleman
Original author here. Saw a lot of traffic to my GitHub repo and wondered
where it was coming from.

The Python clone I wrote is pretty cool and minimal, but I'm much more proud
of a clone I later wrote in C:

[https://github.com/fogleman/Craft](https://github.com/fogleman/Craft)

This one is much more performant and has way more features, including online
multiplayer. The server is in Python.

Here's a video of it:

[https://www.youtube.com/watch?v=tScCneiTGm4](https://www.youtube.com/watch?v=tScCneiTGm4)

Anyway, happy to answer any questions.

~~~
jmpeax
Why did you choose to store the state in a database? It seems like an unusual
choice for a game.

~~~
LBarret
Not really. Databases are very common in gamedev but, most of the time, they
are not relational and are ad-hoc (i.e the database program is coded in-
house). All of this for performance.

------
analog31
Thanks. My son has been asking me how to write games, and has spent some time
looking around in the code for the Raspberry Pi version of Minecraft. Maybe we
can make some headway in this version because even dumb old Dad can handle 500
lines.

~~~
hartror
I cannot recommend pyglet strongly enough for learning graphics and game
programming, it is so quick to get started with.

I wonder if anyone has written some learn to code tutorials with it.

~~~
timtadh
My wife recently began learning python with the book "Hello Python." It seems
like a solid intro from what I read. The book uses hunt the wumpus as its
starting example. If you combine that with Steve Johnson's excellent Pyglet
tutorial[1] you could probably get to writing games pretty quick.

[1]
[http://steveasleep.com/pyglettutorial.html](http://steveasleep.com/pyglettutorial.html)

------
Artemis2
Isn't "import minecraft" enough?

~~~
avmich
Yes, this 500 lines statement is somewhat misleading. This program isn't
written on Python, rather on a large specific library which does a lot of
heavy lifting.

It's better than nothing, though, to be able to look at an app dissected even
to a few large blocks.

Kudos.

~~~
MereInterest
When there are libraries to do the heavy lifting for you, I would still say
that the 500 lines is rather accurate. I have never taken the "X lines of
code" to refer to all the libraries included, but rather to the lines of code
necessary for a new user to write in order to make something that works.

I agree that it can be distorted, by defining everything as an external
library, but it does give a good measure of how quickly one can pick up a new
tool and make something useful.

~~~
avmich
We have different definitions here. As poster above said, in the limit it's
just "import minecraft". I'd then argue after e.g. Paul Graham in "On Lisp"
that you're modifying language when you're adding new facilities - like
functions - to it. That allows you to much easier solve your problem - in the
language which you created for that, rather than in the original language.

In this example a lot was done in the external library which was imported. The
rest is a little bit of Python with crucial use of those facilities offered by
imported library. So I'd say it's not Python - by much - which this program is
written on. But that's just a definition - I find it useful to define it this
way, but it's certainly not the only possibility.

------
laurent123456
Why is it called "Minecraft in 500 lines of Python" when the slides mention
8000 lines?

~~~
gerbal
The original project[1] was a very simple 500 line implementation of
Minecraft. There is a fork[2] of that project with 8000 lines of code and many
more features.

[1][https://github.com/fogleman/Minecraft](https://github.com/fogleman/Minecraft)

[2][https://github.com/boskee/Minecraft](https://github.com/boskee/Minecraft)

~~~
dmoo
I used [1] above as the basis for a few sessions at our local coderdojo, it
gave an opportunity to get the kids to hack some python and get visually
interesting results. [http://damianmooney.wordpress.com/2014/03/08/a-maze-in-
pytho...](http://damianmooney.wordpress.com/2014/03/08/a-maze-in-python/) is
the kind of thing we ended up working on

------
ilaksh
Its not a Minecraft clone and almost none of them are. The thing that people
don't get about Minecraft is its not just blocks. Its the combination of the
interesting open world generation, blocks, resource gathering, crafting, and
crucially, initially very difficult enemies that motivate those activities. It
is fun to build an awesome fort to protect against creepers and skeletons and
also to create farms so you don't starve. He also created a very performant
cross platform engine believe it or not. Almost none of the "clones" include
or get half of those elements right.

------
micahh2
Has anyone heard of Bravo? It's actually minecraft in python...
[https://github.com/bravoserver/bravo](https://github.com/bravoserver/bravo)

~~~
giancarlostoro
It's only a Minecraft server, not the client.

------
gohrt
Minecraft in 1 line of Windows Batch:

    
    
         start minecraft.exe

~~~
erikb
This is actually more relevant than one might guess. If you export about 90%
of the heavy lifting into a library (that might not even be written by you)
then of course you can write anything in a very small program. I would
interpret that "Minecraft in 1 line of Batch" as very short note to that fact.
Therefore it is a relevant criticism of the linked article.

------
dang
We changed the title to be less linkbaity.

