Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Slowing down

Author
Message
Clacker
22
Years of Service
User Offline
Joined: 8th Nov 2002
Location:
Posted: 7th Sep 2003 09:04
Whenever I load in a .x file which is high in polys the "code" seems to slow down....what I mean is insteed of doing a 180* turn in 2 seconds it takes 4-5 seconds. The frame rate drops of cource but that is exspected but it is just like the hole game slows down aswell. I got the darkbasic pro demo and tested it out with that but it still has the same problem. I am using the code that came with the the original cshop called FPSengine. Dose anyone know of anyway to stop it from slowing down the speed in witch the game prosses.
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 7th Sep 2003 09:59
While it can be very difficult in practice, I'll give you the theory behind variable sync frequency.

In a typical game, about 99% of the lag is created by actually rendering the scene - SYNCing (You can use TIMER() comparisons to test this if you'd like). Knowing this, you can influence the overall game speed by modifying the frequency of the SYNC command.


The gist of it is:

If the game is too fast, you call more SYNCs (and perhaps put a cap on the FPS if you have a really fast game).

If the game is too slow, you don't call the SYNC command until sufficent game time has passed (if your game is really laggy, you may consider after a certain point forcing a SYNC every quarter-second or so, thus slowing the game speed but making it more playable).


Now, actually determining how to go about deciding when to SYNC or not is difficult. I have yet to code a completely accurate frame limiter. You'll need the TIMER() call at the very least to do this.

Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 7th Sep 2003 10:05 Edited at: 7th Sep 2003 10:05
There's another process called variable speed, where the speed of anything moving or time-based is increased or decreased to match the current FPS. While this method works, it's not a very accurate method:

Any object moving with a curve (like a parabolic jump) will not move in an accurate curve, but rather will shoot off at the tangent of the curve by some unpredictable distance, when the game starts to lag. Imagine jumping up at a speed of 5m/s, then lagging for 2 seconds. You will have jumped 10 meters too high!

Login to post a reply

Server time is: 2025-05-20 01:47:27
Your offset time is: 2025-05-20 01:47:27