[HTML]
[TITLE]File Format[/TITLE]
[BODY bgcolor="#ffffff"]
[FONT FACE="Arial,Geneva,Helvetica" SIZE=3]

[CENTER][A HREF="philosophic.html"]Noble Ape Philosophic[/A] - [A HREF="index.html"]Contents[/A] - [A HREF="apescript_intro.html"]Introduction to ApeScript[/A][/CENTER]
[HR]

[H2]File Format[/H2]

The file format for the Noble Ape Simulation is text based and allows users to create their own Noble Ape Simulation environments. The following section explains the syntax of the Noble Ape Simulation's file format.
[P]
[B]Comments[/B]
[P]
Comments allow users (or the Simulation) to add human read-able comments to the files which won't be read by the Simulation.
[BR]
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;/*&nbsp;This is a comment&nbsp;*/
[P]
&nbsp;&nbsp;&nbsp;/*[BR]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This is also a comment[BR]
&nbsp;&nbsp;&nbsp;*/
[/TABLE][/CENTER]
[P]
[FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
Comments also allow users to remove sections of the file to test particular functionality or for temporary changes.

[P]
[B]Objects and Variables[/B]
[P]
The Noble Ape file format is based on objects and variables. The central elements are three letters that identify both objects and variables. An object includes a number of variables. The example definition of object 'obj' and variable 'var', is as follows;
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;obj{[BR]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var = 123;[BR]
&nbsp;&nbsp;&nbsp;};
[/TABLE][/CENTER]
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
Multiple values can be given for particular variables too. For example;
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;rav = 123, 222, 111;
[/TABLE][/CENTER]
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
The Noble Ape Simulation supports two kinds of variables. One byte integers with values between 0 and 255 (inclusive), and two byte integers with values between 0 and 65535 (inclusive). Some variables will only accept one byte integers. In the file format variable definitions below, one_byte denotes a one byte value expected two_bytes denotes a two byte value expected.
[P]
$FIL$
[H2]Simulation Header[/H2]

The Simulation Header identifies the Noble Ape Simulation and the Simulation version.
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;sim{[BR]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sig = 20033;[BR]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ver = 687;[BR]
&nbsp;&nbsp;&nbsp;};
[/TABLE][/CENTER]
[FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
[B]Signature[/B]
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;sig = 20033; /* two bytes */
[/TABLE][/CENTER]
[P]
[FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
As the Noble Ape file format is now accepted by two programs and possibly more in the future, the signature value identifies which program created the file and also, potentially, which programs can accept the file. The signature value for the Noble Ape Simulation is 20033.
[P]
[B]Version[/B]
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;ver = 687; /* two bytes */
[/TABLE][/CENTER]
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
This shows the version of the Noble Ape Simulation that saved the file. It is also a good test for compatibility. Currently the Noble Ape Simulation will only open files with version numbers less than or equal to the version of the Noble Ape Simulation.

[H2]Landscape[/H2]

The landscape description contains all the environment related information.
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;lnd{[BR]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tim = 9;[BR]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dat = 0, 0;[BR]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gen = 56049, 59146;[BR]
&nbsp;&nbsp;&nbsp;};
[/TABLE][/CENTER]
[FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
[B]Time[/B]
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;tim = 1205; /* two bytes : number of minutes */
[/TABLE][/CENTER]
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
The time shows the number of minutes since midnight.
[P]
[B]Date[/B]
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;dat = 216, 0; /* two bytes : number of days, number of centuries */
[/TABLE][/CENTER]
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
The date shows the number of days since the Simulation started running (in simulation time) followed by the number of centuries from when the simulation started running.
[P]
[B]Generator[/B]
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;gen = 23461,49283; /* two bytes : two seed numbers */
[/TABLE][/CENTER]
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
The generator numbers are the random seed when the landscape is created. They represent the specific landscape generated.

[H2]Being (aka Ape)[/H2]
The being information represents a single cognitive entity in the Simulation (ie a Noble Ape).
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;bng{[BR]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;loc = 16100, 32;[BR]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fac = 49;[BR]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spd = 0;[BR]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nrg = 3847;[BR]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;idn = 18424;[BR]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dob = 0;[BR]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spk = 0;[BR]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rnd = 26592, 20360;[BR]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;brn = 171, 0, 146, 86, 501, 73;[BR]
&nbsp;&nbsp;&nbsp;};
[/TABLE][/CENTER]
[FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
[B]Location[/B]
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;loc = 2342, 3324; /* two bytes : x-location, y-location */
[/TABLE][/CENTER]
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
The location variables give the x and y axis co-ordinates of the being. The movement resolution is shown relative to the Simulation area in the following table.
[P]

[CENTER][TABLE]
[TD][FONT FACE="Arial,Geneva,Helvetica" SIZE=3][B]Edge Width[/B]

[BR]Environment Size[BR]Simulation Resolution[BR]Ape Movement Resolution
[TD][CENTER][FONT FACE="Arial,Geneva,Helvetica" SIZE=3][B]Metric[/B]
[BR]12.8 km[BR]50 metres[BR]78 1/8 cm
[TD][CENTER][FONT FACE="Arial,Geneva,Helvetica" SIZE=3][B]Imperial[/B]
[BR]8 miles[BR]54 2/3 yards[BR]30 2/3 inches
[TD][CENTER][FONT FACE="Arial,Geneva,Helvetica" SIZE=3][B]Divisions[/B]
[P]256[BR]16384

[/TABLE][/CENTER]
[P]
[B]Facing[/B]
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;fac = 24; /* one byte */
[/TABLE][/CENTER]
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
The facing information describes the direction the ape is facing (0-63). The numbers rotate clockwise with 48 is north facing and 0 is east facing. 
[P]
[B]Speed[/B]
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;spd = 10; /* one byte */
[/TABLE][/CENTER]
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
This number represents a unit speed per minute. There is no nice conversion for this number. The speed result is linear. Two relative extremes are shown here.
[P]
[FONT FACE="Courier, Courier New" SIZE=4]
spd = 1;[BR][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
&nbsp;&nbsp;&nbsp;936 seconds (roughly 15 minutes) to travel 10 meters[BR]
&nbsp;&nbsp;&nbsp;0.64 meters per minute
[P]
[FONT FACE="Courier, Courier New" SIZE=4]
spd = 20;[BR][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
&nbsp;&nbsp;&nbsp;46.8 seconds to travel 10 meters[BR]
&nbsp;&nbsp;&nbsp;12.8 meters per minute
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
[B]Energy[/B]
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;nrg = 2543; /* two bytes */
[/TABLE][/CENTER]
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
This is the being's current total energy. This amount should never fall below about 1000, and typically won't go above about 3840. The ape eats roughly three times per day. They can consume upwards of 2560 energy units in a single sitting.
[P]

[B]Identification Number[/B]
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;idn = 39858; /* two bytes */
[/TABLE][/CENTER]
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
The being's identification number can roughly be equated to ape genetics. If the number is even, the being is male.
[P]

[B]Date Of Birth[/B]
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;dob = 0; /* two bytes : year */
[/TABLE][/CENTER]
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
The being's date of birth relating to the Simulation's date value. Technically all beings starting the Simulation at initially will have a 'Date of Birth' of 0. This isn't ideal. But together with the state value(see below) this is new in-development technology with the Simulation.
[P]

[B]Speaking[/B]
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;spk = 0; /* two bytes */
[/TABLE][/CENTER]
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
The Noble Apes have a simple method of communication. You can write your own Noble Ape language through [A HREF="apescript_intro.html"]ApeScript[/A], through the simple speak/listen protocol. 0 = saying nothing, any other number indicates some form of communication.
[P]
[B]Random Seed[/B]
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;rnd = 3452, 16786; /* two bytes : two seed numbers */
[/TABLE][/CENTER]
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
This is the random seed at the time the file is saved. The two numbers change pseudo-randomly through the Simulation per being.
[P]

[B]Brain Values[/B]
[CENTER]
[TABLE WIDTH=90%]
[TD ALIGN=LEFT VALIGN=TOP BGCOLOR="#eeeeee"]
[FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;brn = 171, 0, 146, 86, 501, 73; /* two bytes */
[/TABLE][/CENTER]
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
The brain values are used by the cognitive simulation. The basic brain formula is;
[P][FONT FACE="Courier, Courier New" SIZE=4]
&nbsp;&nbsp;&nbsp;b(t+1) = a*l + b(t)*m + (b(t)-b(t-1))*n;
[P][FONT FACE="Arial,Geneva,Helvetica" SIZE=3]
The first three brain variables are l, m, n for awake, then l, m, n for asleep.

[H2]Partial Files[/H2]

The file format supports partial files. If the user wants to change just the landscape characteristics or the time etc, they can create files that only change those variables.
[HR]
[CENTER][A HREF="philosophic.html"]Noble Ape Philosophic[/A] - [A HREF="index.html"]Contents[/A] - [A HREF="apescript_intro.html"]Introduction to ApeScript[/A][/CENTER]
[/BODY]
[/HTML]


