Editing Cave spawning

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 2: Line 2:
  
 
{{credits|JHawk}}
 
{{credits|JHawk}}
 
== Summary ==
 
The game...
 
# Spawns the minimum amounts of objects requested by each [[Cave generation parameters#Entry|entry]] of the main category.
 
# Spawns random filler objects from the same entries, until it reaches the limit in [[Cave generation parameters#FloorInfo|parameter <code>{f002}</code>]]. The way it picks these entries in particular is complex, but one important note is that different entries have a different chance of being picked, controlled by the [[#Weight distribution|random weight distribution]].
 
# Spawns the minimum amounts required by entries from the decorative category.
 
# Spawns the minimum amounts required by entries from the treasure category
 
# Spawns random filler objects from the same entries (also with weights), until it reaches the limit in parameter <code>{f003}</code>.
 
# Spawns the minimum amounts required by entries from the dead end category (non-falling and Candypop Buds).
 
# Spawns random filler objects from the same entries, until it runs out of possible dead ends.
 
# Spawns the minimum amounts required by entries from the dead end category (all other entries).
 
# Spawns random filler objects from the same entries, until it runs out of possible dead ends.
 
# Spawns random filler objects from the gate category (also with weights), until it reaches the limit in parameter <code>{f004}</code>.
 
  
 
== Process ==
 
== Process ==
Line 97: Line 84:
 
## Spawn one object of that entry on that spawn point.
 
## Spawn one object of that entry on that spawn point.
 
## Mark that spawn point as used.
 
## Mark that spawn point as used.
 +
 +
=== Spawn regular dead end algorithm ===
 +
This algorithm spawns regular "dead end" category objects. This means all objects that are not set to fall from the sky, as well as all Candypop Buds.
 +
 +
# Repeat for every dead end cave unit placed in the sublevel, in order.
 +
## If this dead end's spawn point has been used, skip to the next.
 +
## Run the [[#Dead end entry picking algorithm|dead end picking algorithm]] with the regular "dead end" category entries.
 +
## If there is anything to spawn, then spawn either one or two.
 +
## Mark that spawn point as used for "regular usage".
  
 
=== Spawn regular dead end algorithm ===
 
=== Spawn regular dead end algorithm ===
Line 136: Line 132:
 
# If we haven't spawned all necessary minimum amounts for objects of the set, then:
 
# If we haven't spawned all necessary minimum amounts for objects of the set, then:
 
## Pick an entry whose minimum amounts haven't been met yet. Prioritize the order in the sublevel configuration file.
 
## Pick an entry whose minimum amounts haven't been met yet. Prioritize the order in the sublevel configuration file.
# Otherwise, if weight is a thing, and there are entries in the set with any weight, then:
+
# Otherwise, if there are entries in the set with any weight, then:
 
## Pick an entry in the set using [[#Weighted distribution|weighted randomness]], using the weights of the entries in the set.
 
## Pick an entry in the set using [[#Weighted distribution|weighted randomness]], using the weights of the entries in the set.
 
# Otherwise:
 
# Otherwise:
Line 146: Line 142:
 
# If we haven't spawned all necessary minimum amounts for objects of the set, then:
 
# If we haven't spawned all necessary minimum amounts for objects of the set, then:
 
## Pick an entry whose minimum amounts haven't been met yet. Prioritize the order in the sublevel configuration file.
 
## Pick an entry whose minimum amounts haven't been met yet. Prioritize the order in the sublevel configuration file.
## If the entry is of the "type" 0, and if we can spawn two of these without going over the entry's minimum amount:
+
## If the entry is of the spawn type 0, and if we can spawn two of these without going over the entry's minimum amount:
 
### Pick this one, returning 2 as the amount.
 
### Pick this one, returning 2 as the amount.
 
## Otherwise:
 
## Otherwise:
Line 152: Line 148:
 
# Otherwise, if there are entries in the set with any weight, then:
 
# Otherwise, if there are entries in the set with any weight, then:
 
## Pick an entry in the set using [[#Weighted distribution|weighted randomness]], using the weights of the entries in the set.
 
## Pick an entry in the set using [[#Weighted distribution|weighted randomness]], using the weights of the entries in the set.
## If the entry is of the "type" 0, pick this one, returning 2 as the amount.
+
## If the entry is of the spawn type 0, pick this one, returning 2 as the amount.
 
## Otherwise, pick this one, returning 1 as the amount.
 
## Otherwise, pick this one, returning 1 as the amount.
 
# Otherwise:
 
# Otherwise:
Line 159: Line 155:
  
 
=== Notes ===
 
=== Notes ===
 +
{{todo|Confirm that 0-radius claim.}}
 
* If a spawn coordinate has a radius of 0, all objects to spawn will be placed in the same spot, and will physically push each other apart. Otherwise, the objects will be forced to maintain a fixed minimum distance from one another, even if that distance will push them beyond the spawn coordinate's radius.
 
* If a spawn coordinate has a radius of 0, all objects to spawn will be placed in the same spot, and will physically push each other apart. Otherwise, the objects will be forced to maintain a fixed minimum distance from one another, even if that distance will push them beyond the spawn coordinate's radius.
 
* If an object would spawn out of bounds, it will fail to spawn. This can happen if its spawn point is out of bounds, if it got pushed out of bounds due to the [[#Spawn type 0 algorithm|spawn type 0 algorithm]], etc.
 
* If an object would spawn out of bounds, it will fail to spawn. This can happen if its spawn point is out of bounds, if it got pushed out of bounds due to the [[#Spawn type 0 algorithm|spawn type 0 algorithm]], etc.

Please note that all contributions to Pikmin Technical Knowledge Base are considered to be released under the Creative Commons Attribution-ShareAlike (see Pikmin Technical Knowledge Base:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Template used on this page: