Wartbed:Files/Formats

From Dark Omen Wiki

(Difference between revisions)
Jump to: navigation, search
(Other)
(File Formats: 3D Geometry --> own article)
Line 32: Line 32:
=File Formats=
=File Formats=
-
==Geometry==
+
==3D Geometry ("Models")==
-
.ZIP archive with .model extension. Archive containing the following file types and extensions (can conatin any number of all file types except meshes.desc).
+
3D geometry (a "model") is represented as a set of files contained inside a .ZIP archive with <tt>.model</tt> extension. Archive containing the following file types and extensions (can contain any number of all file types except meshes.desc).
-
<div style="border:1px solid gray; background:rgb(215,225,215);">
+
* 3D Models <tt>'''[[Wartbed:Files/Formats/3D|.model]]'''</tt> format (an archive of the following files)
-
<div style="float:right;text-align:right;padding:0.5em;background:grey;color:rgb(225,225,225);width:25%;">''modelname''.'''model'''<br>(.zip archive)</div>
+
** <tt>[[Wartbed:Files/Formats/3D# Model description|model.desc]]</tt>
-
<div style="padding:1em; "><tt>
+
** <tt>[[Wartbed:Files/Formats/3D#Vertices|.vertices]]</tt>
-
{| style="font-family:courier;color:rgb(0,32,0);background:rgb(215,225,215);align:left;" |
+
** <tt>[[Wartbed:Files/Formats/3D#Indices|.indices]]</tt>
-
|style="padding-right:8em;"|'''model.desc''' ||text || (1)
+
** <tt>.skeleton</tt>
-
|-
+
** <tt>.animation</tt>
-
|''filename''.vertices ||text || (2)
+
-
|-
+
-
|''filename''.indices ||text || (3)
+
-
|-
+
-
|''filename''.bmp/jpg/png ||bitmap
+
-
|-
+
-
|''filename''.skeleton ||???
+
-
|-
+
-
|''filename''.animation ||???
+
-
|-
+
-
|}
+
-
</tt></div></div>
+
-
<br>
+
-
 
+
-
===Model description===
+
-
<div style="margin-left:2em;border:1px solid gray; background:rgb(215,225,215);">
+
-
<div style="float:right;text-align:right;padding:0.5em;background:grey;color:rgb(225,225,225);width:25%;">1: '''meshes.desc'''<br>(WARTBED Script)</div>
+
-
<div style="padding:1em; color:rgb(0,32,0);"><tt>''Mesh_name''<br>
+
-
{<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;vertices : filename.vertices;<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;indices : filename.vertices;<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;offset : [x,y,z];<br>
+
-
}<br><br>
+
-
''Mesh_2_name''<br>
+
-
{<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;...<br>
+
-
}<br></tt></div>
+
-
</div>
+
-
<br>
+
-
 
+
-
===Vertices===
+
-
Space, tab, '[', ']' and ',' are all valid separators and can be exchanged for reabability. Separators should be able to follow each other (cross your fingers).
+
-
 
+
-
The first block is identified by the keyword "'''definition'''" (of rather, any character sequence starting with "def") and details the components are their order in a vertex. Valid tokens are "xy" for a two-float dataype, "xyz" for a three-float , "xyzw" for a four-float; and "argb", "bgra" and "rgba" for four-byte colours.
+
-
 
+
-
Valid field names are "position", "normal", "diffuse", "specular", "emissive" and "texture coordinate". There can be multiple fields of the same type in a vertex, however, it is not yet defined how WARTBED handles this.
+
-
 
+
-
The second block is identified as "'''vertices'''" (or "vtx"). Every vertex is numbered (though item identifiers are actually ignored when parsing). Multiple vertex blocks are appended into one consecutive vertex buffer (regardless of vertex numbering).
+
-
 
+
-
<div style="margin-left:2em;border:1px solid gray; background:rgb(215,225,215);">
+
-
<div style="float:right;text-align:right;padding:0.5em;background:grey;color:rgb(225,225,225);width:25%;">2: ''filename''.'''vertices'''<br>(WARTBED Script)</div>
+
-
<div style="padding:1em; color:rgb(0,32,0);"><tt>definition<br>
+
-
{<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;xyz : position;<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;xyz : normal;<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;argb : diffuse;<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;argb : specular;<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;argb : emissive;<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;xy : texture coordinates;<br>
+
-
}<br>
+
-
<br>
+
-
vertices<br>
+
-
{<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;0 : [1,2,3] [0,1,0] 0xFFFFFFFF, 0xF0F0F0F0, 0x10101010 [0,0];<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;1 : [4,5,6] [1,0,0] 0xFFFFFFFF, 0xF0F0F0F0, 0x10101010 [1,1];<br>
+
-
}<br></tt></div>
+
-
</div>
+
-
<br>
+
-
 
+
-
===Indices===
+
-
As for vertices. space, tab, '[', ']' and ',' are all valid separators and can be exchanged for readability, and separators should be able to follow each other.
+
-
 
+
-
Each ''faces'' block is created in a new index buffer, depending on parsing parameters.
+
-
 
+
-
<div style="margin-left:2em;border:1px solid gray; background:rgb(215,225,215);">
+
-
<div style="float:right;text-align:right;float:right;text-align:right;padding:0.5em;background:grey;color:rgb(225,225,225);width:25%;">3: ''filename''.'''indices'''<br>(WARTBED Script)</div>
+
-
<div style="padding:1em; color:rgb(0,32,0);">
+
-
<tt>textures<br>
+
-
{<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;0 : texture1.png;<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;1 : texture2.jpg;<br>
+
-
}<br>
+
-
<br>
+
-
definition<br>
+
-
{<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;123 : indices;<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;xyz : normal;<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;id : texture;<br>
+
-
}<br>
+
-
<br>
+
-
faces<br>
+
-
{<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;0 : 1,2,3 [0,1,0] 0;<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;1 : 2,3,5 [0,0,1] 1;<br>
+
-
}<br>
+
-
<br>
+
-
faces      //requesting creation in new index buffer<br>
+
-
{<br>
+
-
&nbsp;&nbsp;&nbsp;&nbsp;...<br>
+
-
}</tt></div></div>
+
==Sprites==
==Sprites==

Revision as of 00:38, 15 November 2009

Description of WARTBED file formats.

Contents

Types of File Formats

WARTBED Script

Human-readable text-based mark-up language for data definitions. Script v2 is a flexible language parser that can use arbitrarily defined symbols for scoping and operators, but the WARTBED Script syntax is loosely based on C/C++ syntax. The WARTBED Script can be said to fulfil the same function as XML, but is infinitely more readable and easy to maintain.

NOTE that WARTBED currently uses Script v2, but most examples in this article still are written in the style of v1. In the first version, name and value in pairs where separated by colon, while in v2 C-style assignment operators are used.

Syntax

WARTBED Script

  • represents data as couples of names and values separated by an operator
  • uses curly brackets ("{" and "}") for scopes
  • uses C's assignment operators (=, +=, -=, *= and /=) to separate name and value of data
  • supports white space in names and data without citation marks. If leading or trailing white space is required, to be retained or operators must be included in name or value, citation marks must be used
  • reads EOL as end of the current declaration. Multiple declaration on the same line must be separated with semi-colon.
  • Uses // and /* ... */ for single-line and block comments.

Example

first = Hello, file! second = " Hello, whitespace! " outer block { 1st value = 10 2nd value = 3.1415 inner block { name 1 = "WARTBED"; name 2 = "Script" } }

File Formats

3D Geometry ("Models")

3D geometry (a "model") is represented as a set of files contained inside a .ZIP archive with .model extension. Archive containing the following file types and extensions (can contain any number of all file types except meshes.desc).

Sprites

A spritesheet it a texture where every frame of a sprite is laid out. A sprite may have several spritesheets. Notice that if frames are cropped to minimal rectangles their in-game size will vary. Size frames to reflect their in-game size.

spritename.sprite
sprite.desc text (1)
spritesheet.bmp/jpg/png bitmap (2)

Map

mapname.map
map.desc (1)

placeholder line

placeholder line

Formats related to unit attributes

All units are defined by and share the same attribute set. Each unit's particular values depends on their stereotypes (race, class and status). The principal function of items is to adjust a unit's attributes.

Transcluded from Wartbed:Unit attributes

Suggested WARTBED unit attributes
Attribute Full name Value range Human std Description
Physical attributes
Mov Movement 0+ 1.5 In game units per game time unit (meters/second?)
WSk Weapon Skill 0--100 30 Melee prowess
RSk Ranged Skill 0--100 30 Missile accuracy
Pow Power 0--100 30 Strength and weight
Tgh Toughness 0--100 30
HP Hit Points (wounds) 1+ 1
Ini Initiative 0--100 30
Att Attacks 0+ 1
Sta Stamina 0--100 30 Endurance
Rec Recovery rate 0--100 30 Reduction of fatigue/time unit
Fat Fatigue 0--100 0 Tiredness (not an attribute but a counter)
Psychological attributes
LdrLeadership 0--100 50 Bonus to tests
TacTactics 0--100 50 What manoeuvres can be performed
StdSteadfastness 0--100 50 Resistance to fear, panic, rout etc
FerFerociousness 0--100 50 Berserking etc
StuStupidity 0--100 50 Risk of confusion etc
MorMorale 0--100 50
All attributes range from 0 to 100, where a value of 30 for physical and 50 for psychological attributes is considered human standard, the exceptions are hit points and attacks, where one (1) is considered human standard, fatigue, which usually starts at zero (0), and movement where human standard marching speed is 1.5 m/sec (3 m/sec at double quick and 6 m/sec at charge).


Note: It is not yet fully decided on how this data will be organised. Races, classes, status and items might be kept separate in individual files, kept together, etc. Template (prototype) declarations might be allowed. It is also not certain the exact block/syntax format which will be used: f.i. the script format might be extended to allow for simple inheritance.

Using full or short qualifiers for attributes, a typical block might look like this:

Using .script v1 syntax     Using inheritance syntax
blockname
{
Mov : +1;
Wsk : +2;
Bsk : -1;
Pow : -2;
Tgh : =4;
Hp  : 3;
Ini : 3;
Att : -1;
Sta : +1;
Rec : +1;
Fat : =4;
Ldr : 3;
Tac : 3;
Std : -1;
Fer : +1;
Stu : +1;
Mor : =4;

}

gnome = basic unit
{
Mov += 1;
Wsk += 2;
Bsk -= 1;
Pow -= 2;
Tgh = 4;
Hp = 3;
Ini = 3;
Att -= 1;
Sta += 1;
Rec += 1;
Fat = 4;
Ldr = 3;
Tac = 3;
Std -= 1;
Fer += 1;
Stu += 1;
Mor = 4;

}

This style has been phased out of WARTBED. If an attribute or value is omitted it is assumed to be zero. All values can be prefixed by '=', '+' or '-'. If the sign is omitted it is assumed to be ASSIGN ('='). This is the script syntax currently used throughout WARTBED, even though this inheritance model will not be used. If an attribute or value is omitted it is assumed to be "+0". All values must be assigned as '=', '+=' or '-='.

Items

Description of item (principally weapons and armour) definition format.

Units

Description of unit (races and classes) definitions format.

unit_name
{
    attributes ... ;
    representation : unit.sprite;
}

unit_2_name
{
    attributes ... ;
    representation : unit.models;
}

Army

Description of army definition. Armies are sets of regiments of units of a race, class and with equipment.

regiment_name
{
    default formation : box;
    standard : shield.png;

    unit
    {
        type : human;
        type : leader;
    }

    unit
    {
        type : human;
        type : champion;
    }

    unit
    {
        type : human;
        type : standard bearer;
    }

    unit
    {
        type : human;
        type : musician;
    }

    unit
    {
        type : human;
        amount : 21;
    }
}

Alternatively, hypothetical inheritance syntax:

    unit = human + regular + swordmen
    {
        type : human;
        type : leader;
    }

Modules and Campaigns

Modules are top-level files. Principally considered self-sufficient and contains a complete and specific game (though it may use data of other modules, which voids its self-sufficiency). Must contain at least one campaign or individually playable mission.

The .module format


Campaigns are sequences of cutscenes and missions, the order of which are determined by simple scripting.

The .campaign format

Mission

A mission is composed of a map, engagement parameters (zones and rules), armies and victory conditions.

Cutscene

A cutscene can be interactive or non-interactive. It can follow simple scripting.

Other

background : bitmap name; //background for module main menu 
music: music name; //bgm for module main menu
icon : bitmap name; //"icon" for module in WARTBED main menu
etc...
Personal tools
communication