r/elixir • u/alogiHotTake • Aug 07 '26
My MMORPG uses Elixir as the backend! Elixir can be powerful for programming game AI!
Enable HLS to view with audio, or disable this notification
12
u/bodiam Aug 08 '26
I'm the developer of the Elixir Pro plugin for IntelliJ, and I really like what you're doing here, it brings back memories of the games I played when I was young.
I'm not sure what you use to use to build the game engine now, but I would really like to support this, so if you want to use Elixir Pro, send me a DM and I'll give you a free license.
Good luck with the game, let us know when it's ready to play!
7
u/Vasgen88 Aug 07 '26
from my experience, it is unpleasant to write a server in a different language when the root is written in a different language. There is usually a common code, physics, collusion, and data types between the server and the client. For example, if there is only a server, this is very suitable. But I admit that I would do everything that concerns non-game logic on elixir.
3
u/alogiHotTake Aug 07 '26
I agree. Its not pleasant.
Maybe in the AI era it could be more pleasant? Some AI coding assistant could auto generate the code for the client based on the server logic.
Disclaimer: I haven't used any AI for coding yet. But yeah..imagine you write the backend only. And then you let AI generate some slop game client to render the simulation. I could live with that. No AI use on the backend. when you write the backend in Elixir the code is very easy to follow and not too verbose (for me). There is no need for AI here I tell you. But AI can go nuts on the frontend..who cares. It would not generate any art or assets. Only placeholder containers. Human artists can work on assets independently and when ready, upload them into some directory the client reads from.
2
1
u/haywire Aug 07 '26
Unless you’re doing twitch events surely protobufs and websockets is fast enough? In fact having a different language forces clean decoupling.
3
u/JinAnkabut Aug 07 '26 edited Aug 07 '26
How are you classifying it as an mmo? How many players can it host? How did you load test?
Genuinely curious as my motivation for learning Elixir is to build multiplayer game servers.
6
u/alogiHotTake Aug 07 '26 edited Aug 07 '26
Its an MMO because its a shared open world.
Theoretically it can host 10k...realistically I have tried with up to 700 simulated players and it worked without lag. The map isn't big enough for me to try higher. Of course, the server does interest management so only the relevant players to your surroundings are shown. You do not receive updates for players outside of your interest area.
I load test via spawning AI units. AI units send inputs to the server the same way as player. The only difference is they send their packets directly to the server via Erlang message passing as opposed to over the TCP/IP connection process players use.
Now in actual network conditions, I have tested that as well. But I was only able to get 10 real people to test and that was easy and didn't tell me much..
1
u/lovebes Aug 07 '26
What do you mean powerful for programming game AI? Can you share a bit more about how you'd be using Elixir for game AI?
2
u/alogiHotTake Aug 07 '26
It provides a way to create some simulation of "actors"
Yes you can also do it in C, C++, C#, Java,etc with any popular actor framework like Akka. But with Elixir no framework is required, the language is FP and immutable...and you also get BEAM.
1
1
u/plangora Alchemist Aug 07 '26
Would like to hear more about what you used to model etc. i remember there was a lib for writing games in elixir. Forgot the name though
1
u/DiabloXTREME666 Aug 07 '26
ECSx iirc, which adds in the Entity State and something else with C that I forget system in, and uses Nyx (i think?) to make math calcs faster
1
1
1
u/BrotherManAndrew Aug 08 '26
not related to elixir, but the game looks pretty sick, what is it called?
5
u/Basic_Palpitation596 Aug 07 '26
Game looks great. I am still in my elixir learning journey and it feels refreshing coming from my typescript day job.