17 Mod_Layout
Freagarach edited this page 2021-01-10 10:48:50 +01:00

0 A.D. Mod Layout

Most of the time, when we talk about file "paths" in 0 A.D., we mean relative to the mods directory. Examples: art/animation, simulation/components. These directories may match more than one real directory on the user's computer (if they're using multiple mods). This means of abstraction is called the VFS (Virtual File System).

The exact directory structure can vary from one mod to another, but the standard is based on the [public]source:/ps/trunk/binaries/data/mods/public/ and [base]source:/ps/trunk/binaries/data/mods/mod/ mods included with the game. This is an overview of that layout. Note: VFS paths are case sensitive.

art

Contains most "visual" data for the game. See the Art Design Document for specific guidelines.

actors

Actors are XML data files that define a visible thing in the game, it could be a warrior, a building, a wild animal, or a clump of grass. We call them actors (short for visual actors). It also defines possible variations of a single appearance, for instance different helmets or shields for a soldier. The Actor Editor tool is the easiest way to add or modify actors.

animation

Animations are typically stored as COLLADA files, exported from a 3D modeling program. They defined what parts of a 3D model move during a game and how they move.

materials

Materials are simple XML data files that describe how textures are rendered. See MaterialSystem for more information.

meshes

A "mesh" is the term used for a 3D model, essentially the collection of vertices and faces that define its shape and how a 2D texture is mapped onto that shape. They are also typically stored in COLLADA format. Meshes are either static or dynamic (aka animated, skeletal, skinned, rigged, boned).

particles

Particles are dynamically created things which typically appear in clumps or bursts and may change appearance and move. They are purely a graphical effect. Examples: smoke, fire, leaves falling.

skeletons

Skeleton XML definitions to share models and animations from different 3D editing software. If you add a new animated model, the odds are you'll need to add a new skeleton. If you modify the bone hierarchy of an existing model, you will need to updating the appropriate skeleton definition.

terrains

Terrain group and texture definitions (see TerrainFileFormat).

textures

The 2D images that give color and transparency to the underlying shapes are called "textures". Typically stored as either PNG (preferred) or DDS files. Includes model textures, terrains, backgrounds, portraits, icons, cursors and buttons. See TextureFormat for technical details about textures in the game.

audio

Sounds heard in the game, whether UI alerts or music. Stored as lossy OGG Vorbis format (often lossless source files exist but they would make the game data impractically large).

fonts

Fonts appearing in the game's GUI, created by the fontbuilder tool.

globalscripts

Scripts that are shared by all script contexts (e.g. GUI, AI, simulation).

gui

The GUI comprises all the 2D menus and controls with which the user interacts. The GUIs are composed of XML data files that describe the static layout of the page and JavaScript scripts which handle input events for the GUI. The pages are more or less each separate with a few common files. See GUI-Scripting_Reference for more info.

hwdetect

A script for tweaking the game's default setup on different systems based on OS, graphics card, drivers, etc.

l10n

Internationalization and Localization files for the mod.

maps

Maps define the layout of the world as the players see it.

random

Random maps are written in JavaScript. See the Random Map Generator page for details.

scenarios

Scenarios each have predefined units, buildings, and terrains which attempt to fit a certain theme, often historical in nature. Scenarios are created with the Atlas scenario editor.

scripts

Scripts related to Triggers.

skirmishes

Skirmishes are similar to scenarios, except the players' civilizations and teams can be chosen during game setup. Skirmishes are also created in Atlas.

shaders

Shaders are special programs which get compiled and run on a supported graphics card in order to change the rendered scene. Examples: shadows, particles, water, specularity. See MaterialSystem for more information.

simulation

Most of the gameplay logic for 0 A.D. resides in this directory. It's called simulation because in fact it simulates the behavior of the game over time, deterministically and in response to player behavior.

ai

The AIs (computer players) which can be used in the game, written in JavaScript, and the APIs they share.

components

The game is based on the concept of "component objects" which comprise the simulation. Many are written in JavaScript but some are part of the engine for various reasons (e.g. performance). The preference is to use scripts unless a very compelling need exists.

data

XML and JSON files for shared data between multiple components, UI, and/or Atlas scenario editor. Cheats, aura and technology templates are located here.

cheats

Cheat templates.

civs

Data files defining the civilizations available in the game, in JSON format.

settings

Data file specifying possible values for population capacity, game speeds, starting resources, etc.

resources

JSON data files specifying resources that can be gathered, traded and so forth (food, wood, ...).
The unit- and structure templates may only contain resources that are specified here.
In order to add a resource, a new icon must be specified in gui/common/resources/.
As of Alpha 21, the subtypes are only used to distinguish gatherrates. There must be at least one subtype per resource.
The order attribute specifies in which order the resources will be shown in the GUI.
The truePrice determines whether how much the resource is worth in comparison to the other resources (see also the explanation in Barter.js).

The aiAnalysisInfluenceGroup determines whether and how the AI considers the resource for civic center and dropsite positioning:

  • ignore: The resource is not considered at all.
  • abundant: The resource is abundant but usually with a small amount each (like wood).
  • sparse: For resources which are sparse but with large amount each (as stone and metal).
victory_conditions

JSON files for different victory conditions.

technologies

Technology templates.

auras

Aura templates.

helpers

Some helper scripts for the components.

templates

Templates, or entity templates, are XML data files which define "entities", things the user can interact with in the game. Most entities have a game play significance, like a soldier, female, tree, or temple. The elements used in templates reflect the component schemas. Entities typically refer to a visual [#actors actor] as well, but not always. Templates have inheritance, so one entity can inherit e.g. the attack and armor stats of another but change its name and civilization. Currently entity templates have to be modified by hand.

campaigns

Experimental campaign entities (currently unused).

formations

Formation templates.

gaia

Gaia is the world, and gaia entities are not owned by any civilization. Gaia objects are natural resources available to all players.

other/special

Defines special entities not creatable in-game.

rubble

Generic rubble entities are defined here.

skirmish

Skirmish entities are defined here, which relate generic skirmish templates to civ-specific templates.

structures

Structures aka buildings.

units

Units are moving entities which the player can control.