spasm-myelixlabs
Hey everyone,
I’ve been working on AEON RIFT, a tick-based multiplayer space strategy game built as an Elixir/Phoenix umbrella application.
A bit of context on the origin: my background is in risk, trading and finance, specifically building recurrent models that track behavioural shifts over time rather than relying on legacy static scorecards. When building AEON RIFT, I wanted to test whether that same decision-making architecture could run autonomous game commanders and show investors something they can relate to. Crucially, I wanted to build, run, and train the entire AI stack natively on BEAM without calling out to Python or external C bindings.
Here is a breakdown of how the engine works under the hood.
The Architecture: Macro Referee + Micro Specialists
Instead of a giant decision tree or hardcoded heuristic rules, each AI commander operates via two cooperating networks running in tension:
The Macro Layer Referee
A recurrent neural network (LSTM) that tracks roughly 60 macro features describing the long-term game state (galactic threat, combat heat across borders, resource velocity, overall fleet readiness).
It does not issue ship commands. Instead, every tick it outputs a softmax distribution over seven distinct behavioural models, deciding which mindset should carry the most weight based on the situation.
The Micro Layer Specialists
Feed-forward networks that receive a `StateEncoder` vector—a normalised snapshot of the commander’s current assets (resources, ship tiers, building levels, active covert operations, action points).
The specialist translates that snapshot into the discrete tick orders: queueing builds, adjusting research priorities, launching probes, or routing fleets.
The seven specialist archetypes range from heavy resource accumulation (Midas) and tech rushing (Athena) to aggressive raiding (Ares) and counter-striking (Nemesis). If an aggressive commander loses its strike fleet, the macro LSTM picks up the sudden dip in readiness and spike in border heat, gradually shifting tick weight over to economic and defensive specialists so the bot stabilises and rebuilds.
Training via Genetic Algorithms on the BEAM
One of the main experiments here was keeping the entire training pipeline in pure Elixir:
-
I tried Python, and honestly, I knew Elixir could do it better. I skipped external ML frameworks and GPUs. Training runs via a genetic algorithm that executes thousands of accelerated, headless game simulations in-process.
-
The simulations run across concurrent BEAM processes that read and write game states in ETS tables.
-
Fitness isn’t just net score; it’s a composite function tracking research velocity, plunder value, idle tick minimisation, and archetype-specific objectives (e.g., an aggressive archetype gets higher fitness weight for combat efficacy than infrastructure).
Because the inference and training logic are native Elixir, the bot networks run directly inside the game node with zero serialisation overhead or foreign function interface (FFI) latency.
Emergent Behaviors & Observations
Training via competitive simulation on the BEAM produced a few neat patterns we didn’t explicitly code:
-
AIs with overlapping target priorities learned to align their strike windows. One bot probes to drop a target’s shields, and another arrives on the subsequent tick while defensive grids are still cycling.
-
The referee has memory, bots don’t immediately suicide follow-up fleets into a meat grinder. When the LSTM’s hidden state registers sustained losses, the bot enters an economic holding pattern until local conditions improve and, in some cases, will pounce when you least expect it.
-
Specialists consistently identify and hit targets with depleted energy reserves or active fleet transits, optimising for engagement profitability rather than raw fleet size.
The Stack
-
Architecture: Phoenix Umbrella app (Elixir core game engine, AI training/inference, and the web/channel frontend).
-
Game mechanics: Tick-based, deterministic battle replays, team/galaxy play.
We are currently testing. I’m looking for fellow Elixir devs to join us and beta/stress-test the game and see how the AI holds up against human players, I can tell with just a few of us they are hard to beat.
The beta is free to play (solo or galaxy mode). If you’d like to help test or talk shop on the architecture, drop a reply here or shoot an email to hello at myelixlabs.com and I will send you a code and, for your efforts, honour you with a special EPOCH0 badge which tells players you helped form the game.
I’d love to get feedback on the engine and discuss how others are approaching native ML/genetic workflows in Elixir.
Full disclosure, we are not game developers; be gentle it’s an experiment that turned into an addictive hobby.
Check AEON RIFT out here: https://aeon-rift.com/
Trending in Announcing
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #code-sync
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #elixirconf-us
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #security
- #elixirconf-eu
- #processes
- #api
- #forms
- #hex










