Members - Reputation: 157
Posted 27 August 2000 - 04:51 AM
I don't pretend to know anything.
Members - Reputation: 116
Posted 27 August 2000 - 05:25 AM
Posted 01 September 2000 - 11:40 AM
Members - Reputation: 122
Posted 02 September 2000 - 12:07 AM
const DWORD Speed_Value = 50; // The higher, the slower
while (1) //Main loop
LastTime = timeGetTime ();
while (timeGetTime () < LastTime + Speed_Value)
// Do something useful
- - - - - - - - - - - - - -
Members - Reputation: 142
Posted 02 September 2000 - 01:23 AM
Be very carful about this. THink about how this would work. Just say you have 32 players connected. What happens if one players has a peice of shit for a PC and can''t maintain the frame rate? Or if a big battle ensue''s? or .. etc...
Take a slightly different tact. Seperate you frame rate from the input event system.
Think about this. Only sample your mouse/keyboard at a certain rate. For example 50 ms. Then let your frame rate run at whatever it wants to(either locked or open like quake, whatever you want). The at each 50ms interval you grab the movements, act on them and send off the network packets. This way if you hit a slow pocket because everyone piles in to one room your movement\network layer in unaffected by the slowdown, ditto with diferent speeded pc''s.
(This is a very basic example. Once you get it, think about running the network\input in a different thread with a timing delay loop. Also think about using input events, like DirectX''s buffered input or SDL''s events. That way no matter what interval you pick you always get ALL keypresses.)
(oh, and for info on QueryPerformaceCounter check the general programming forum. I gets ansered about evey week. Also check flipcode "Code of the day for some nice classes")