Dogfood Voxel Engine written in Olive
A voxel engine written in Olive. This is a dogfood project for the language, using it to build something non-trivial that touches structs, references, FFI, math, and real-time rendering.
Olive handles all the game logic. Rendering goes through pygame and ModernGL via import py. Noise generation is a native Olive implementation of OpenSimplex2 (no Python noise libraries needed).
- Olive >= 0.1.23 - see installation below
- Python 3.x - with dependencies from
requirements.txt
| Input | Action |
|---|---|
| W / A / S / D | Move forward / left / backward / right |
| Space | Jump |
| Space (double-tap) | Toggle flying |
| Left Shift | Sprint (ground) / speed boost (flying) |
| Left Ctrl | Descend (flying) / sneak (ground) |
| Mouse | Look around |
\ |
Toggle noclip (free camera, no collision) |
| Input | Action |
|---|---|
| Left Click | Remove targeted block (hold to break) |
| Right Click | Place selected block |
| 1-7 | Select block type (Sand / Grass / Dirt / Stone / Snow / Leaves / Wood) |
| Scroll Wheel | Cycle block type |
| Input | Action |
|---|---|
| Escape | Quit |
| F12 | Save screenshot |
- Clone the repository:
git clone https://github.com/ecnivs/voxel-engine.git
cd voxel-engine- Install Python dependencies:
pip install -r requirements.txt-
Install Olive:
Linux / macOS:
curl -sSL https://raw.githubusercontent.com/olive-language/olive/master/install.sh | shWindows: download from the releases page
-
Run:
pit run- Structs with mutable and immutable references (
&mut,&) - Python interop (
import py) for pygame, moderngl, glm, Pillow - Native math - 727-line OpenSimplex2 noise implementation
- Const expressions evaluated at compile time
- Tuple returns and destructuring
- Manual memory layout - packed vertex data (6b pos + 8b voxel + 3b face + 2b AO + 1b flip per uint32 vertex)
