Live data from Hacker News

Simple Minecraft Clone in 580 lines of Python

github.com

31–40 of 113 posts

Re: Simple Minecraft Clone in 580 lines of Python

#31
post #14

If someone were to make something like this a step-by-step tutorial/template appropriate for a classroom setting it would be huge. Imagine a class at High School where you start off learning the basics of Python for the first few weeks and the rest of the semester is spent writing the chunks of code into a template that has lots of notes for guidance. I'd image something like : def setDefaultBlockColor(color): # reca…

There's an awful LOT happening behind those 580 lines. I'm not sure whether it is a good thing to start at such an unrealistically high level of abstraction for a 3d game.

As something for beginners, this would be great. When you start learning a new skill, it's important to have that feeling of tangible achievement to keep students motivated. Anyone interested enough to pursue a career in game dev will dig into pyglet to understand what's happening, as they start to push the limits of the knowledge gained from this kind of exercise.

And then here's the other nice lesson: students can learn that they don't need to know everything before they start making cool and useful stuff. The confidence that comes from knowing that is just as important (more so?) as being able to implement pyglet from scratch if necessary. The former is a skill used daily, whereas the latter -- well, consider how often in your engineering career you casually rely on the work of others to power your creation. Has anyone ever required you to write a WSGI implementation, or a framework?

That's been my experience, at least.

Re: Simple Minecraft Clone in 580 lines of Python

#32
post #18

These seemingly "big" games written in a handful of lines of code always make me feel very, very stupid. I know if I made this, I could easily imagine writing 50,000 lines. How do people do this? How do their minds work?

Actually this demo lacks any of big or mid-sized features (as in implementation) of Minecraft, such as infinite world, terrain generation, mobs, mechanisms (pistons/redstone).

Re: Simple Minecraft Clone in 580 lines of Python

#33
post #30
post #24

Earlier quoted context omitted.

Take a look at the code, it's not THAT hard when you have the right tools (language, libraries, knowledge...) though it's quite awesome nonetheless. IMHO the game actually shows how powerful Python + Pyglet (OpenGL actually) are. Wanna get your mind blown even harder? Check some 4kb demos[1]... and that's binary size! No JVM/Python runtime supporting it. [1] http://www.youtube.com/results?search_query=4kb+demo&pag...

If you want to show off the demoscene, try the 64KB prod "Chaos Theory". https://youtu.be/4DjBq2O0XXk

I had to draw the line somewhere. If I could show the WHOLE demoscene...

Re: Simple Minecraft Clone in 580 lines of Python

#34
post #14

If someone were to make something like this a step-by-step tutorial/template appropriate for a classroom setting it would be huge. Imagine a class at High School where you start off learning the basics of Python for the first few weeks and the rest of the semester is spent writing the chunks of code into a template that has lots of notes for guidance. I'd image something like : def setDefaultBlockColor(color): # reca…

There's an awful LOT happening behind those 580 lines. I'm not sure whether it is a good thing to start at such an unrealistically high level of abstraction for a 3d game.

I definitely agree, I graduated with BS in Computer Science but never touched 3D (only 2D game design). Although if I had, I probably would be a lot further than I am now. High expectations, but the results could be amazing.

Re: Simple Minecraft Clone in 580 lines of Python

#35
Pyglet is vastly more pythonic than pygame for writing games. I have found it much easier to teach pyglet for newcomers and the code is easier to read too. Since it uses ctypes, it is very easy to port pyglet to a platform that supports OpenGL.

Unfortunately there is very little momentum in the project. Last year an alpha version was released after a gap of two years. I truly hope that pyglet gets the popularity it deserves.

Re: Simple Minecraft Clone in 580 lines of Python

#36
Just curious, what is it that makes the performance not so great?

Could performance be significantly improved by doing a re-write in Lua, for example? (Probably not... it's probably something in Pyglet itself...)

(FWIW, it's choppy compared to Minecraft, which is obviously much more complex and has a greater rendering distance.)

Re: Simple Minecraft Clone in 580 lines of Python

#39
post #15

Earlier quoted context omitted.

It was built with an old version of pyglet trying to run on 64bit python. Update.

Unless I'm just terribly mistaken, good luck getting pyglet to run on OS X right now. However, I really hope I am wrong, because that means I was just being a fool last week and will soon be using pyglet.

Looks like pyglet now runs on OS X: http://www.pyglet.org/news.html

Re: Simple Minecraft Clone in 580 lines of Python

#40
post #20

More than 100 lines of this are textures! Got this error though. Any ideas? OSError: dlopen(/System/Library/Frameworks/QuickTime.framework/QuickTime, 6): no suitable image found. Did find: /System/Library/Frameworks/QuickTime.framework/QuickTime: mach-o, but wrong architecture /System/Library/Frameworks/QuickTime.framework/QuickTime: mach-o, but wrong architecture

I got a similar error. "arch -i386 python main.py" solve the problem for me.

I'm running OS X 10.8 and ran into the same problem as the OP. This workaround unfortunately didn't resolve the problem.
Post reply on HN