Update.
Finished the initial connector_server setup and map_server. I'm now able to login using an existing character, or create a new one. I'm really impressed with Elixir as I've written way less code than I was expecting for the features I've implemented. Please poke holes in any of my design choices below. I'm open to any constructive criticism.
Below is the current structure of the project. I have split the server into multiple application components.
Common: Common code that can be re-used between projects (Packets, Helpers, Encryption, etc)
game_server/connection_server: Application for handling client connections and state. Multiple connection_server's can be spun on different physical servers if needed
map_server: manages maps under a supervision hierarchy. The server spins up a single process to handle each map. When the server starts it queries the map table to know which maps to host. It then registers itself as a global process to allow map processes on different physical server to communicate! When the server boots up I have a setup script that interconnects all available servers.
The cool thing is I can treat each map process as if it were a local one. I simple call GenServer.whereis {:global, :"1000" } and it will return the PID of the process for me to communicate with it.
I'm also deciding how I want to split the maps into sectors (so messages/packets are only sent to objects that care/are in view of). I was thinking about having processes under each map to handle each of its sectors.
npc_server: This application will be used to host all NPC's
This image below gives a overview of how I'm designing the server. Essentially you can host everything on a single server or split the applications into the different servers to enable further scalability. Obviously a CO private server will never need this kind of scale, but I'm doing this as a learning exercise
Components:
- One or more connection servers (Handle Client Connections & state)
- A database server
- One or more world servers which can host one or more maps.
See you guys next update