boskee / Minecraft

Simple Minecraft-inspired program using Python and Pyglet
MIT License
207 stars 33 forks source link

pyCraftr

pyCraftr

Simple Minecraft-inspired demo written in Python and Pyglet.

http://www.youtube.com/watch?v=kC3lwK631X8

How to Run

pip install pyglet
git clone git@github.com:boskee/Minecraft
cd Minecraft
python main.py

You may also need to install AVBin library (http://avbin.github.com/AVbin/Download.html), especially if you are on Linux machine. If you have Windows or Linux operating system, you will also need to install OpenAL library (http://connect.creativelabs.com/openal/default.aspx).

Mac

On Mac OS X, you may have an issue with running Pyglet in 64-bit mode. Try running Python in 32-bit mode first:

arch -i386 python main.py

If that doesn't work, set Python to run in 32-bit mode by default:

defaults write com.apple.versioner.python Prefer-32-Bit -bool yes

This assumes you are using the OS X default Python. Works on Lion 10.7 with the default Python 2.7, and may work on other versions too. Please raise an issue if not.

Or try Pyglet 1.2 alpha, which supports 64-bit mode:

pip install https://pyglet.googlecode.com/files/pyglet-1.2alpha1.tar.gz

If you don't have pip or git

Windows Pyglet builds

See this website, and download the correct version for the OS.
This is important to get this, as how it will have AVBin included with it.

http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyglet
    For a 32 bit Windows Os, get the file named "pyglet-1.2alpha1.win32-py2.7.‌exe"
    For a 64 bit Windows Os, get the file named "pyglet-1.2alpha1.win-amd64-py2.7.‌exe"

For pip:

For git:

See the wiki for this project to install Python, and other tips.

How to Play

Moving

Building

GUI

Quitting

Better performance using Cython

For optimal performance, you can compile the code to C using Cython.

pip install cython
python setup.py build_ext --inplace

This will generate .pyd files, which Python will prefer to load instead of your .py files, so you will need to rebuild or delete the .pyd each time you make changes.

setup.py will also compile Pyglet using Cython, if you download the pyglet source code and put the pyglet folder inside the game repository.

Building Windows Executables

pip install cython cx_Freeze
python setup.py build

This builds Cython-optimized .pyd's, and bundles together all libraries including Python itself, into build/exe.win-amd64-3.7/