-
Notifications
You must be signed in to change notification settings - Fork 0
Specs:Content Loading
The content loading system for Yuuki uses selective resource loading from collections of resources called content packs. Every content pack is located in either a directory or a ZIP archive. Because the content loading system can load from a ZIP archive, built-in content may be distributed with Yuuki inside of the game JAR file.
The engine begins by loading all built-in content located in the directory yuuki/resource
within the package structure. This is done regardless of whether Yuuki is executed from inside a JAR file. Next, the engine scans for a directory called ../mods
relative the package structure root; this will be the same folder that contains the JAR file if the engine is being executed from inside of one. If the mods directory exists, it is scanned for mod directories and/or archives, which, if valid, are loaded into memory, but not yet merged with existing content.
Sound effects, music, and images are all loaded using the same process. Each of these types uses an indexing file that maps file names to indexes. The loading of that file is a separate operation from the loading of the files themselves.
Portals, actions, and tiles are stored in single files that contain multiple definitions. The loading of each type follows the same general process:
The loading of entities follows the same pattern as that of portals, actions, and tiles, but with the additional requirement of an ActionFactory:
World definition files are simply lists that give the land files that must be loaded. Loading a world file follows the general process for loading any list of files:
Land files are listed in a world file, so they loaded as any listed set of files is loaded:
Mod loading adds a view to the options screen that allows users to enable and disable mods. The view displays the detected mods and provides a check box for each that controls enabling and disabling.
When a mod is enabled, its content is added to the current working content set. If it contains duplicate definitions, the old definitions are masked by the new ones.
When a mod is disabled, its content is subtracted from the current working content set. If any content was masked by the content being removed, it is then unmasked.