Saturday, July 8, 2017

Abiathar API - Level formats

As of v2.9, Abiathar allows extensions to define level formats so that the editor can support other games. Implementing level formats is at a lower level than most extensions' work. To provide a format, an extension must have a reference to FMod.dll.

Abiathar internally uses an INextGenLevelSet to store the levels, so an extension that provides level formats must have a class that implements that interface. A level format object implements ILevelFormat, which has these members:

  • ID gets the internal name of the level format. By convention, this should describe the storage format of the maps in some way. For example, the normal format is called Carmack.
  • DisplayName gets the user-friendly name that shows up in the Level Format tab of the New Project Wizard.
  • SizeRestrictions gets a LevelSizeRestrictions object describing the limits of the map format.
  • WizardResources gets an array of up to three LevelResourceDescription objects. These objects set the file description (e.g. "GameMaps") and whether the setting refers to a real file (which is used to determine whether Browse should be enabled). If this is null, the level format uses a custom resource browser, and the NPW replaces the text fields with a single button to launch that browser.
  • SupportedExtraData gets an array of extended data field IDs that the level objects support.
  • LevelGenre gets a string that identifies the kind of level in some way. For example, "3PlaneKeen" is the genre for Keen Galaxy and Dreams.
  • DisplayCustomLevelResourcesDialog instructs the format to display its custom resource browser. This will only be called if no wizard resources are supplied. The input and output arrays may contain up to three strings. Return null if the user cancels the dialog; return data if the user makes changes and saves them.
  • CanContinue returns whether the NPW can advance given the current resource values. For plain file resources, Abiathar already checks for existence if necessary.
  • SaveLevels saves the level set to disk using the resource configuration provided by the user.
  • CreateLevels generates an empty level set.
  • CreateLevel generates a blank level with the given dimensions. The return value may be a subclass of GalaxyLevel.
  • LoadLevels loads a level set from disk.
  • GetLevelExtraData returns an extended data field's value for the given level.
  • SetLevelExtraData sets an extended data field's value for the given level.
To register a level format, call AddFormat on an AbiatharRegisterLevelFormatEvent in the event bus.

No comments:

Post a Comment