Want to take your software engineering career to the next level? Join the mailing list for career tips & advice Click here

Minecraft

Simple Minecraft-inspired program using Python and Pyglet

Subscribe to updates I use Minecraft


Statistics on Minecraft

Number of watchers on Github 3608
Number of open issues 32
Average time to close an issue about 1 month
Main language Python
Average time to merge a PR 2 days
Open pull requests 18+
Closed pull requests 18+
Last commit almost 4 years ago
Repo Created almost 9 years ago
Repo Last Updated over 2 years ago
Size 69 KB
Organization / Authorfogleman
Contributors9
Page Updated
Do you use Minecraft? Leave a review!
View open issues (32)
View Minecraft activity
View on github
Book a Mock Interview With Me (Silicon Valley Engineering Leader, 100s of interviews conducted)
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Evaluating Minecraft for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Minecraft

Simple Minecraft-inspired demo written in Python and Pyglet.

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

Like this project?

You might also like my other Minecraft clone written in C using modern OpenGL (GL shader language). It performs better, has better terrain generation and saves state to a sqlite database. See here:

https://github.com/fogleman/Craft

Goals and Vision

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 setup 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.

How to Run

pip install pyglet
git clone https://github.com/fogleman/Minecraft.git
cd Minecraft
python main.py

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

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.

How to Play

Moving

  • W: forward
  • S: back
  • A: strafe left
  • D: strafe right
  • Mouse: look around
  • Space: jump
  • Tab: toggle flying mode

Building

  • Selecting type of block to create:
    • 1: brick
    • 2: grass
    • 3: sand
  • Mouse left-click: remove block
  • Mouse right-click: create block

Quitting

  • ESC: release mouse, then close window
Minecraft open issues Ask a question     (View All Issues)
  • about 4 years Go Through Stone Blocks
  • over 4 years Command Line Arguments
  • over 4 years Framerate Ticker
  • over 5 years pyglet.gl.ContextException: Could not create GL context on Python3.4
  • over 6 years Not working on python 3.4 and pyglet development
  • about 7 years Library "GLU" not found
  • over 7 years Broken link in readme
  • over 7 years Failed to create drawable
  • over 7 years Support other keyboards than qwerty
  • over 7 years Trademark issues?
  • over 7 years terrain options by commandline
Minecraft open pull requests (View All Pulls)
  • Basic API addition
  • Update main.py
  • Update main with save functionality via xml file.py
  • Adding requirements file with pyglet
  • Create minecraft
  • fix typos
  • Replacing URL with suggested one per Issue #45
  • Added keys to toggle gui and options for look speed
  • load and save feature
  • Fix Python 3 compatibility.
  • jumping outside the wall and falling to infinity.
  • Add simple loading screen
  • Add ability to fly straight up
  • Framerate Ticker and Command Line Arguments
  • Add dirt block to inventory slot 4
  • Rooms
  • Use left shift to run and if is not pressed then walk.
  • Add Sprint Functionality
Minecraft questions on Stackoverflow (View All Questions)
  • Minecraft Port Forwarding NOT WORKING :(
  • Error Loading Minecraft World when using MoCreatures, Realistic World Gen, and CustomMobSpawner
  • Connect Java applet to a Minecraft server
  • minecraft crash - java platform binary has stopped running
  • Creating and overriding Java Enum Objects at Runtime [GregTech/minecraft]
  • Minecraft hacked client
  • Minecraft API timestamp when an name can be taken
  • How is Minecraft able to function without a META-INF folder?
  • Minecraft custom launcher - forge mod load
  • Connection error to Minecraft in Jelastic cloud
  • Possible ways to communicate between website and minecraft server
  • Some Minecraft Server Plugins Won't Run (Ubuntu 12.04 LTS) - Spigot Server
  • Minecraft server has prompt issues with tmux on cygwin
  • Can I use KyroNet to handle minecraft packets?
  • Minecraft server crashes when started
  • Minecraft Worlds Crash
  • Minecraft Bukkit plugin custom sounds without resource packs
  • Problems using javascript scriptcraft example code for canary minecraft mod
  • Infinite cube world engine (like Minecraft) optimization suggestions?
  • how can I write own functions in turtleOS Minecraft Tekkit
  • Minecraft Forge Item Block Render Issue
  • Minecraft doesn't find blockstate's state
  • Encryption based on a Minecraft world. Is it possible?
  • Minecraft Server Ping with C#
  • Minecraft (bukkit) plugins, send user a clickable link
  • Minecraft not starting
  • How would you setModel() to the player entity for a Minecraft bukkit plugin
  • Run Configuration to Debug Bukkit/Minecraft Plugin in IntelliJ IDEA?
  • Libgdx Minecraft style movement
  • Output Minecraft Server Info from TCP packages
Minecraft list of languages used
Other projects in Python
Powered by Autocode - Instant Webhooks, Scripts and APIs
Autocode logo wordmark