This project is currently just a demo to test out Mojo's capabilities. I plan to expand on it, and build a small game engine around it as mojo progresses. Feel free to message me with any questions.
Currently the largest constraint is ffi support in Mojo. The rendering is a bit janky as it uses raylib. Mojo's ffi is not great at calling functions from external libs and can't take structs directly. Also the DLHandle must be passed around anywhere raylib is needed. RayLib does not use pointers for most of its function calls, so the project contains a small set of bindings for compatibility.
- Replace broad phase collision detection.
- Allow for shapes other than rectangles.
- Better documentation
- Write graphics library with OpenGL, glfw
- General optimizations
Warning: This project uses the nightly build of Mojo, and has only been tested on WSL Ubuntu
- C, C Compiler
- CMake
- RayLib
- Mojo Nightly
-
RayLib installation guide: Install RayLib, Working on GNU Linux
- Note: if you are using WSL and its built-in windowing server. When installing raylib set this flag in the cmake command
-DUSE_WAYLAND=ON.
- Note: if you are using WSL and its built-in windowing server. When installing raylib set this flag in the cmake command
-
Clone the repo
git clone https://github.com/RyanLeber/fire-physics-engine.git
-
Build the raylib bindings:
cd fire-physics-engine/raylib_bindings mkdir build mkdir lib cd build cmake .. make
-
Set the path to RayLib:
In
src/engine_utils/raylib_map.mojosetRAYLIB_PATHto where you build RayLib. If you built RayLib as a shared library the path will most likely already be correct. -
Run demo:
There are 2 demos
demo.mojoandplayer_demo.mojo. They both contain the same demos butplayer_demo.mojohas a controllable box.
Small fixes and improvements are much appreciated. If you are considering larger contributions, feel free to contact me. If you find a bug or have an idea for a feature, please use the issue tracker.
- Fork the Project
- Create your Feature Branch
- Commit your Changes
- Push to the Branch
- Open a Pull Request
Distributed under the MIT License. See LICENSE.txt for more information.
- Based on Box2D-lite, by Erin Canto.
- Built with Mojo created by Modular

