Cave fixed layout

From Pikmin Technical Knowledge Base
Jump to: navigation, search

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[edit]

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[edit]

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