You should really just make sure that you handle that edge case inside the loop. Even if you ignore it then. Thats better than having the higher scope handle it. You could even add an option of should i ignore it or not.
No seriously, that game literally could not lag. If the logic loop wasn't done when the game needed the next frame, it would just go for it. Happens because the score calculator uses a "for" loop using the level as an iterator, so it runs out of time at very high levels. There's also strategy on holding down inputs in specific ways because that will -slightly- nudge how far in the main loop it gets before getting cut off, which prevents the game from crashing because of some registers being on invalid values during the forced next frame
The dev could optimize further here by simply setting fps to 60 and having it be a const, thus eliminating the need for a branch prediction which could waste ~20 CPU cycles on a cache miss
417
u/IsEqualToKel Sep 30 '26
if (currentState == GameState.Crash)
{
currentState == GameState.DoNotCrash;
}
65
u/Ydo4ki Sep 30 '26
try { } catch(Error e) { delete e; continue; }
77
u/TrackLabs Sep 30 '26
Just set it as a constant
62
u/SuperfanZero Sep 30 '26
fps = max(fps, 60.0)
17
u/stevorkz Oct 01 '26
GPU manufacturers hate this one trick.
14
u/BetaChunks Oct 01 '26 edited Oct 01 '26
NES Tetris type strategy
No seriously, that game literally could not lag. If the logic loop wasn't done when the game needed the next frame, it would just go for it. Happens because the score calculator uses a "for" loop using the level as an iterator, so it runs out of time at very high levels. There's also strategy on holding down inputs in specific ways because that will -slightly- nudge how far in the main loop it gets before getting cut off, which prevents the game from crashing because of some registers being on invalid values during the forced next frame
25
u/chaylarian Sep 30 '26
Best optimization ever!
20
u/Summar-ice Sep 30 '26
const FPS = 60
7
u/LonelyPoorMan69 Sep 30 '26
7
u/MushroomGecko Oct 02 '26
The dev could optimize further here by simply setting
fpsto 60 and having it be a const, thus eliminating the need for a branch prediction which could waste ~20 CPU cycles on a cache miss5
u/Zwischenschach25 Sep 30 '26
plot twist: fps is a pointer
4
u/Ok_Camp555 Sep 30 '26
2
u/lowboom64 Oct 01 '26
that does seem to be how AAA devs are doing it at least with AI frame gen bs being a thing
1
u/PopularAd5100 Oct 01 '26
If I work less than 40 hours a week, pay me for 40 hours a week. Gaming the system!
1
u/GabiTheProgrammer Oct 01 '26
Should have used <= in case it would change until the assignment is executed.
1
u/SpaceFire000 Oct 01 '26
I tried something similar to my bank account but it didn't work
1
u/Random_-account Oct 01 '26
We did it, guys! Frame rate lag is no more!
1
u/Windsupernova Oct 06 '26
Just like how the dont do the whole goodAI="true"
Devs are so lazy this days. Why cant they fit all this HD assets into a game boy cartridge? Dont they know how to optimize?
1
u/PioApocalypse Oct 06 '26
Vsync /s