Controlling speed based on machine performance |
WoolyMammoth
(1/12/00 2:18:14 pm) How do I make it so that my DirectX7 DirectDraw game runs at the same speed on all computers? Thanks for all the help so far.
black eyez (1/12/00 7:25:46 pm) What you can use is GetTickCount in your main game loop.. Have it so that it will only allow the loop to execute if a certain amount of time has passed. This makes the animation the same speed on all computers as long as they can keep up to the minimum you set. David
WoolyMammoth (1/12/00 8:30:48 pm) Excellent... thanks
Eric Coleman (1/13/00 11:42:48 am) This is what I do to insure
a constant speed of gameplay on different computers.
For example and for simplicity
of the example,
If the program gets a tickcount
of 134, it draws frame 1,
You can use this idea to somewhat sychronize internet applications. Granted this method I'm about to explain won't work for a doom type game or something with really fast action like that. It would work for a RPG for example. If person A is acting as a server, then person B which is a client, pings the server and adjusts their tickcount based on that reply. Example, person B pings person A and gets a 829 ms delay. To somewhat synchronize them, person B adjusts his tickcount by adding 829. So if his tickcount is 384, he adds 829 to get 1213. Frame 12 would then be drawn instead of frame 3. I hope that helps, Eric
WoolyMammoth (1/13/00 4:01:21 pm) Thanks everyone
|