7 ms·
Minecraft clone in Python with Pyglet
- Artemis2 12y agoIsn't "import minecraft" enough?
- avmich 12y agoYes, 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 12y agoWhen 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 12y agoWe 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.
- angersock 12y agoPyglet handles a lot of low-level drudgery involved in talking to OpenGL, setting up a window, dealing with input, etc. It's similar to SDL or GLFW in that regard. I've written that code several times, and honestly nobody is any less of a programmer for using that instead of dealing with the bullshit themselves. It's similar to complaining about using the Node abstractions for IO instead of manually adding that yourself--it's just being silly.
- Kurtz79 12y agoRelevant xkcd reference : http://xkcd.com/353/ http://xkcd.com/353/
- analog31 12y agoThanks. 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 12y agoI 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 12y agoMy 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
- tekromancr 12y agoA few years back it seemed that pyglet was dead. I am glad to see that this isn't the case.
- bucky 12y agoHTML5 games! They're easy, quick to set up, the feedback is instant and they're fun to play! I've been making HTML5 games as part of short, two hour collaborative coding exercises at work and it's awesome. Here's a recent one we did based on Flappy Bird [1]. I made a few bootstrap scripts here [2] to make it easier to get up and running. 1. https://github.com/hoorayimhelping/Flabby-Bird https://github.com/hoorayimhelping/Flabby-Bird 2. https://github.com/hoorayimhelping/HTML5-GameKit https://github.com/hoorayimhelping/HTML5-GameKit
- ansimionescu 12y agoI recommend http://phaser.io/ http://phaser.io/
- laurent123456 12y agoWhy is it called "Minecraft in 500 lines of Python" when the slides mention 8000 lines?
- phn 12y agoI think the 8000 lines is after the release on github, which added lots of new functionalities.
- gerbal 12y agoThe 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 12y agoI 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-python/ http://damianmooney.wordpress.com/2014/03/08/a-maze-in-pytho... is the kind of thing we ended up working on
- deleted 12y ago[deleted]
- frostmatthew 12y agohttps://github.com/boskee/Minecraft https://github.com/boskee/Minecraft
- deleted 12y ago[deleted]
- gohrt 12y agoMinecraft in 1 line of Windows Batch: start minecraft.exe
- erikb 12y agoThis 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.
- Kenji 12y agoWhat 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.
- loopdoend 12y agoLine count is always misleading.
- leorocky 12y agoI think scales of magnitude are informative. The difference between 100 and 200 lines or 10,000 and 20,000 are probably not useful, but you can get an idea of the scale of a project when you compare orders of magnitude. At the smallest scale, the recent ray caster was an example where the amount of code mattered a great deal.
- rthomas6 12y agoI implemented Minecraft in Bash in 2 lines. yaourt -S minecraft minecraft
- beering 12y agoDon'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.
- justicezyx 12y agoYour logic simply disallow any meaningful discussion. After all, everything starts small.
- TazeTSchnitzel 12y agoRight. 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.
- dang 12y agoWe changed the title to be less linkbaity.
- fogleman 12y agoOriginal 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 12y agoWhy did you choose to store the state in a database? It seems like an unusual choice for a game.
- LBarret 12y agoNot 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.
- fogleman 12y agoCheck this out: http://www.sqlite.org/appfileformat.html http://www.sqlite.org/appfileformat.html
- kellyfj 12y agoLove the Python version. Am planning to use it on our local CoderDojo to help teach kids to code some basic concepts etc. Awesome job! Thanks!
- micahh2 12y agoHas anyone heard of Bravo? It's actually minecraft in python... https://github.com/bravoserver/bravo https://github.com/bravoserver/bravo
- giancarlostoro 12y agoIt's only a Minecraft server, not the client.
- ilaksh 12y agoIts 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.