Difference between revisions of "Cave fixed layout"

From Pikmin Technical Knowledge Base
Jump to navigation Jump to search
m (Espyo moved page Fixed Layout File to Cave fixed layout without leaving a redirect: More indicative name.)
(Cleanup.)
Line 1: Line 1:
In 2 player battles, cave are generated using a fixed cave layout file, unlike any other time in the game where it's random. These files contain data for cave units, what the file name is, along with the rooms direction and coordinates. Fixed cave layout files can be found in <code>user/Abe/vs</code>. There is one for every versus stage with the exception of the Dim Labyrinth. This page will explain what everything in the file is used for.
+
In 2-Player Battles, almost all caves are generated using a fixed cave layout file, unlike any other time in the game where it's random. These files contain data for cave units, what the file name is, along with the direction of units and their coordinates. Fixed cave layout files can be found in <code>user/Abe/vs</code>. There is one for every versus stage with the exception of the Dim Labyrinth, which is meant to be random like story mode caves. This page will explain what everything in the file is used for.
  
==File Example==
+
==File example==
 
<pre>
 
<pre>
 
1.000000 # Edit Map Ratio  
 
1.000000 # Edit Map Ratio  
Line 25: Line 25:
 
</pre>
 
</pre>
  
The first value in the file is the edit map ratio, and you probably shouldn't
+
The first value in the file is the edit map ratio, and you probably shouldn't change it from 1. After that is how many layouts there are. This is typically three, but you can make less layouts {{unknown|or possibly even more layouts}}. After this is the actual start of the cave layouts.
change it from 1. After that is how many layouts there are. This is typically three, but you can make less layouts {{unknown|or possibly even more layouts}}. After this is the actual start of the cave layouts.
 
  
At the start of the layout is a line for how many units there are, commented with # unit total ( x ) where x is the layout number. Make sure the value here is equal to the number of unit entries this layout has.
+
At the start of the layout is a line for how many units there are, commented with <code># unit total ( x )</code> where x is the layout number. Make sure the value here is equal to the number of unit entries this layout has.
  
After this is the direction and offset data about the unit. In order, the four things the game reads on each line are the name of the unit's folder, the direction the room faces, the x offset, and the y offset.
+
After this is the direction and offset data about the unit. In order, the four things the game reads on each line are the name of the unit's folder, the direction the unit faces, the x offset, and the y offset.
 +
 
 +
==How to make a fixed layout==
 +
[[File:figure1.png|400px|thumb|right|Starting a spreadsheet with cave units.]]
 +
Making your own fixed layout files can be a pain, since you need to keep proper track of the direction and offset of each unit. When making a layout file, I use Microsoft Excel to make a map of the layout, where each cell is one unit, but some graph paper could work to. Start by making a graph similar to the image on the right, with numbers counting up and right from a 0,0 origin.
  
==How to Make a Fixed Layout File==
 
Making your own fixed layout files can be a pain, since you need to keep proper track of the direction and offset of each unit. When making a layout file, I use Microsoft Excel to make a map of the layout, where each square is one unit, but some graph paper could work to. Start by making a graph similar to figure 1, with numbers counting up and right from a 0,0 origin.
 
 
Before making the fixed layout file, it's important that you add all the needed units to the versus caves unit list file.
 
Before making the fixed layout file, it's important that you add all the needed units to the versus caves unit list file.
  
To make custom layouts, you'll need to know how the grid system works with Pikmin 2 cave units. The size of all cave units is a number of grid units. The easiest way to see the size of a unit is to look at the unit list file you made with the units and look at the unit's "Cell size" value. Then, somewhere in the excel graph, add the unit with a letter or something to reprsent it. For full rooms, I put the edges of the room where the doors are in all caps. To see where the doors in a unit are exactly, this page is very useful: https://www.pikminwiki.com/Cave_unit . Use these images of the units to see where the units doors are. Use caps and ways to ensure there are no gaps or open ends of rooms. It's also essential for there to be at least two rooms with a spawn point or the game will crash. It's also important that there are at least 7 treasure spawn points for the marbles to spawn in. Anyway, once you have everything in place it should look something like figure 2.
+
To make custom layouts, you'll need to know how the grid system works with ''Pikmin 2'' cave units. The size of all cave units is a number of grid units. The easiest way to see the size of a unit is to look at the unit list file you made with the units and look at the unit's "Cell size" value. Then, somewhere in the excel graph, add the unit with a letter or something to represent it. For full units, I put the edges of the unit where the doors are in all caps. To see where the doors in a unit are exactly, use [https://www.pikminwiki.com/Cave_unit this page]. Use caps and ways to ensure there are no gaps or open ends of units. It's also essential for there to be at least two units with a spawn point or the game will crash. It's also important that there are at least 7 treasure spawn points for the marbles to spawn in. Anyway, once you have everything in place it should look something like the image on the left.
  
Now that you have everything graphed out, it's time to make the actual config file. The first, and easiest part, is to enter all of the units you want to be in the cave. Remember you have to put the unit name for everytime you want it, unlike a unit list where its only needed once. Again, don't forget about the number of units at the top of the layout. After this, find the direction of each room. This is probably the hardest part, and what gets me confused the most. All of the pictures of units on that Pikipedia page are facing in the "1" direction. Rotate clockwise 90 degrees to find the direction you want, either 0 1 2 or 3 for each of the four cardinal directions. After youve given every unit a direction, you should use the numbered graph to find the offsets of each unit. No matter what direction a unit faces, the units offset should be the coordinates of its bottom-left most region. The first value in the config file is the height of the unit, and the second is the horizontal value. After doing all this you will have a complete layout file! If you did everything right, it should load in game. There's a high chance that it will crash on your first attempt, so look very closely at all your unit dirs and offsets and make sure they are all correct. Remember the trick to choose which layout you get, it can come in a lot of use. Remember to use that example layout file above for reference on how to make these files.
+
[[File:figure2.png|400px|thumb|left|A finished spreadsheet.]]
 +
Now that you have everything graphed out, it's time to make the actual config file. The first, and easiest part, is to enter all of the units you want to be in the cave. Remember: you have to put the unit name every time you want it, unlike a unit list where it's only needed once. Again, don't forget about the number of units at the top of the layout. After this, find the direction of each unit. This is probably the hardest part, and what gets me confused the most. All of the pictures of units on that Pikipedia page are facing in the "1" direction. Rotate clockwise 90 degrees to find the direction you want, either 0 1 2 or 3 for each of the four cardinal directions. After you've given every unit a direction, you should use the numbered graph to find the offsets of each unit. No matter what direction a unit faces, the units offset should be the coordinates of its bottom-left most region. The first value in the config file is the height of the unit, and the second is the horizontal value. After doing all this you will have a complete layout file! If you did everything right, it should load in-game. There's a high chance that it will crash on your first attempt, so look very closely at all your unit dirs and offsets and make sure they are all correct. Remember that you can use the C-stick when the Onions are flying in the 2-Player Battle menu to choose which layout you get. Remember to use that example layout file above for reference on how to make these files.
  
[[File:figure1.png|400px]] Figure 1
+
<gallery>
[[File:figure2.png|400px]] Figure 2
+
figure3.png|Example of a layout.
[[File:figure3.png|200px]] An example of a layout,
+
figure4.png|And what it looks like in game.
[[File:figure4.png|400px]] And what it looks like in game.
+
</gallery>
  
 
{{Credits|PikHacker}}
 
{{Credits|PikHacker}}
 +
 +
[[Category:Pikmin 2]]
 +
[[Category:File formats]]

Revision as of 18:46, 1 June 2019

In 2-Player Battles, almost all caves are generated using a fixed cave layout file, unlike any other time in the game where it's random. These files contain data for cave units, what the file name is, along with the direction of units and their coordinates. Fixed cave layout files can be found in user/Abe/vs. There is one for every versus stage with the exception of the Dim Labyrinth, which is meant to be random like story mode caves. This page will explain what everything in the file is used for.

File example

1.000000 	# Edit Map Ratio 
3 		# Pattern 
17 		# unit total ( 0 )
room_vs_hitode4x4_6_metal 	1 	12 	8 	# name / dir / offset ( x, y )
room_vs_hitode4x4_6_metal 	3 	3 	17 	# name / dir / offset ( x, y )
room_hitode4x4_3_metal 	0 	12 	12 	# name / dir / offset ( x, y )
room_cent_4_metal 	0 	7 	12 	# name / dir / offset ( x, y )
room_hitode4x4_3_metal 	2 	3 	13 	# name / dir / offset ( x, y )
item_cap_metal 	0 	4 	12 	# name / dir / offset ( x, y )
item_cap_metal 	2 	14 	16 	# name / dir / offset ( x, y )
way2x2_metal 	1 	10 	11 	# name / dir / offset ( x, y )
way2x2_metal 	1 	7 	19 	# name / dir / offset ( x, y )
wayl_metal 	1 	9 	19 	# name / dir / offset ( x, y )
way2x2_metal 	1 	10 	9 	# name / dir / offset ( x, y )
wayl_metal 	3 	9 	9 	# name / dir / offset ( x, y )
way2x2_metal 	1 	7 	17 	# name / dir / offset ( x, y )
way3_metal 	3 	9 	11 	# name / dir / offset ( x, y )
way3_metal 	1 	9 	17 	# name / dir / offset ( x, y )
way2_metal 	0 	9 	18 	# name / dir / offset ( x, y )
way2_metal 	0 	9 	10 	# name / dir / offset ( x, y )

The first value in the file is the edit map ratio, and you probably shouldn't change it from 1. After that is how many layouts there are. This is typically three, but you can make less layouts or possibly even more layouts[unsure]. After this is the actual start of the cave layouts.

At the start of the layout is a line for how many units there are, commented with # unit total ( x ) where x is the layout number. Make sure the value here is equal to the number of unit entries this layout has.

After this is the direction and offset data about the unit. In order, the four things the game reads on each line are the name of the unit's folder, the direction the unit faces, the x offset, and the y offset.

How to make a fixed layout

Starting a spreadsheet with cave units.

Making your own fixed layout files can be a pain, since you need to keep proper track of the direction and offset of each unit. When making a layout file, I use Microsoft Excel to make a map of the layout, where each cell is one unit, but some graph paper could work to. Start by making a graph similar to the image on the right, with numbers counting up and right from a 0,0 origin.

Before making the fixed layout file, it's important that you add all the needed units to the versus caves unit list file.

To make custom layouts, you'll need to know how the grid system works with Pikmin 2 cave units. The size of all cave units is a number of grid units. The easiest way to see the size of a unit is to look at the unit list file you made with the units and look at the unit's "Cell size" value. Then, somewhere in the excel graph, add the unit with a letter or something to represent it. For full units, I put the edges of the unit where the doors are in all caps. To see where the doors in a unit are exactly, use this page. Use caps and ways to ensure there are no gaps or open ends of units. It's also essential for there to be at least two units with a spawn point or the game will crash. It's also important that there are at least 7 treasure spawn points for the marbles to spawn in. Anyway, once you have everything in place it should look something like the image on the left.

A finished spreadsheet.

Now that you have everything graphed out, it's time to make the actual config file. The first, and easiest part, is to enter all of the units you want to be in the cave. Remember: you have to put the unit name every time you want it, unlike a unit list where it's only needed once. Again, don't forget about the number of units at the top of the layout. After this, find the direction of each unit. This is probably the hardest part, and what gets me confused the most. All of the pictures of units on that Pikipedia page are facing in the "1" direction. Rotate clockwise 90 degrees to find the direction you want, either 0 1 2 or 3 for each of the four cardinal directions. After you've given every unit a direction, you should use the numbered graph to find the offsets of each unit. No matter what direction a unit faces, the units offset should be the coordinates of its bottom-left most region. The first value in the config file is the height of the unit, and the second is the horizontal value. After doing all this you will have a complete layout file! If you did everything right, it should load in-game. There's a high chance that it will crash on your first attempt, so look very closely at all your unit dirs and offsets and make sure they are all correct. Remember that you can use the C-stick when the Onions are flying in the 2-Player Battle menu to choose which layout you get. Remember to use that example layout file above for reference on how to make these files.

Credits: PikHacker