All information about the game universe is generated from data forms, written as xml files. They are usually edited with the Georges Editor but can also be edited by a simple text editor, just like any xml file.(This page is a translation/adaptation of http://dev.ryzom.com/projects/ryzom/wiki/CreatingABasicForm.)). To familiarize yourself with the appearance of this data, it is possible to go to those provided with the Ryzom Core server sources in your tree(in):
code/ryzom/common/data_leveldesign/leveldesign
The .dfn and .typ files are in the DFN subdirectory.
A form contains mandatory formal elements.
Exemple
<?xml version="1.0"?> <FORM Version="0.0" State="modified"> <STRUCT> <ATOM Name="TestVal1" Value="1"/> <ARRAY Name="TestArray"> <ATOM Value="Array Val 1"/> <ATOM Value="Array Val 2"/> </ARRAY> <ARRAY Name="CoolFilesInfo"> <STRUCT> <ATOM Name="ShortName" Value="Tiger Attack"/> <ATOM Name="Ranking" Value="55"/> </STRUCT> <STRUCT> <ATOM Name="ShortName" Value="Crazy Car Jump"/> <ATOM Name="Ranking" Value="40"/> </STRUCT> </ARRAY> <STRUCT Name="PositionData"> <ATOM Name="x" Value="1"/> <ATOM Name="y" Value="1"/> <ATOM Name="z" Value="2"/> </STRUCT> </STRUCT> </FORM>
The first thing to indicate is the file type:
<?xml version="1.0"?>
Then, in order:
In order to create forms, we will rely on a system of parenting and inheritance.
A form requires a minimum definition file (.dfn), the first definition loaded based on the name extension of the form.
Example
If you create a form named example.config_data, Georges Editor will load the config_date.dfn definition(and therefore all the definitions and types it contains) before running this data form.
So let's start by looking at how to define Definitions(.dfn files) and Types(.typ files).
There are two basic types: .typ (type) and .dfn (definition).
Definitions express themselves using Types.
The most basic .dfn and .typ files are categorized in the Ryzom Core sources in:
/code/ryzom/common/data_leveldesign/leveldesign/DFN/basics
Types are the smallest blocks of information that can be saved in a Georges form. Before defining more complex data, it is essential to set up the most basic types. Creating such documents manually makes it easier to understand how they work.
Exemple 1 : int.typ, whole
<?xml version="1.0"?> <TYPE Type="SignedInt" UI="EditSpin" Default="0" Min="-9223372036854775808" Max="9223372036854775807"> </TYPE>
Exemple 2 : boolean.typ, boolean
<?xml version="1.0"?> <TYPE Type="String" UI="NonEditableCombo" Default="false"> <DEFINITION Label="true" Value="true"/> <DEFINITION Label="false" Value="false"/ </TYPE>
As you can see in these two examples, the Georges .typ form contains:
<?xml version="1.0"?>
Then a “TYPE” element, which must be unique, opening with <TYPE> and closing with </TYPE>.
It may contain one or more “DEFINITION” elements:<DEFINITION Label=”“ Value=”“/>
It is also possible to add a “COMMENT” element to give general indications and/or “LOG” to keep track of the changes.
TYPE's may have the following characteristics:
The returned data type can have several possible values:
The IU recognized by Georges(and for which it will be able to process the data) are:
Each DEFINITION element has:
So our basic .typ file should look like this:
<?xml version="1.0"?> <TYPE Type="UnsignedInt/SignedInt/Double/String" UI="Edit/EditSpin/NonEditableCombo/FileBrowser/BigEdit/ColorEdit" [Default=""] [Min=""] [Max=""] [Increment=""]> <DEFINITION Label="" Value=""/> <DEFINITION Label="" Value=""/> <COMMENTS></COMMENTS> <LOG>Mon Jan 01 00:00:00 0000 (god) Light, please !</LOG> </TYPE>
Definitions indicate the STRUCT(structures), ARRAY(arrays) and ATOM(atoms) that can be used in forms and the type of information they provide.
A .dfn file consists of two elements:
Exemple
<?xml version="1.0"?> <DFN> <ELEMENT Name="TestVal1" Type="Type" Filename="int.typ" Default="0"/> <ELEMENT Name="TestVal2" Type="Type" Filename="int.typ" Default="0"/> <ELEMENT Name="WriteVal" Type="Type" Filename="int.typ" Default="0" /> <ELEMENT Name="TestArray" Type="Type" Filename="string.typ" Array="true"/> <ELEMENT Name="CoolFilesInfo" Type="Dfn" Filename="coolfilesinfo.dfn" Array="true"/> <ELEMENT Name="TestByBracket" Type="Type" Filename="boolean.typ" Array="true"/> <ELEMENT Name="PositionData" Type="Dfn" Filename="positiondata.dfn" Array="false" /> </DFN>
Again, the Georges .dfn form contains:
<?xml version="1.0"?>
Then we see <DFN></DFN> which frames <ELEMENTS […] />
ELEMENTS are the most sensitive parts of a definition because they vary greatly depending on the type of data they can contain. They contain:
The type can be:
A line of this kind will therefore give:
<ELEMENT Name="TestVal1" Type="Type" Filename="int.typ" Default="0"/>
A line of this kind will therefore give:
<ELEMENT Name="PositionData" Type="Dfn" Filename="positiondata.dfn" Array="false" />
A line of this kind will therefore give:
<ELEMENT Name="TestArray" Type="Type" Filename="string.typ" Array="true"/>
A line of this kind will therefore give:
<ELEMENT Name="CoolFilesInfo" Type="Dfn" Filename="coolfilesinfo.dfn" Array="true"/>
The file “sample_config.dfn”(as it was set up) will allow the “default.sample_config” file(shown at the beginning of this page) to work because it defines the ATOM, STRUCT and ARRAY that this Form uses.