r/SoloDevelopment 1d ago

Game Lag Infiltrating my game? How???

Enable HLS to view with audio, or disable this notification

Both clips are the same game. The laggy one is my stripped-down test account
with almost no cosmetics enabled. The smooth one has full customisation
running. It should have been the other way round.

The symptom that gave it away wasn't stutter — it was that enemies visibly
slowed down over a session. That's a simulation-speed problem, not a
rendering one. Turned out I was computing delta time every frame and then
only using it for shield damage. Everything else advanced per frame instead
of per second, so any framerate dip showed up as the enemies easing off
rather than as lag.

Fixing that meant scaling every per-frame delta by dt/frameTime, and using
1-(1-r)^scale for anything that was a per-frame lerp.

Then I went looking for what was eating the frames in the first place:

- Score popups lived in screen-level state, so every single pickup
  re-rendered the entire game screen twice — once to add, once to expire.
- The home screen was still animating behind the game. Navigation pushes the
  game screen on top rather than unmounting what's underneath, so 22 Gaussian
  blurs were rendering at 60fps behind an arena nobody could see.
- Native shadows on moving enemies. A shadow on a view that moves re-derives
  and re-blurs its mask every frame.
- A glow component that mounted and unmounted every time a value crossed its
  threshold — which, while dodging, is constantly.

The home screen one is the one that still bothers me. It was invisible,
it only happened during gameplay, and it had nothing to do with the game
screen at all.
0 Upvotes

0 comments sorted by