Skip to content

Xata/ubiquitous-cube-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ubiquitous-cube-game

A Minecraft clone implementation in Python using modern OpenGL.

Ubiquitous Cube Game icon

Python OpenGL NumPy

Project Goal

The goal of this project is to create a multiplayer Minecraft clone written in Python that can run on Windows 11 and macOS.

Installation

Requirements:

  • 🐍 Python 3.11+ installed
  • ⚙️ GPU capable of OpenGL 3.3+

Next, clone the repository to your local machine:

git clone https://github.com/Xata/ubiquitous-cube-game.git

Navigate into the project directory:

cd ubiquitous-cube-game

Create a virtual environment with venv:

python -m venv .venv

⚠️ Be sure to activate the virtual environment before the next step!

⚠️ On Windows 10/11 you may need to change the execution policy of scripts by running:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process

Install the dependencies:

pip install -r requirements.txt

Running the game

Once installed run the game:

python main.py

Gameplay

Below you can find a picture of a house built with the current blocks: All current blocks

The current controls are:

Key Action
W Move Forward
S Move Backward
A Move Left
D Move Right
Q Move Up
E Move Down
Left Mouse Btn Block Action
Right Mouse Btn Change block Action
Middle Mouse Btn Change active block to place
ESC Exit

Note: To change the block you need to place press the middle mouse button. The selected block will be printed in the console.

Available blocks

The blocks below are defined in app.blocks.block_type.py!

All current blocks

The current blocks that are placeable are:

Block name Block ID
VOID 0
SAND 1
GRASS 2
DIRT 3
STONE 4
SNOW 5
LEAVES 6
WOOD 7
COAL_ORE 8
RAW_COAL_BLOCK 9
COPPER_ORE 10
RAW_COPPER_BLOCK 11
TIN_ORE 12
RAW_TIN_BLOCK 13
WOOD_BLOCK 14
BASIC_CRAFTING_TABLE 15

Generates a random world each time using OpenSimplex

There is also ore generation within the cave systems:

Example of ore being generated within the caves

Credits

The following was used to create the base game:

  • ModernGL
  • OpenSimplex
  • Numba
  • Coder Space's Creating a Voxel Engine Tutorial
  • Alan Zucconi's How Minecraft ACTUALLY Works
  • David Wolff's OpenGL 4 Shading Language Cookbook