Difference between revisions of "Cave unit definition file"

From Pikmin Technical Knowledge Base
Jump to navigation Jump to search
 
(24 intermediate revisions by 10 users not shown)
Line 1: Line 1:
In ''Pikmin 2'', each sublevel points to a cave unit list file. These files can be found in <code>/user/Mukki/mapunits/units</code>, and contain a list of units that the game is allowed to use to create the cave with.
+
In ''Pikmin 2'', each sublevel points to a cave unit definition file. These files can be found in <code>/user/Mukki/mapunits/units</code>, and contain a list of units that the game is allowed to use to create the cave with. This file just tells the generator how each cave unit attaches with one another. In other words, this file specifies all the rooms to spawn in a sublevel, depending on that sublevel's room count (<code>{f005}</code>).
  
 
==Header==
 
==Header==
Line 5: Line 5:
  
 
==Unit==
 
==Unit==
The first line in the block is {{unsure|the version of the block's data format}}.
 
  
The second line is the internal name of the unit.
+
{| class="wikitable sortable"
 +
|-
 +
! Line || Example || Description || Comment
 +
|-
 +
| 1 || <code>1</code> || Version || <code>version</code>
 +
|-
 +
| 2 || <code>room_ike1_2_tsuchi</code> || Folder name of the unit to spawn || <code>foldername</code>
 +
|-
 +
| 3 || <code>7 6</code> || Width (7) and length (6) of the unit that's spawning (line 3); defines how many cave grid cells this unit || <code>dX/dZ ; cell size</code>
 +
|-
 +
| 4 || <code>1</code> || Room type: 0=dead end, 1=room, 2=hallway || <code>room type</code>
 +
|-
 +
| 5 || <code>0 1</code> || The unit's "room" flags. Judging by the name, and how most of the "room" type units have it set to 1, it's presumed to help count the room units as... well, rooms and not hallways or dead ends. Changing it to anything other than 1, or 0 for the non-room units, doesn't seem to do anything though. || <code>room Flags</code>
 +
|-
 +
| 6 || <code>2</code> || The number of doors (exits) the unit has || <code>num doors</code>
 +
|}
  
The third line consists of two words, each a number, that define how many cave grid cells this unit takes up. The first word is for the length in X, the second for the length in Z. Basically, this means "this unit is X by Z units big".
+
From this point onwards, before ending the unit entry, there are four lines for each door sub-entry.
 +
{| class="wikitable sortable"
 +
|-
 +
! Line || Example || Description || Comment
 +
|-
 +
| 1 || <code>0</code> || Door index || <code>index</code>
 +
|-
 +
| 2 || <code>0 0 0</code> || Direction, offset (starting from the left, determines how many cells to the right the door is), and wpindex (The index of the route waypoint for that door) || <code>dir/offs/wpindex</code>
 +
|-
 +
| 3 || <code>1</code> || The number of doors this can link to || <code>door links</code>
 +
|}
  
The fourth line determines the type of unit this is. <code>0</code> is a dead end, <code>1</code> is a room, and <code>2</code> is a corridor.
+
From this point onwards, before ending the door sub-entry, there is one line for each door link.
 
+
{| class="wikitable sortable"
The fifth line determines the unit's flags.
+
|-
{{todo|Document the unit's flags.}}
+
! Line || Example || Description || Comment
 
+
|-
The sixth line indicates how many exits this unit has. The lines after this one contain data about each exit.
+
| 1 || <code>1258.716064 0 1</code> || Distance (used within score calculation), Door-id (Maps to another door index), and tekiflag {{unknown}} || <code>dist/door-id/tekiflag</code>
 
+
|}
===== Line 8: <code>dirs/offs/wpindex</code> =====
 
This line contains three words, all numbers.
 
The first number, <code>dirs</code>, is the direction of the room and player. For example, in the Emergence Cave the direction is <code>2</code>, for all other rooms to connect they must also be <code>2</code>. This value is ''currently'' useless because all rooms must be the same value for them to connect to each other. The player will always face the direction (the camera will oppose), which in a single-door room (any room name with "_1" before the room type) is always towards the next room.
 
 
 
[[File:Dir3]] An example of <code>dirs</code> set on <code>3</code> while all other room <code>dirs</code> are set on <code>2</code>.
 
 
 
===Exits===
 
The first line in an exit's data is its index. This starts at 0.
 
 
 
{{todo|Document the remaining lines.}}
 
  
 +
{{Credits|Jimble, Kai}}
 
[[Category:Pikmin 2]]
 
[[Category:Pikmin 2]]
 
[[Category:File formats]]
 
[[Category:File formats]]

Latest revision as of 21:41, 27 April 2023

In Pikmin 2, each sublevel points to a cave unit definition file. These files can be found in /user/Mukki/mapunits/units, and contain a list of units that the game is allowed to use to create the cave with. This file just tells the generator how each cave unit attaches with one another. In other words, this file specifies all the rooms to spawn in a sublevel, depending on that sublevel's room count ({f005}).

Header[edit]

After a decorated set of comments that say units definition file comes a line containing the number of units defined in this file. This line is commented with number of units. Each unit's data is defined inside its own block, and conveniently has a comment before it that mentions its name.

Unit[edit]

Line Example Description Comment
1 1 Version version
2 room_ike1_2_tsuchi Folder name of the unit to spawn foldername
3 7 6 Width (7) and length (6) of the unit that's spawning (line 3); defines how many cave grid cells this unit dX/dZ ; cell size
4 1 Room type: 0=dead end, 1=room, 2=hallway room type
5 0 1 The unit's "room" flags. Judging by the name, and how most of the "room" type units have it set to 1, it's presumed to help count the room units as... well, rooms and not hallways or dead ends. Changing it to anything other than 1, or 0 for the non-room units, doesn't seem to do anything though. room Flags
6 2 The number of doors (exits) the unit has num doors

From this point onwards, before ending the unit entry, there are four lines for each door sub-entry.

Line Example Description Comment
1 0 Door index index
2 0 0 0 Direction, offset (starting from the left, determines how many cells to the right the door is), and wpindex (The index of the route waypoint for that door) dir/offs/wpindex
3 1 The number of doors this can link to door links

From this point onwards, before ending the door sub-entry, there is one line for each door link.

Line Example Description Comment
1 1258.716064 0 1 Distance (used within score calculation), Door-id (Maps to another door index), and tekiflag Unknown[unsure] dist/door-id/tekiflag
Credits: Jimble, Kai