Simple Minecraft-inspired demo written in Python and Pyglet.
Original Game: http://www.youtube.com/watch?v=kC3lwK631X8
Requires python 3, for best experience 3.10 or above
I would like to see this project turn into an educational tool. Kids love Minecraft and Python is a great first language. This is a good opportunity to get children excited about programming.
The code should become well commented and more easily configurable. It should be easy to make some simple changes and see the results quickly.
I think it would be great to turn the project into more of a library / API... a Python package that you import and then use / configure to set up a world and run it. Something along these lines...
import mc
world = mc.World(...)
world.set_block(x, y, z, mc.DIRT)
mc.run(world)
The API could contain functionality for the following:
- Easily configurable parameters like gravity, jump velocity, walking speed, etc.
- Hooks for terrain generation.
pip install pyglet pillow numpy noise
git clone ssh://[email protected]/p/mcpython/code mcpython-code
cd mcpython
python main.py
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
For pip:
- Mac or Linux: install with
sudo easy_install pip
(Mac or Linux) - or (Linux) find a package called something like 'python-pip' in your package manager. - Windows: install Distribute then Pip using the linked .MSI installers.
For git:
- Mac: install Homebrew first, then
brew install git
. - Windows or Linux: see Installing Git from the Pro Git book.
See the wiki for this project to install Python, and other tips.
- W: forward
- S: back
- A: strafe left
- D: strafe right
- E: opening inventory
- T: opening chat
- Mouse: look around
- Space: jump
- Tab: toggle flying mode
- Escape: pause the game
- Selecting type of block to create
- Mouse left-click: remove block
- Mouse right-click: create block
- ESC: release mouse, then close window