Server architecture for physics in a turn based game networking
Members - Reputation: 100
Posted 28 February 2012 - 10:32 AM
Each turn has two phases in which
first: the player will first move all of his characters and
next: be able to attack( phase where the physics simulation will take place ).
Ideally I would be able to replay the events which occur in one simulation onto the other device.
What is the best way to set up networking architecture in order to maintain the same physics simulation ( or results ) on both devices?
Should I run the simulation on one device and then send the resulting information to the other? Or should I set up a server which could handle user input, simulate the physics and then send that to both devices?
From what I understand about synching physics in games is usually people fix the TimeStep and GameTicks across devices however this is more for realtime synchronization correct? Would this be useful for my project since the physics does not have to occur simultaneously ( just needs the same output )? Are there better techniques I should look into?
I am new to networking so any information one any viable techniques could be useful although I have done some research on the subject. I would also consider writing my own physics to bypass issues with network integration.
Members - Reputation: 1054
Posted 29 February 2012 - 05:05 PM
With this architecture, you can support most hardware platforms since you're not relying on the clients to calculate the results of a physics step (and in terms of security, this is a best practice since a client could modify the results before sending them back to the server).
If there is a time span of several days between turns, it doesn't make sense to keep the game state in memory while a game is in progress. Especially if the game is never completed by the players. So, you'll probably want to have some sort of backend database to store the state of all the ongoing game sessions after a certain timeout period has been reached. If you're supporting cell phones, theres a good chance that the signal gets lost so you'll have to have some way to resume a game from its last state. All of this suggests that you'll also want to be able to identify returning players so that you can see if they have games in progress, so some sort of indentification scheme might have to be created (logins? unique id's?)
Hobby: Game Developer
Currently employed as: Sr. Sharepoint Developer in Afghanistan
Moderators - Reputation: 3297
Posted 01 March 2012 - 11:21 PM
Yes, in that system, one client can cheat. Currently, phones and consoles make it easier to detect and turn off hackers/cheaters, so it's less of a problem. If you really want to solve for that, you need a game server that arbiters the result of the turn, and lets both players know the outcome.
Members - Reputation: 1566
Posted 02 March 2012 - 11:27 AM
I would start the simulation on both devices, but send updates at a fixed rate (every 100-200mS?) from the master to the other device with the master's current state (ie, location, velocity, and state of each object in the game), and if the 2nd device has strayed any, it would get back on track.
Just my thoughts on a simple method for this.
---(Old Blog, still has good info): 2dGameMaking
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)