I am in the phase of designing a mmo browser based game (certainly not massive, but all connected players are in the same universe), and I am struggling with finding a good solution to the problem of distributing players across processes.
I'm using node.js with socket.io.
I have read this helpful article, but I would like some advice since I am also concerned with different processes.
Solution 1:
Tie a process to a map location (like a map-cell), connect players to the process corresponding to their location. When a player performs an action, transmit it to all other players in this process. When a player moves away, he will eventually have to connect to another process (automatically).
Pros:
Easier to implement
Cons:
Must divide map into zones
Player reconnection when moving into a different zone is probably annoying
If one zone/process is always busy (has players in it), it doesn't really load-balance, unless I split the zone which may not be always viable
There shouldn't be any visible borders
Solution 1b:
Same as 1, but connect processes of bordering cells, so that players on the other side of the border are visible and such. Maybe even let them interact.
Solution 2:
Spawn processes on demand, unrelated to a location. Have one special process to keep track of all connected player handles, their location, and the process they're connected to. Then when a player performs an action, the process finds all other nearby players (from the special player-process-location tracking node), and instructs their matching processes to relay the action.
Pros:
Easy load balancing: spawn more processes
Avoids player reconnecting / borders between zones
Cons:
Harder to implement and test
Additional steps of finding players, and relaying event/action to another process
If the player-location-process tracking process fails, all other fail too
I would like to hear if I'm missing something, or completely off track.