An experimental real-time 3D game engine written in Clojure.
The goal of this project is to see whether Clojure is fast enough to power a real-time 3D game engine, and whether any novel approaches to game development emerge when the core of the engine is written in idiomatic Clojure.
This project has only been tested on Windows.
This project was developed with AI assistance. It should not be used for game jams that prohibit the use of tools that were made with AI assistance.
Requires JDK 21, Leiningen, and the Mixamo assets.
lein run- launch the engine and sample game.scripts/uber.bat- build an optimized uberjar and run it (Windows).scripts/timedemo.bat- build the uberjar and run the timedemo benchmark scene, appending perf results todocs/timedemo.md.
Changed source files are hot-reloaded when the game window regains focus.
Required: The player character and its animations come from Mixamo, whose license doesn't allow redistributing them, so they aren't included in this repository. Before running, download them with a free Adobe account and unzip them into assets/ybot/. docs/mixamo.md lists each file and its export settings.
| Key | Action |
|---|---|
W A S D |
Move |
| Left mouse | Fire |
| Right mouse | Jump |
` |
Toggle console |
F1 |
Toggle editor |
F5 |
Full engine reload |
Ctrl + Down |
Pause / unpause rewind |
Ctrl + Left / Right |
Step back / forward through rewind history |
Ctrl + Up |
Play from the rewound frame |
Alt + F4 |
Quit |
Bindings are configured under :input.bindings in src/cljgame/game/config.clj.
- Systems engine - all game state lives in an immutable world, updated by a linear sequence of systems built from a declarative rules engine.
- Rewind and replay - the world at the end of each frame is saved to a circular buffer which can be rewound and replayed for debugging.
- Multithreaded - render, tick, and audio threads run at independent rates, and rendering interpolates between simulation snapshots.
- Rendering - skinned meshes, shadows, fog, skybox, HDR with bloom and tonemapping, GPU particles, text and UI.
- Physics - GJK collision with capsule, sphere, OOBB, and triangle-mesh shapes, raycasts and shape casts over a BVH broadphase.
- Animation - skeletal animation, animation tracks, tweens, and easing.
- AI and navigation - priority-ordered AI states plus pathfinding.
- In-engine editor - picking, grab/rotate/scale/extrude, undo.
- Live development - hot reload of changed namespaces, an in-game console, and nREPL into the running engine.
- Tooling - deterministic timedemo recording for perf runs, profiling, GPU timers, and heap-leak analysis scripts.
- Sample game - player movement, camera modes, AI enemies, a rocket launcher, and jump pads.
src/cljgame/core/- math and geometry: vectors, matrices, quaternions, AABB, BVH, frustum, splines.src/cljgame/engine/- the runtime.main.cljis the entry point.systems.cljis the fact store anddefsystem. See docs/systems.md.rewind.cljsteps and records the sim systems, andshell.cljruns the non-rewinding state.main_thread.clj,render_thread.clj,tick_thread.clj, andaudio_thread.cljhold the thread loops, withdispatch.cljandinterp.cljhandling cross-thread work.reload.cljandconsole.cljcover live development.
src/cljgame/engine/render/- OpenGL wrappers for meshes, shaders, textures, shadows, text, and particles.src/cljgame/engine/loaders/- asset loading for meshes, animations, scenes, shaders, sounds, and fonts.src/cljgame/physics/- collision shapes, GJK/MTV, casts, and the physics world.src/cljgame/editor/- the in-engine editor.src/cljgame/ui/- UI layout and text editing.src/cljgame/game/- the sample game built on the engine.assets/- scenes, prefabs, models, animations, shaders, sounds, fonts, and VFX.scripts/- test, nREPL, reflection-check, timedemo, and heap-analysis scripts.docs/- deeper references on systems, prefabs, profiling, and timedemos.
Code is released under the MIT License. Third-party assets have their own licenses, listed in credits.md.