Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game crashes if the player fails a mission with no "no_ships" line set in the data #408

Closed
elasota opened this issue Mar 13, 2022 · 4 comments · Fixed by #414
Closed

Game crashes if the player fails a mission with no "no_ships" line set in the data #408

elasota opened this issue Mar 13, 2022 · 4 comments · Fixed by #414

Comments

@elasota
Copy link
Contributor

elasota commented Mar 13, 2022

Appears to be some sort of race condition or discontinuity that can crash the game in debug conditions, but might be a symptom of a real problem that needs to be diagnosed.

Reproduction steps:

  • Launch game
  • Click "Demo"
  • When the demo reaches the point where the player's last ship dies, pause the process
  • Resume the process about 30 seconds later

It will crash with the following stack trace:

>	antares.exe!pn_strdup(const pn_string * s) Line 309	C
 	antares.exe!pn::string::copy() Line 236	C++
 	antares.exe!antares::PlayerShipBodyExpire(antares::Handle<antares::SpaceObject> flagship) Line 1170	C++
 	antares.exe!antares::NonplayerShipThink() Line 329	C++
 	antares.exe!antares::GamePlay::fire_timer() Line 466	C++
 	antares.exe!antares::GLFWVideoDriver::loop(antares::Card * initial) Line 519	C++

This appears to be because g.level->solo.no_ships is an "optional" but is not set. If the process isn't paused/resumed, then the demo ends and PlayerShipBodyExpire isn't called.

@elasota
Copy link
Contributor Author

elasota commented Mar 13, 2022

Looks potentially valid. srtm.pn doesn't define any "no_ships" string, so I guess it can be uninitialized if you fail it?

@sfiera
Copy link
Member

sfiera commented Mar 13, 2022

Hmm. In practice, the replay shouldn’t get that far, because the key input stream ends before the last ship dies, and that’s supposed to stop the replay. Somehow, pausing (do you mean ESC or CAPS?) must allow the game time to advance further.

(It would also be good to not crash when no_ships is empty, because that could happen in real levels)

@elasota
Copy link
Contributor Author

elasota commented Mar 13, 2022

I mean like suspending the process with the debugger attached. Not 100% sure if this is reproducible in a real-world scenario yet, but should probably test to see what happens in Space Race, The Musical if you game over from ship loss.

@sfiera
Copy link
Member

sfiera commented Mar 13, 2022

I see, that makes more sense. If the process is suspended and resumed, it will probably attempt to catch up by running the clock through that whole time, before the replay end check.

The corresponding real-world scenario would be a very slow computer that can't effectively keep up, though that computer is not going to have a good time anyway.

@elasota elasota changed the title Crash if process is suspended too long in first demo Game crashes if the player fails a mission with no "no_ships" line set in the data Mar 13, 2022
sfiera added a commit to sfiera/antares that referenced this issue Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants