Difference between revisions of "Pikmin area generator file/File format"

From Pikmin Technical Knowledge Base
Jump to navigation Jump to search
m (13 revisions imported)
 
(11 intermediate revisions by one other user not shown)
Line 1: Line 1:
This page describes the format of the generator files in Pikmin 1.
+
This page describes the format of the object generator files in ''[[Pikmin]]''. These files have the file ending <code>.gen</code>. Generators handle the spawning of objects, such as pellets or enemies, in the levels. Each such object is spawned by a generator.
  
 +
==Header==
 
{| class="wikitable"
 
{| class="wikitable"
|+Generator File Header
+
|+File header
 
|-
 
|-
|Offset
+
!Offset
|Type
+
!Type
|Description  
+
!Description  
 
|-
 
|-
 
|0x0
 
|0x0
Line 14: Line 15:
 
|0x4
 
|0x4
 
|float
 
|float
|Unknown
+
|{{unknown|unknown}}
 
|-
 
|-
 
|0x8
 
|0x8
 
|float
 
|float
|Unknown
+
|{{unknown|unknown}}
 
|-
 
|-
 
|0xC
 
|0xC
 
|float
 
|float
|Unknown
+
|{{unknown|unknown}}
 
|-
 
|-
 
|0x10
 
|0x10
 
|float
 
|float
|Unknown
+
|{{unknown|unknown}}
 
|-
 
|-
 
|0x14
 
|0x14
 
|uint32
 
|uint32
|an unsigned integer specifying the amount of generators in the file}
+
|an unsigned integer specifying the amount of generators in the file
 +
|}
 +
 
 +
==Generator==
 +
Directly after the integer specifying the amount of generators follow the generators themselves. The format of each generator is explained in the following table.
 +
 
 +
{| class="wikitable"
 +
|+Generator format
 +
|-
 +
!Offset
 +
!Type
 +
!Description
 +
|-
 +
|0x0
 +
|char[4]
 +
|Four spaces, presumably the name of the generator base that is used in all object types
 +
|-
 +
|0x4
 +
|char[4]
 +
|version string, usually v0.0
 +
|-
 +
|0x8
 +
|uint32
 +
|{{unknown|unknown}}
 +
|-
 +
|0xC
 +
|uint32
 +
|{{unknown|unknown}}
 +
|-
 +
|0x10
 +
|uint8[32]
 +
|32 bytes of data. {{unknown|unknown}}
 +
|-
 +
|0x30
 +
|float[3]
 +
|XYZ position of object
 +
|-
 +
|0x3C
 +
|float[3]
 +
|{{unknown|unknown}}
 +
|-
 +
|0x48
 +
|char[4]
 +
|4 byte string specifying the type of the object. Type name is reversed
 +
|-
 +
|0x4C
 +
|char[4]/uint32
 +
|object version string. For Teki, this is a little endian integer with unknown purposes. For bosses it can be a version string or a little endian integer.
 +
|-
 +
|0x50
 +
|uint8[...]
 +
|Variable amount of data depending on type of object
 +
|}
 +
 
 +
There is one exception to the format. If the object type is full of zero bytes then the object has no object-specific data and no version string and the data skips right to area and spawn type data.
 +
 
 +
{| class="wikitable"
 +
|+Object types
 +
|-
 +
!Object name
 +
!Description
 +
|-
 +
|piki
 +
|Pikmin
 +
|-
 +
|debg
 +
|Debug object {{unknown|unknown}}
 +
|-
 +
|item
 +
|Item
 +
|-
 +
|pelt
 +
|Pellet
 +
|-
 +
|work
 +
|Work object {{unknown|unknown}}
 +
|-
 +
|plnt
 +
|Plant
 +
|-
 +
|mpar
 +
|Map Parts
 +
|-
 +
|teki
 +
|Enemies
 +
|-
 +
|boss
 +
|Boss
 +
|-
 +
|mobj
 +
|Map object
 +
|-
 +
|navi
 +
|{{unknown|unknown}}
 +
|-
 +
|actr
 +
|Actor {{unknown|unknown}}
 +
|}
 +
 
 +
 
 +
 
 +
===Object data===
 +
 
 +
 
 +
 
 +
Data formats for each object type. Offsets are relative to the end of the general generator data, see above for the generator format.
 +
{| class="wikitable"
 +
|+"item" format
 +
|-
 +
!Offset
 +
!Type
 +
!Description
 +
|-
 +
|0x00
 +
|uint32
 +
|String length (in the following offsets the string length will be "n")
 +
|-
 +
|0x04
 +
|string
 +
|Name of object
 +
|-
 +
|0x04+n
 +
|uint8[32]
 +
|32 bytes of data
 +
|-
 +
|0x24+n
 +
|uint8[32]
 +
|32 bytes of data
 +
|}
 +
 
 +
piki, debg, navi: No object-specific data
 +
 
 +
actr, mobj, plnt, pelt: a 4 byte value
 +
 
 +
work: <br>
 +
4 bytes string1 length<br>
 +
string1<br>
 +
4 bytes string2 length<br>
 +
string2<br>
 +
 
 +
if string1 is "move stone", three float values follow.
 +
 
 +
 
 +
mpar:<br>
 +
uint32<br>
 +
uint32<br>
 +
uint32 more data<br>
 +
if the "more data" integer is 1, 6 32 bit floats follow.
 +
 
 +
 
 +
teki:<br>
 +
the object version from the general generator format is interpreted as a integer value
 +
 
 +
if value < 7 then format is like this:<br>
 +
uint32, uint32, uint32, Multi Parameters<br>
 +
if value == 8 then format is like this:<br>
 +
uint32, uint32, uint32, 4 bytes string, three more uint32, four more floats<br>
 +
if value == 9 then format is like this:<br>
 +
byte, byte, byte, 4 bytes string, three more uint32, four more floats<br>
 +
if value >= 10 then format is like this:<br>
 +
byte, byte, byte, 4 bytes string, Multi Parameters<br>
 +
 
 +
Multi Parameters is two times 20 bytes of data, so 40 bytes in total
 +
 
 +
boss:<br>
 +
object version is interpreted as a integer value. If object version is exactly v0.0 or the integer value is >= 2 then boss has a uint32 for data.<br>
 +
Otherwise, boss format is one uint32 and a 4 bytes string.
 +
 
 +
 
 +
Parameters: Objects have a list of parameters starting after the object specific data (Exception is the object with a null type which has no object parameters). Each parameter name is three characters (e.g. p00, p01, ...) followed by one byte that seems to have the size of the parameter value, always 4. After each parameter name comes a 4 byte integer which is the value of the parameter. The end of the parameter list is signaled by the value 0xFFFFFFFF (-1 as a signed 32 bit integer).
 +
 
 +
===Area data===
 +
Area info: After the object parameters comes the area data. There's two types of area: "pint" (Point Area) and "circ" (Circle Area). The area type is followed by a 4 byte string stating a version, always v0.0. After the version come three floats (Maybe XYZ offset? {{unsure|unsure}}). Areas can have parameters, see above for the parameter format. Point areas are more likely to have no parameters (their parameter list ends instantly with -1 as a signed integer), circle areas are more likely to have one parameter (Maybe radius? {{unsure|unsure}}).
 +
 
 +
===Spawn type data===
 +
Spawn type info: After the area info comes type info which can be one of "1one", "aton" or "irnd", with 1one being type One, aton being type At Once and irnd being type Init Rand (probably random {{unsure|unsure}}). The 4 byte string is followed by a version, always v0.0. The type info has no specific data but it does have parameters, see above for the parameter format.

Latest revision as of 05:19, 5 April 2018

This page describes the format of the object generator files in Pikmin. These files have the file ending .gen. Generators handle the spawning of objects, such as pellets or enemies, in the levels. Each such object is spawned by a generator.

Header[edit]

File header
Offset Type Description
0x0 char[4] a 4 byte string saying v1.0, presumably the version of the format or the version of the file
0x4 float unknown[unsure]
0x8 float unknown[unsure]
0xC float unknown[unsure]
0x10 float unknown[unsure]
0x14 uint32 an unsigned integer specifying the amount of generators in the file

Generator[edit]

Directly after the integer specifying the amount of generators follow the generators themselves. The format of each generator is explained in the following table.

Generator format
Offset Type Description
0x0 char[4] Four spaces, presumably the name of the generator base that is used in all object types
0x4 char[4] version string, usually v0.0
0x8 uint32 unknown[unsure]
0xC uint32 unknown[unsure]
0x10 uint8[32] 32 bytes of data. unknown[unsure]
0x30 float[3] XYZ position of object
0x3C float[3] unknown[unsure]
0x48 char[4] 4 byte string specifying the type of the object. Type name is reversed
0x4C char[4]/uint32 object version string. For Teki, this is a little endian integer with unknown purposes. For bosses it can be a version string or a little endian integer.
0x50 uint8[...] Variable amount of data depending on type of object

There is one exception to the format. If the object type is full of zero bytes then the object has no object-specific data and no version string and the data skips right to area and spawn type data.

Object types
Object name Description
piki Pikmin
debg Debug object unknown[unsure]
item Item
pelt Pellet
work Work object unknown[unsure]
plnt Plant
mpar Map Parts
teki Enemies
boss Boss
mobj Map object
navi unknown[unsure]
actr Actor unknown[unsure]


Object data[edit]

Data formats for each object type. Offsets are relative to the end of the general generator data, see above for the generator format.

"item" format
Offset Type Description
0x00 uint32 String length (in the following offsets the string length will be "n")
0x04 string Name of object
0x04+n uint8[32] 32 bytes of data
0x24+n uint8[32] 32 bytes of data

piki, debg, navi: No object-specific data

actr, mobj, plnt, pelt: a 4 byte value

work:
4 bytes string1 length
string1
4 bytes string2 length
string2

if string1 is "move stone", three float values follow.


mpar:
uint32
uint32
uint32 more data
if the "more data" integer is 1, 6 32 bit floats follow.


teki:
the object version from the general generator format is interpreted as a integer value

if value < 7 then format is like this:
uint32, uint32, uint32, Multi Parameters
if value == 8 then format is like this:
uint32, uint32, uint32, 4 bytes string, three more uint32, four more floats
if value == 9 then format is like this:
byte, byte, byte, 4 bytes string, three more uint32, four more floats
if value >= 10 then format is like this:
byte, byte, byte, 4 bytes string, Multi Parameters

Multi Parameters is two times 20 bytes of data, so 40 bytes in total

boss:
object version is interpreted as a integer value. If object version is exactly v0.0 or the integer value is >= 2 then boss has a uint32 for data.
Otherwise, boss format is one uint32 and a 4 bytes string.


Parameters: Objects have a list of parameters starting after the object specific data (Exception is the object with a null type which has no object parameters). Each parameter name is three characters (e.g. p00, p01, ...) followed by one byte that seems to have the size of the parameter value, always 4. After each parameter name comes a 4 byte integer which is the value of the parameter. The end of the parameter list is signaled by the value 0xFFFFFFFF (-1 as a signed 32 bit integer).

Area data[edit]

Area info: After the object parameters comes the area data. There's two types of area: "pint" (Point Area) and "circ" (Circle Area). The area type is followed by a 4 byte string stating a version, always v0.0. After the version come three floats (Maybe XYZ offset? unsure[unsure]). Areas can have parameters, see above for the parameter format. Point areas are more likely to have no parameters (their parameter list ends instantly with -1 as a signed integer), circle areas are more likely to have one parameter (Maybe radius? unsure[unsure]).

Spawn type data[edit]

Spawn type info: After the area info comes type info which can be one of "1one", "aton" or "irnd", with 1one being type One, aton being type At Once and irnd being type Init Rand (probably random unsure[unsure]). The 4 byte string is followed by a version, always v0.0. The type info has no specific data but it does have parameters, see above for the parameter format.