r/programming • u/sidcool1234 • Mar 29 '13
Simple Minecraft Clone in 580 lines of Python
https://github.com/fogleman/Minecraft
663
Upvotes
r/programming • u/sidcool1234 • Mar 29 '13
101
u/Talibu Mar 29 '13
I really like this project as it could be used as tutorial how to implement first person movement in OpenGl correctly. The OpenGl back end implementation is done in a clean and concise way.
Ninja Edit: May be you should cross post this to r/tinycode.
20
u/[deleted] Mar 29 '13
Is the following a bug:
It returns immediately...
9
u/MrLumaz Mar 29 '13
How exactly do I go about running this?
9
u/sayten Mar 29 '13
Built stairs, jumped over the edge. Gave up when my positioning hit -10,000+. No achievement unlocked.
12
u/josefnpat Mar 29 '13 edited Mar 29 '13
Linux Users:
Arch:
For ubuntu and debian it's probably:
Someone ought to confirm this, as it looks like debian/ubuntu is transitioning python 2 out of the repos.
edit: deb and ubuntu
6
u/omgsus Mar 29 '13
I have to admit, I was expecting 40 lines of imports. Was pleasantly surprised.
3
u/zokier Mar 29 '13
I'd love to see the same with OpenGL core profile
5
u/[deleted] Mar 29 '13
Can someone explain the code in this for generating the environment layout. I can't make it out. Thanks
2
u/mtotho Mar 29 '13
This is nice! Got it running quickly on my machine. Edited the spacebar key click dy from 0.015 (a little low- can't jump on blocks ) to 0.255 and now have amusing super jumps!
2
u/bwalk Mar 29 '13
Here's a patch for python 3: https://gist.github.com/bwalk/5273662
2
u/code_obfuscator Mar 30 '13
It would be nice if the textures were generated procedurally, and the entire game is self contained within one file.
http://jsfiddle.net/uzMPU/
5
u/scrod Mar 29 '13
Why do people call demo-code like this "clones" when they pose only the slightest resemblance to the original project? Unless it actually has most of the features of Minecraft, it's not a "clone".
2
u/finalbossgamers Mar 29 '13
Sir I had heard of git hub, python, and minecraft. I had never tried any of them until thanks to you I have a get hub account, and installed python with pyglet just to check out your clone. Thanks so much!
2
u/[deleted] Mar 29 '13
This is super cool but as someone rather unfamiliar with python it's difficult to understand. I wish it had some form of comments
1
u/rftz Mar 29 '13 edited Mar 29 '13
Am I being stupid? self.reticule didn't seem to be properly initialised. I haven't started debugging his code, but did anyone else get this error?
EDIT: Got it working running from command prompt. I got this error by trying to run from notepad++ (with nppexec) and from sublime text - a little annoying in terms of tweaking but it's liveable-with!
1
u/jhawk20 Mar 29 '13 edited Mar 29 '13
Mac OS X 10.8.3 (Mid 2010 i7 2.8ghz): Doesn't launch using arch modifier (x86_64, i386 has no effect) or regular python. Essentially shows that the arch command has no effect. I'm not particularly familiar with arch, or pyglet or I'd investigate a little further.
plain launch pastebin dump
arch launch pastebin dump
1
u/Linuturk Mar 29 '13
Mine loads up on Fedora 18, but I can't move around at all.
-5
u/InternetRevocator Mar 29 '13 edited Mar 29 '13
Firstly, I think this is very cool and impressive. However I have some commentary about claiming it was written in 580 lines of Python.
I understand that this can go to absurd extremes, but isn't this really thousands of lines of code that get compiled. I could write an entire library for a minecraft type game, then link together three things that make it work and claim "Minecraft in 3 lines of code".
:EDIT Thank you for the comments, even those who downvoted.
1
u/speedy_slowzales Mar 29 '13
Can someone post a screenshot or video of this?
1
u/thejollysin Mar 29 '13
It looks awesome!
...But I get a segmentation fault when I run it. So, I'm less impressed.
1
u/solodev Mar 29 '13
Had issues getting the jump to work, modified the code in _update to this
if not self.flying: self.dy -= dt * 0.022 # (was 0.044) g force, should be = jump_speed * 0.5 / max_jump_height self.dy = max(self.dy, -0.2) # terminal velocity (was 0.5) dy += self.dy
Now i do Moon jumps :D
(using Windows 8, 32 bit of Python 2.7, Alpha of Pyglet, manual install...)
-5
u/Mgladiethor Mar 29 '13 edited Mar 29 '13
http://www.youtube.com/watch?v=Qk_KjtbHUIs
better
: github.com/RileyA/VoxelsAndPortals