Wednesday, June 14, 2017

FMod - Extensible level formats

I don't plan to add explicit support for a bunch of different level formats to Abiathar. The main goal is just to be an amazing Keen Galaxy editor, and including other different formats and all the exceptions that come with them makes things more tricky. Still, I want to allow other sufficiently determined people to make Abiathar work with those levels. Therefore, I decided to allow extensions to provide level formats, and that's what I've been working on yesterday and today.

At startup, extensions are given the opportunity to register level formats. When there are extended formats present, a dropdown for them appears on the Level Format page of the New Project Wizard. The formats then dictate the map resources (e.g. "GameMaps" or "MapTemp") and whether they're simple files that can be browsed for. Alternatively, formats can decline to use the traditional NPW, in which case the Level Files interface is replaced with a single button that launches the format's custom configuration dialog.

At dependency file opening time, the format is responsible for creating or loading a level set object. When levels are added, the format has a chance to return a subclass of GalaxyLevel if it wants, or it can return nothing to let Abiathar do the default. To expose extended level features, Abiathar level wrappers now have an ExtraData property, reads and writes of which eventually make their way to the level format. This is how I implemented the "pushwalls always active" flag in Rise of the Triad.

There are a lot of Abiathar features that only make sense for Galaxy levels, so I also introduced a "genre" field on level formats, the meaning of which is intentionally left somewhat vague. Basically, the default genre activates all the normal Abiathar features, while unknown/new genres indicate to tools that they can't make Galaxy assumptions. Currently nothing actually checks this, but it seemed like something good to have for the future.

Using all this, I have a working Rise of the Triad extension. After some more testing and polishing, these changes will be released as v2.9.

No comments:

Post a Comment