A 2048 clone using Elixir and Phoenix.
-
A game logic based on a lightweight event system. Games are observable and re-playable.
-
A multiplayer system build around games. Includes a chat room per game.
-
An anonymous account system, which requires no sign ups (although ephemeral).
-
The multiplayer core is implemented around DynamicSupervisor and Registry and Phoenix.Pubsub.
-
The web side is implemented using Phoenix LiveView. The project makes use of live sessions, HEEX language, Phoenix Components, JS contexts and Hooks.
-
Styling built with Tailwind CSS, with a mobile-first design and light/dark themes.
In order to build and run this project, you need a working Elixir environment. You can also use Docker and avoid any other setup.
The project makes not use of any other runtime dependency (like databases), so getting it running "should be" straightforward.
If you have running Docker, getting the project is a matter of building and running it:
docker build . -t two-eleven
docker run -p 8080:8080 two-eleven
Make sure your 8080
port is free to use. You can also redirect it to other
port or set PORT
environment variable to change it.
Development is also possible inside docker using the builder
stage.
If you have a compatible elixir version running in your system, just run:
mix deps.get
iex -S mix phx.server
If you don't have a compatible running elixir version, you can use one of these methods to get it:
-
This project has a .tool-versions file that states the elixir version required by the project. Use ASDF to install it.
-
If you use Nix, this project provides a flake with a development shell.
The purpose of this project was to be developed in one weekend, so some ideas, features and other improvements were leave out. These are some of them:
- Democracy and anarchy game modes.
- CI/CD deployment pipelines using Github Actions.
- Use
TwoElevenWeb.Presence
to show who is online in a game. - Touch and gesture support for mobile gaming.
TwoElevenWeb
tests.- Persistence layer.