Skip to content

Mancala on the web powered by Rust, Elixir/OTP, and Phoenix

Notifications You must be signed in to change notification settings

brettkolodny/mancala_ex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MancalaEx

Multiplayer Mancala implemented using Elixir/OTP, Phoenix, LiveView, and Rust.

Check it out!

http://www.mancala.brettkolodny.com

How it works

This project is made up of three main parts:

  1. The Phoenix web framework
  2. An OTP game server
  3. NIFs written in Rust

Phoenix

Within Phoenix is the code that handles the website's routes, and player authentication, and front end code written with built in Eex templates and LiveView. This code ensures that the player's data is present before they join a game, the game they are creating exists or is available to be created, and then communicates to the game server to dynamically display the current state of the player's game.

Game Server

The game server is built upon Erlang's GenServer architecture and exposes an api for the code within Phoenix to interact with different game instances in order to update the game based on the player's input. Each time a game is created a new game server is created, and registered within a supervisor process that oversees every game server. This ensures that if a game server were to crash it is restarted without affecting the rest of the application, and that games are deleted after enough time has passed. The game server calls the rust NIFs to determine the new state of the game.

Rust NIFs

The game logic itself is implemented using Rust NIFs (native implemented functions). This code is responsible for determining the game's state after a player's turn and determining if the game has a winner.

AWS

This application is hosted on an AWS EC2 instance.

About

Mancala on the web powered by Rust, Elixir/OTP, and Phoenix

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published