Game Timing

Blitz3D Forums/Blitz3D Beginners Area/Game Timing

Zace(Posted 2004) [#1]
I am trying to write a game for up to 10 players - design stage at the moment. I am writing down all the procedures that I need I order to build it up gradually.

The one problem I am trying to get my head round is timing. Once machine will be a Host. Now if player A has a a P4 3.2GHz and player 2 has a P3 player A may well get a skill off before player B has even drawn the first particles.

Do I have tro send out a clock ping to every client every program cycle?
I dont want to design a MMORPG but they manage it and i was wondering what i need to implement in my code. (I am using BlitzPlay Lite)

Cheers
Zace.


Matty(Posted 2004) [#2]
What you would need to do is have a basic frame rate that you wish the game to achieve..for the world updates..not necessarily the screen updates. Then if a PC is not keeping up with this frame rate and is not at the same frame as the faster computers you need to calculate more world updates per frame for the slower PC until it is within a reasonable frame difference of the faster PCs. Furthermore, depending upon the game you are writing you may need to ensure that the same random numbers are generated for each machine and that only integer calculations are performed. The reason for the integer calculations as opposed to floating point calculations is that different PCs can vary (at the 6th decimal place or greater usually) in their result from the same calculation performed.

Furthermore if you were to use a method similar to this then you would need to ensure that all the PCs have a rough idea of where each of the other PCs is upto (ie what world update frame the game is upto).

Basically you want to separate your world/event calculations from your graphical updates.


eBusiness(Posted 2004) [#3]
If want to ensure a fair game, then it could be an idea to have a standard delay time for commands. For example if one player take action in frame x, then it will always get executed in frame x+4. Otherwise the host will have a lower reaction time.