Skip to content

Content:Creation

TF Nelson edited this page Jul 23, 2013 · 9 revisions

The Yuuki Engine reads game content in a manner such that it is easy to modify content without having to edit the source code. The engine reads in main game resources from the package yuuki.resource located within the project class path, but it is also capable of reading from an external directory. In the future, there will be a directory that the engine scans for additional content to load, enabling easy addition of resources.

For mod examples, check the files provided on the Testing page. Several example mod files are included that should be sufficient for showcasing each type of content that a mod can have.

Content for game consists of a number of files that are to be used by the engine. Each of these files can be one of several formats, including images, sounds, and data files. These files are also known as resources.

Some resource files are data files that have a special format called Definition File Format, defined in the page Content:Definition File Format. This is a type of CSV format, but there are some special restrictions that make its use a bit different; visit the Definition File Format page before working with this format for a more in-depth description of it. Files of this format can be easily identified by their '.def' extension, and because of that extension, they are typically referred to as DEF files. Only certain files need to be in this format, and they will be described in detail later on this page.

There is another resource file format called Land File Format, defined in the page Content:Land File Format. This is the format for maps in Yuuki. It is a text-based format that makes editing simple. Files of this format have a '.lnd' extension. All land files have the map of the land drawn in ASCII art and some additional information on portals, entities, and items that appear on the map.

A content pack is any collection of resources that can be used by the game. The engine has one content pack that it comes with, which is referred to on this wiki as the built-in content pack.

A content directory is a directory that contains all game resources in a content pack. All content packs have exactly one content directory associated with them. As mentioned before, the engine uses the yuuki.resource package directory as the content directory for the built-in content pack. Content can be added to that directory to add it to the game. This is the preferred method for project contributors to add built-in content. This method can also be used for content not intended to be added to the distribution, but this should only be done while external mod-loading is not supported.

Content Manifest File

Every content pack must have a DEF file called the content manifest file. This file lists what resources that the content pack contains and where to find them within the content directory. It must be titled content.def and it must be located in the root of the content directory structure. Each record in this file specifies the location of some resource or directory within the content directory. The first field in each row is the content identifier, and must be one of several recognized keys to be useful. The second field in each row is the path, relative to the content directory root, to the identified content. For more information on content manifest files, see the page Content:Manifest File.

Sound Effects and Music

In Yuuki, sounds are referred to by using a special value called a sound index. Adding sounds consists of two parts; adding the sound file itself, and adding a definition that maps a sound index to the added file. All audio files to be added must be of one of the supported audio formats that are listed in Content:Audio Formats.

To add sound files, a content pack's content directory must include a directory for the sound files, and the manifest file must list that directory's path. This may be the same directory for both music and sound effects, but they must be listed separately in the manifest file. To add a directory for music files, add a listing for MUSIC_DIR in the manifest file. To add a sound effect directory, add a listing for SOUND_DIR. All sound effect and music files to be added are placed in their respective directories or in a sub directory.

Sound index mappings for sound files are contained in a DEF file within the content directory. Once again, music and sound effect mappings are listed in two separate places, but these files cannot be the same. To add a Content:Music Definition File, add the file and list its path under MUSIC_DEFS_FILE in the manifest. To add a Content:Sound Definition File, list it under SOUND_DEFS_FILE in the manifest. Both music and sound effect definition files have the exact same format. Each row in the file consists of two fields. The first contains the sound index, and the second contains the path to the sound file to map to it, relative to the path listed under MUSIC_DIR or SOUND_DIR in the manifest.

Images

Images in Yuuki are added in the same style as sound files. To include an image file in a content pack, the file itself as well as a definition that maps the file to an identifying index must be added. All image files to be added must be of one of the supported image formats that are listed in Content:Image Formats.

To add image files, a content pack's content directory must include some directory that contains the image files to add, and the manifest file must list this path under the key IMAGE_DIR. All image files to be added are placed in that directory or in a sub directory.

Index mappings for image files are contained in a DEF file within the content directory. To add a Content:Image Definition File, add the file somewhere in the content directory and list its path under IMAGE_DEFS_FILE in the manifest. Each row in this file consists of two fields. The first contains the index, and the second contains the path to the image file to map to it, relative to the path listed under IMAGE_DIR in the manifest.

Maps, Worlds, and Lands

In Yuuki, the map system consists of two components, worlds and lands. Every content pack may add exactly one world. Every world consists of at least one land. Lands in the same world may be traveled between by using portals. Travel from one world to another is not possible.

To include new land files, a content pack's content directory must include some directory that contains the LND files, which are in the format described on the page Content:Land File Format, to add, and the manifest file must list this path under the key LAND_DIR.

Adding new lands without adding a world that includes them isn't much use, unless the intent is to overwrite the maps provided in the built-in content. To add a new world, a content pack's content directory must include a Content:World Definition File, which contains land definitions for the world. The manifest file must list the path to this file under the key WORLD_DEFS_FILE. Every record in the world file contains only a single field that contains the path to a land file, relative to the path listed under LAND_DIR in the manifest.

Entities

Entities are things that move around on the screen. Player Characters and Non-Player Characters are the two main types of entities.

A content pack that adds entity definitions must contain those definitions in a DEF file of a format specified in Content:Entity Definition File, and it must add the path to that file into the manifest under the ENTITY_DEFS_FILE key. Every row in the entity definitions file defines a single entity.

Actions

One of the fields in a row of an entity definitions file refers to action ID numbers. If the current actions provided by Yuuki are not sufficient for the purposes of whatever entities are being added, new actions may be defined.

A content pack that adds action definitions must contain them in a DEF file of a format specified in Content:Action Definition File, and it must add the path to that file into the manifest under the ACTION_DEFS_FILE key. Every row in the action definitions file defines a single action.

Portals

Portals are objects on the map that transport entities to different locations. Portals can not only transport entities to different locations within the map they are used in, but also to entirely new lands that are within the same world.

Adding portal definitions allows portals with new appearances to be used in a LND file. A content pack may add portal definitions by including a Content:Portal Definition File and adding a path to that file into the manifest under the PORTAL_DEFS_FILE key. This file has a simple row format: the first field contains the unique name for the portal, which is how it is identified from within a land file, and the second field contains an image index that references the tile art for the portal.

Tiles

Tiles make up the map part of LND files. Adding new tiles allows tiles with new appearances and behaviors to be used in a LND file. A content pack may add portal definitions by including a DEF file with the definitions and adding a path to that into the manifest under the TILE_DEFS_FILE key. The DEF file must have the format specified in the page Content:Tile Definition File.