-NiKspSiHoPaT-
New Member
I'm building a website where players can play a turn based game for virtual credits (like a Poker site, but different). The setup I came up with:
- One data server which contains all player accounts with associated data (a database + service). Database and API may be split into two servers, if that helps.
- One or more webservers which serve the website, connecting to the data server when needed.
- One lobby server where players can find eachother and set up games (multiple is possible, but less user friendly)
- Multiple game servers where the game is run (all rules and such are on the server, the client is just a remote control and viewer), with one load balancer.
- A game client
- Player logs in on the site. Webserver sends username/password to data server, which creates a session key (like a cookie)
- Player starts the client. Client connects to lobby server, passing the session key. Lobby server checks this key with the data server
- Once a lobby is created and a game must start, the lobby server fetches a game server from the load balancer and sets up a game on this game server.
- Lobby server tells the clients to connect to the game server and the game is played.
- When the game is finished, the game server lets the lobby server know. The lobby server will check the score and update the credits in the data server.
- Java to Java: RMI
- PHP or Flash to Java: Custom binary protocol via socket. This protocol supports closing the socket when idle while keeping the virtual connection alive and resumable.