Any game engine good for being embedded in Elixir?

I am working on a Elixir project compiling Elixir to native code: GitHub - beaver-lodge/charms: Write NIF in Elixir for Elixir
To further drive the development of this project. I want to create a game engine binding for Elixir to collect the requirements for the FFI capability of Charms.
Some criteria I can think of:

  • it is in C or Zig, for the simplicity
  • the artifacts of the engine itself should be small. ideally smaller the Erlang runtime (to justify it is being embedded)
  • ideally it is 3D, but if it is super simple 2D is also fine
  • it doesn’t have very special C macro or extended grammar/preprocessing (like Unreal C++)
  • it has good UI framework (so we got a native UI library for Elixir as bonus)

the reason I ask is that I was thinking Godot is going to support embed mode by the end of 2024 but looks like progress has been stalled recently(I might be wrong).

2 Likes

You could do something simple like raylib. There are some existing projects integrating with it. There are also idiomatic Zig bindings!

Charms looks like a very cool project, I’ll be keeping a closer eye on it.

For a game engine, I think Sokol matches what you are looking for. It’s not exactly a game engine rather than a collection of STB-style (header only) libraries. They are (1) cross platform, and (2) fairly easy to understand and port.
It’s not a complete game engine in the sense that it has a physics engine, or PBR rendering, etc…

Another one that I had explored recently is Gunslinger It has some basic physics utilities as well.

2 Likes

The biggest problem with embedding a game engine in the BEAM is that preexisting ones, even embeddable ones, generally have preexisting assumptions about the runtime of your application that don’t mesh too well with BEAM’s. Especially since platforms like macOS (last time I checked) require the main thread to be the only windowing thread. It might make the most sense to have a port that handles windowing and draw calls and convince that with NIFs that do related computations in the BEAM.

2 Likes