Savegames and add-ons, code cleanup

For the past two weeks, I’ve been working on better add-on handling, add-on compatibility checking for savegames, resource management code cleanup, and various UI improvements.

Box content selection

The handling of Snowberry .box add-ons was improved so that the contained files are recognized as belonging to one of the three possible categories: required (always loaded), recommended (loaded by default), or extra (not loaded by default).

I added a new UI popup where you can toggle the box contents on or off. The same UI will work with native Doomsday 2 packages that declare recommended and extra packages in their Info.

box_content_selection

Doomsday now also recognizes .zip files as add-ons, treating them the same way as PK3 files.

Package metadata in savegames

It has been a long-standing issue that savegames created with add-ons are downright incompatible with saves created without any add-ons (or different add-ons), even leading to a crash when trying to load the save.

To address this problem, savegames now include information about which packages were in use when the save was written. When the save is loaded, a check is made to see if matching packages are available. In case there is a mismatch, a helper dialog will open allowing you to easily load or unload packages as needed.

Thanks to the zip-based savegame format that was introduced in 1.14, adding this metadata could be done without breaking compatibility with existing saves. (Old saves naturally won’t contain information about the packages that were used, so you’ll still have to manually ensure that the right files have been loaded.)

Having this metadata available also allows showing savegames in the Home UI so that they appear under the profiles that use compatible add-ons. It is good to note, though, that the old in-game save/load menus remain unaware of any game profiles — there is still room for improvement here when it comes to organizing the storage of the save files.

Code cleanup

While working on the savegame metadata, I’ve been trying to chase down a couple of problems leading to crashes when data files are loaded or unloaded while a game is running. I was not very familiar with the code in question, so first I needed to get some kind of an idea about what was going on. A productive way to achieve this was to clean up and refactor the code.

I ended up doing a considerable amount of code cleanup. While moving and splitting classes I managed to locate a number of issues that contributed to the crashes. Now with these fixed, the crashes also seem to be gone.

UI improvements

I also managed to do a number of minor UI behavior and appearance improvements:

  • Better list item behavior when there is a large number of items. Scrolling quickly in the list no longer causes inordinate slowdowns.
  • New “file” icon indicating non-package add-ons (e.g., WAD, DEH, etc.). Visible in the screenshots above.
  • Updated UI font on the Mac (San Francisco!).
  • Log entry styling changes.
  • Mouse cursor no longer disappears when switching focus between app windows when the Home is visible.
  • LAN games shown at the top of the MP games list.
  • Connecting to a server running on an IPv6 address.
  • Retina screenshots on the Mac. Previously the full window area was not included in the created images.