Difference between revisions of "Pikmin 2 waterboxes"

From Pikmin Technical Knowledge Base
Jump to navigation Jump to search
 
(13 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Waterboxes are txt files that control where water is placed in a map. They are located in '''user/kando/map/<map name here>/texts.szs/waterbox.txt''. Each box of water contains 6 values that control where the box is placed, although we do not know what each value does, when they are changed the water can be moved. [[File:Pikmin_water_hack.png|300px|thumb|left|A bit of water hacked in Awakening Wood]]
+
[[File:Pikmin_water_hack.png|300px|thumb|right|Water modified in the ''Awakening Wood'']]
The syntax starts with the line "0 # type" not sure what it means, maybe there are other types of water? The next line is also quite ambiguous, "# CNode" the chances are this was some initialiser in the code or something like that. After that is an opening curly brace a new line and a single number, the amount of lines of lines with 6 values. After that are lines of six values, probably doubles, that control where and what shape the box is. It will always be a box. At the end of the line is a fraction, the number in the order of the line, counting up from 0: E.g if it were the fourth line and there 6 in total, it would be 3/6. The very last number would end in 5/6. After that, all there is is a closing bracket for the block of data
+
<code>waterbox.txt</code> hold x, y and z coordinates that tell the game where to draw a waterbox in 3D space. These files are typically located in <code>texts.szs</code> archives such as <code>user/kando/map/*/texts.szs/waterbox.txt</code>. Each body of water is defined to be in the shape of a [[wikipedia:Cuboid|cuboid]].
  
 +
==Format==
 +
===Header===
 +
Each file start with a version number on line 1, commented with <code>#type</code>, {{unsure|it is unknown how this may affect the parsing of the file or effect on the waterboxes themselves.}}.
  
 +
On line 2, it has a comment of <code>#CNode</code> as a label of the array that starts on line 3.
  
 +
Line 3 starts the array with a single bracket, where the first piece of data (line 4) holds the total number of waterbox coordinates it contains.
  
 +
===Waterbox===
 +
{{note|Be wary that the positional values used for waterboxes will be based around the centerpoint of the model it's found under. Waterboxes used in cave units should ideally be measured within the model particularly in cave units that can spawn plentifully (eg. hallways, corner turns, intersections) as large waterboxes can clip into cave units that don't have waterboxes defined. If you plan on using a waterbox that covers an entire generated cave, use a single room as a candidate to hold a single large waterbox that extends throughout the cave. As reference caves units shouldn't typically generate past 3,000 units in the x and y directions.}}
 +
The array defines the waterbox as two sets of coordinate points with x, y and z positional values stored as floats. The game will draw a waterbox that fills the area between the two points defined. The format of the data that stores these values is <code><X1> <Y1> <Z1> <X2> <Y2> <Z2></code>.
  
 +
In the vanilla files each waterbox coordinates are commented with an identification number (starts at 0), and the total number of boxes (e.g. <code># 2/4</code>). Comments aren't necessary and are never parsed. They are simply just labels to help track and organize data.
  
 +
==Example==
 +
This is the file used for the Wistful Wild's water boxes.
  
 +
{| class="wikitable"
 +
! File line|| Data || Line explanation
 +
|-
 +
| 1 ||<pre>0 # type</pre> || Version type of waterbox file. {{unsure|Meaning is unknown.}}
 +
|-
 +
| 2 ||<pre># CNode</pre> || Comment, presumably the label of the array
 +
|-
 +
| 3 ||<pre>{</pre> || Start of array
 +
|-
 +
| 4 ||<pre> 2 </pre> || First value of the array will always hold the total number of waterboxes.
 +
|-
 +
| 5 ||<pre> -3700.000000 -110.000000 850.000000 -2500.000000 -10.000000 1650.000000 # 0/2</pre> || The set of x, y, and z positional values of the first waterbox. The first set is for the bottom left back of the cuboid, and the second is for the top right front.
 +
|-
 +
| 6 ||<pre> -2000.000000 -90.000000 50.000000 -1000.000000 10.000000 1450.000000 # 1/2</pre> || Ditto for second waterbox.
 +
|-
 +
| 7 ||<pre>}</pre> || End of array.
 +
|}
  
{{todo|Understand each individual value and the first two lines}}
+
Notes: While the water will still appear and be animated, if the Y1-Y2 distance (or depth) isn't large enough then it will not behave like water. One would assume the depth must be 100 units, based on the two given examples.
 +
 
 +
[[Category:Pikmin 2]]
 +
[[Category:File formats]]

Latest revision as of 19:05, 11 April 2021

Water modified in the Awakening Wood

waterbox.txt hold x, y and z coordinates that tell the game where to draw a waterbox in 3D space. These files are typically located in texts.szs archives such as user/kando/map/*/texts.szs/waterbox.txt. Each body of water is defined to be in the shape of a cuboid.

Format[edit]

Header[edit]

Each file start with a version number on line 1, commented with #type, it is unknown how this may affect the parsing of the file or effect on the waterboxes themselves.[unsure].

On line 2, it has a comment of #CNode as a label of the array that starts on line 3.

Line 3 starts the array with a single bracket, where the first piece of data (line 4) holds the total number of waterbox coordinates it contains.

Waterbox[edit]

Editor's note: Be wary that the positional values used for waterboxes will be based around the centerpoint of the model it's found under. Waterboxes used in cave units should ideally be measured within the model particularly in cave units that can spawn plentifully (eg. hallways, corner turns, intersections) as large waterboxes can clip into cave units that don't have waterboxes defined. If you plan on using a waterbox that covers an entire generated cave, use a single room as a candidate to hold a single large waterbox that extends throughout the cave. As reference caves units shouldn't typically generate past 3,000 units in the x and y directions.

The array defines the waterbox as two sets of coordinate points with x, y and z positional values stored as floats. The game will draw a waterbox that fills the area between the two points defined. The format of the data that stores these values is <X1> <Y1> <Z1> <X2> <Y2> <Z2>.

In the vanilla files each waterbox coordinates are commented with an identification number (starts at 0), and the total number of boxes (e.g. # 2/4). Comments aren't necessary and are never parsed. They are simply just labels to help track and organize data.

Example[edit]

This is the file used for the Wistful Wild's water boxes.

File line Data Line explanation
1
0 	# type
Version type of waterbox file. Meaning is unknown.[unsure]
2
# CNode
Comment, presumably the label of the array
3
{
Start of array
4
	2 
First value of the array will always hold the total number of waterboxes.
5
	-3700.000000 -110.000000 850.000000 -2500.000000 -10.000000 1650.000000 # 0/2
The set of x, y, and z positional values of the first waterbox. The first set is for the bottom left back of the cuboid, and the second is for the top right front.
6
	-2000.000000 -90.000000 50.000000 -1000.000000 10.000000 1450.000000 # 1/2
Ditto for second waterbox.
7
}
End of array.

Notes: While the water will still appear and be animated, if the Y1-Y2 distance (or depth) isn't large enough then it will not behave like water. One would assume the depth must be 100 units, based on the two given examples.