GenericJam

GenericJam

BEAM Based Game Engine - feedback/thoughts?

I’m the author of Mob. If you haven’t checked it out, please do. https://mobframework.com/

Mob does a lot with NIFs as that’s the bridge between the BEAM and the native mobile platform.

It occurred to me that a NIF could be arbitrarily big and the BEAM could effectively just be window dressing. This opens up some interesting avenues. This isn’t restricted to game engines but game engines could definitely benefit. A naive approach to a game engine is to run a game loop. If your game is 60 fps then your game loop has ~17ms to run. If it completes before then, you sleep until 17ms is complete. If all you are doing is running a game loop then you have to check the status of everything in the context and update its state every 17ms which for some things will be overkill.

That’s where processes could come in. Only the things that are very directly associated with something happening on the screen need to be updated every 17ms, eg bullet position in FPS. Everything that is a bit slower could go by process and be dealt with asynchronously. This also goes for network requests, etc.

All of a sudden, this problem has become much more tractable as you can sort into items that need to be tied to the game loop and items that can be handled by BEAM processes.

I’m happy to hear feedback on this idea. I’ve no plans to pursue it although maybe experimentally.

You could also look at taking an existing game engine such as Godot and jamming it in as a NIF.

First 4 of 4 Posts Switch mode

hauleth

hauleth

This is literally the top of the forum posts right now…

GenericJam

GenericJam OP

Cool but this is the conventional way to use the BEAM as the server. I’m talking about hosting the whole game or if multiplayer, one node of the game on the player’s device in the BEAM.

webofbits

webofbits

One thing I’d be interested in seeing is where you draw the line between “game state” and “engine state”.

A lot of BEAM game discussions seem to end up in one of two extremes:

  • Everything is a process.

  • Everything performance-sensitive gets pushed into a NIF.

The first tends to fight the hardware, and the second starts looking suspiciously like a traditional engine with Elixir as a scripting layer.

My intuition is that the sweet spot is letting BEAM own the coordination, gameplay logic, networking, and fault tolerance, while a native layer owns the frame-critical systems.

Have you identified any specific workloads that actually perform better because they’re running as BEAM processes rather than simply being easier to develop and maintain there? I think the answer to that question would help clarify where this architecture really shines.

webofbits

webofbits

Before my engineering path, I’ve played with several game engines like Unreal, Cry Engine, Unity etc even did some level-design. Today I have no patience for design work (decision fatigue hits real hard and everything becomes a never ending project). I’d be interested in a framework where I can build a game mostly using code and dont worry too much about design/3d etc

— All posts loaded —

Where Next?

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 91561 914
New
byu
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project. My initial shotgu...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
AstonJ
Just a general thread to post chat/news/info relating to AI/ML stuff that may be relevant for Nx now or in the future. Got anything to sh...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement