Lately I have seen many projects which have a web interface and backend in erlang (e.g. flash games on fb or similar).
I was wondering something like that (maybe simpler) could be implemented.
I believe they have an erlang application to provide authentication, and another one to provide routing to the actual game. But then, how do they start a new instance of the game application for each different user? Maybe they create a new node and start the application there? Can you provide me some insight?
Using the actor model you create a process for each connected player which reacts to messages from the Flash client, sends messages either directly to other player processes or to a central process handling global state. This player process reacts to messages from other players as well and send updates back to the client.
You may then build your system architecture upon this idea. Maybe you have multiple central processes which handles different parts of the game. Maybe you let players be split between different “rooms” where each room is its own process. Maybe you have one player process which is active even when the player is disconnected, or maybe you just queue messages and react to them when the player returns. The architecture will of course largely depend upon the type of game you are building.