ECSx - an Entity-Component-System framework for Elixir


ECSx is a framework for using Entity Component System architecture to build real-time games and simulations. It is currently 100% Elixir, using :ets for managing Components, and GenServer for managing Systems under-the-hood.


How to Get Started

All you need to a functional game up and running:

  • Install :ecsx into an existing Elixir app
  • Run mix ecsx setup
  • Run mix ecsx.gen.component to define the various attributes which game entities may have
  • Run mix ecsx.gen.system to define the logical systems which update the game state over time
  • Write system logic using pure Elixir and a simple ECSx interface; e.g. HitPoints.get(entity)
  • Develop your frontend using any technology you like (including LiveView)

To get you started quickly, there is a tutorial which walks you through each of the above steps, to create a game with a LiveView frontend, where you move around a battleship which automatically attacks any pirate ships which get within range



Hello, a question, participating in the ECSx (Ship) tutorial, but changing the dynamics of the game. How multiple consecutive commands of the following line should be implemented in the code:

  ECSx.ClientEvents.add(socket.assigns.player_entity, event)

For the purposes of managing both the movements and firing of the ship via orders entered with types from the interface?


“move north 10 positions”, “launch 3 shots”, “move west 5 positions”

I’ll look forward for your answer!