JACoders / OpenJK

Community effort to maintain and improve Jedi Academy (SP & MP) + Jedi Outcast (SP only) released by Raven Software
GNU General Public License v2.0
2.01k stars 614 forks source link

Fix hanging cutscenes on fast machines #1153

Closed lawadr closed 1 year ago

lawadr commented 1 year ago

On machines that can load levels faster than the hardcoded entity spawning delay, the Icarus sequencer could reference non-existing entities and therefore fail to chain events to progress cutscenes.

This change increases the number of warmup frames by 1 to push the possible client-server connection time to after all relevant entities have been spawned.

Fixes #1150

ensiform commented 1 year ago

After all that checking and investigating only adding 1 additional frame was sufficient? Crazy.

I do know that Enemy Territory uses 6 frames but I never really knew why. Maybe their mod code scripting depends on that too. But it's MP only. Perhaps Rtcw SP also does.

lawadr commented 1 year ago

After all that checking and investigating only adding 1 additional frame was sufficient? Crazy.

I do know that Enemy Territory uses 6 frames but I never really knew why. Maybe their mod code scripting depends on that too. But it's MP only. Perhaps Rtcw SP also does.

Very.

There's a few constants defined in the source, such as START_TIME_REMOVE_ENTS, whose purpose seems to be to stagger things enough to just make everything work. Initialisation events seem to happen in a series of "waves" separated by 50 to 100ms. If the client connects too early then you'll probably hit an issue of some kind. I guess you just need to make sure the warmup frames are sufficient for the number of these "waves" in a game.

Obviously computers were nowhere near fast enough back then to ever hit this issue. I think what finally did it was SSD speeds. I'm loading a level in 0.4 seconds now.