I'm creating a server for my game and I thought it could be a good idea to try scala and akka. I read the documentation a bit quickly and I came to an idea of architecture. But before doing anything I thought I could maybe ask the more advanced users if I was taking a good road.
Basically my game server receive Array[Byte] with hookup: http://backchatio.github.com/hookup/ (websocket !) from the client and host a certain number of "party". It is supposed to decode the Array[Byte] into more structured data with sBinary, then Interpret them by associating a structured data with the party it is supposed to be sent.
So I come to this architecture: A Master Actor receive Array[Byte] (master ! arrayByte) and delegate them to specialized actor that decode them and send them back to the master as more structured data, then the master when he receive those structured data delegate them to Interpreter worker that understand the structured data and change the state of the corresponding game that is hold in a Software Transaction Memory Map [Id,Party], then he send back the order he received wrapped into a Checked(order:Order) if the party say it's a valid order to the client which can now on assume his order is correct and interpret it in his own version of party.
Maybe you want to have a look at Akka IO to take advantage of non-blocking IO for your data packets, and Akka Finite State Machine to implement your game state.
They could come in handy for the kind of stuff you want to do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With