Advertisement

Server running with heartbeat?

Started by March 26, 2000 05:15 PM
2 comments, last by Elixir 24 years, 5 months ago
I''m trying to create a server for my game but I''m having trouble keeping the gamestate constant due to update issues. Does anyone know of a good way to keep the game from updating as fast as it can? I have a queue for message commands that need to be processed but I only want to check to see if there are messages to be processed every 1/20th second. I have the game state running in a separate thread from the server UI but this thread runs WAY too fast. Suggestions?
I''m sure you have some function like Game_Main() that serves as the main proc that is called every time you wish to process data for the game. Just create a WM_TIMER (I think it''s that... I don''t use timers usually) and make a call to SetTimer(). Then you can set your game to run every number of times per second. Look in a windows API function reference manual. You should find everything needed there to get a timer going. IMHO, timers are the way to go here.


ColdfireV
[email=jperegrine@customcall.com]ColdfireV[/email]
Advertisement
I knew of Window''s timers but unfortunately they are not very accurate and can only call 18.2 times per second. I need a faster, sharper method.
Have a look at QueryPerformanceCounter in MSDN.

This topic is closed to new replies.

Advertisement