Re: reducing lag in a bgt game?

Instead of calling wait in each iteration of the loop, try setting up a timer to only wait after so many milliseconds. So something like
timer time;
while(true)
{
1+1;
if(time.elapsed>=500)
{
wait(2);
time.restart();
}
}
This is more beneficial for you because if you tried looping through 50 enemies and you wait 2 ms on each loop, that's 100 ms per loop just from you telling it to wait that long. Throw in a bunch of other things it needs to loop through and you'll run into more issues.
Wait is only important so that the processor doesn't stay at 100 percent for any extended period of time, and to allow other programs access to it. The small calculations you're doing in an audio game are severely minimal compared to most mainstream games that run on the computers we have today, so you really shouldn't be running into lag due to the processor. If you're experiencing lag, it's more than likely either the lack of wait functions, or the over use of wait-functions.

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : sneak via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : sneak via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : lukas via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : lukas via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : lukas via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Trajectory via Audiogames-reflector

Reply via email to