Opened 13 years ago

Closed 13 years ago

#764 closed defect (fixed)

Random maps can crash game

Reported by: historic_bruno Owned by:
Priority: Release Blocker Milestone: Alpha 5
Component: Core engine Keywords:
Cc: Patch:

Description (last modified by historic_bruno)

Currently if a random map generator script fails, the game will crash because it has no map data. The best way to deal with this would be to present a message to the user telling them the map script failed, and then return them to the main menu. I'm not sure how the progressive loader can be aborted safely. Another way to handle this temporarily, is to just load a blank map when the generator fails.

Change History (5)

comment:1 by historic_bruno, 13 years ago

I've got a solution to this for progressive loading (when a game is started through the setup GUI). CMapReader::GenerateMap() will return an error code, which ultimately triggers a script function that displays a GUI error dialog and returns to the main menu.

It's a bit trickier for errors during non-progressive loading (e.g. Atlas or autostart) because the GUI isn't loaded and the exact init procedure varies. I'm not certain if we should try to recover or just shut everything down. Some feedback for the user (that's not an uncaught exception) would be the best solution.

comment:2 by Kieran P, 13 years ago

Priority: Must HaveRelease Blocker

comment:3 by ben, 13 years ago

(In [9193]) Handle map loading errors in autostart and normal setup modes. Adds TODOs for Atlas and Replay modes. See #764. Fixes loading screen 'title'. Fixes broken autostart behavior for random maps and multiplayer games.

comment:4 by historic_bruno, 13 years ago

Description: modified (diff)

To test out the new error handling, just do something silly like removing a semicolon from one of the random map scripts, and then try loading it. You should be returned to the main menu with an error message, but more importantly, you should still be able to start a new game or anything else with no further problems.

Since Atlas doesn't support the new random maps yet, it's not a big deal if it doesn't handle errors yet. I guess eventually there should be a new message handler added so the engine can tell the Atlas UI to show an error.

comment:5 by Kieran P, 13 years ago

Resolution: fixed
Status: newclosed

From historic_bruno: It's probably as fixed as it need to be for now. I'm sure there are still many ways to cause problems with random map scripts (e.g. running out of memory) but they're the same sort that affect all the scripted components.

With that in mind, I'm going to close this ticket. Any further release blockers can get their own ticket.

Note: See TracTickets for help on using tickets.