Questions about FPS

Blitz3D Forums/Blitz3D Programming/Questions about FPS

AngelOnFira(Posted 2014) [#1]
So I understand that certain computers will have higher FPS depending on their hardware. My question is when a networked game is running, how do you go about limiting how much a player moves each second depending on their computer speed. Obviously you would want to make sure that they had some type of movement each frame, as well as make sure that they were not going faster than the enemy players because they have more frames per second.

The way I imagine this is instead of saying move this far forwards, say check the time between each frame and move how ever far a preset speed will get you. So say if i say the player moves 10,0,0 in one second, and the frame updates every tenth of a second, then every frame move him 1,0,0. Is that an acceptable way of going about this?


RemiD(Posted 2014) [#2]
A way to do this :
http://blitzbasic.com/codearcs/codearcs.php?code=2916

There is no network in this example but it can probably give you some ideas...


fox95871(Posted 2014) [#3]
Look into Render tweening too, one of the best techniques there is for Blitz3d. Same snag with the lag though, not sure it would help much there. That's an old problem that's never been solved that I know of, but my suggestion is to never lower the framerate. When there's lag, just keep the character and level running locally, and run other players off a set of assumptions taken when there's no lag.


AngelOnFira(Posted 2014) [#4]
Hmm... I just read up a bit on render tweening... from what I understand, you basically can keep the game loop at 30 times per second, but allow the world to render at over 30 times per second?


Who was John Galt?(Posted 2014) [#5]
Yup. Whatever you do, go with fixed rate logic. It saves headaches in the long run, especially if you use any physics.


Yasha(Posted 2014) [#6]
Sounds like as good a time as any to break out an old classic article: http://gafferongames.com/game-physics/fix-your-timestep/

A translation to B3D:



fox95871(Posted 2014) [#7]
Oh wow, the render tween with descriptive variable names! Heh, I just copied and pasted the original making no attempt to figure it out.

So what about keeping it at thirty during lag in multiplayer games? If everything looks smooth but is inaccurate, then gets made accurate when the new data shows up, that would seem to be a lot better than the way things are handled now. It would also make for some pretty funny results at times...

1. Game is severely lagging at about ten second intervals.
2. Some other player tends to avoid the boss by retreating to the cliffs a lot.
3. Move them toward the cliffs then till the next update.
4. Oops, they ran off the cliff!
5. Oh wait, here comes the real update...
6. Ah, the assumptive code was wrong, they didn't really run off the cliff.