Loaders Design Documentation

From FIFE development wiki
Jump to: navigation, search

This article is part of design documentation. Design 32.png

Design documentation describes how software is implemented or is about to be implemented. It focuses on system structure (e.g. dependencies), module interactions and relevant algorithms. Concepts described in these articles should form the terminology that is used when discussing about the software that forms FIFE.

Introduction

The purpose of this article is to discuss the design and implementation of the FIFE loader subsystem. This document is part of the larger set of architecture documentation. The key design goals for the current loader subsystem were flexibility and ease of use.

Overview

The loader subsystem is organized into 2 sets of classes, interfaces and implementations. The interface classes provide flexibility for game creators that need to customize all or part of the asset loading process while the implementation classes provide quick and easy loading of the FIFE built-in asset files. Each section below will take closer look at a loader and give a detailed discussion of how to both use and customize it.

Map Loading

Loading a map is the first step in the loading process in FIFE and it will usually be the only step the game creator has to call directly from their code. There are 2 classes provided by FIFE that deal with map loading, IMapLoader and MapLoader. The IMapLoader is a pure interface class that allows a game creator to override the entire map loading process with their own custom implementation while the MapLoader class implements the IMapLoader interface and provides the built-in loading for the FIFE Map Format. The IMapLoader interface also provides functions for setting the object, animation, and atlas loaders to allow game creators to customize all or some of the steps in the loading process.

Object Loading

An object in FIFE is a reusable entity containing common information for a class of instances. An object file therefore provides the description of these reusable components. The object loading consists of 2 classes: the interface IObjectLoader and implementation ObjectLoader. A game creator can provide their own object loader implementation if they have their own custom object format. Please refer to the FIFE Object Format for details on the built-in object file support.

Animation Loading

An animation file is used to describe the assets and frames of a FIFE animation. Much like the map and object loaders the animation loader is split into the IAnimationLoader interface and AnimationLoader implementation. To customize the animation loading process a game creator simply has to implement the IAnimationLoader interface. Please refer to the FIFE Animation Format for details on the built-in animation file support.

Atlas Loading

An atlas file is used to describe a set of game assets that are grouped together into a single file. The atlas loader then read the description file and translates the atlas into FIFE components for use in the game. Atlas loading follows the common loader design and has an IAtlasLoader interface and AtlasLoader implementation. For custom atlas descriptions game creators can provide their own atlas loader implementation based on the IAtlasLoader interface. Please refer to the FIFE Atlas Format for details on the built-in atlas file support.