scp-fs2open / scp-fs2open/fs2open.github.com
Optimization Opportunity: Mission restarts
- Dominant language
- C++
- Stars
- 487
- Forks
- 184
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 44
Description
It's a small thing, but the fact that restarting missions takes any time at all has long somewhat baffled me. If making very very hard gameplay, it's a big value to get the player back in motion ASAP after the fail, and even five or ten seconds of wait can cause huge friction if repeated. So, i profiled.
I started a mission with a fair amount of stuff in it, then a few seconds beginning, hit escape and restarted the mission. The restart took around six seconds. As I said, a fairly small thing normally, but still eyebrow raising to me. What is it doing in those six seconds, when it should already have all the assets in memory and just need to reset some realtively simple mission and ship state?
Well, the answer is that it's loading stuff. In my test case, reloading the skybox texture is 9% of it. Reloading ship textures and weapon bitmaps is together 27% of it. And reloading what looks like all the preloaded sounds 50% of it. That's all stuff that really shouldn't be flushed on a restart, I would think? At the very least not stuff marked as preloadable.
Actually parsing the mission itself is only 4%, less than a quarter of a second. for whatever it's worth.
I figure omitpizing this away would probably require a lot of relatively deep changes, but I figure it should go on the pile anyway.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.