Swarm TileGen Mission Rules
Mission generation rules describe the logic used to put your randomly generated level together. Each mission consists of a number of rules. These rules are processed in order.
A basic mission would have the following rules:
- Global Options - This allows you to set the global theme used for your mission, along with a name and description.
- Random Start Room - This rule will randomly pick a room with the 'Start' tag and place it at the default starting location (the lower middle of the layout grid).
- Generation Step - This rule will keep placing down rooms until the desired size is reached. It is the main way to grow your level.
- Random Escape Room - This will randomly pick a room with the 'Escape' tag and place it at the northmost open exit in the map layout.
- Cap Level - This rule will go around all the remaining open exits and place rooms to seal the level.
Creating a new mission
- Load TileGen and go to the Missions tab.
- Click the "New Mission" button in the upper right corner.
- It will ask you where you want to save the mission. Missions by default are saved in the swarm/tilegen/new_missions folder. Type in a name for your mission. It will be saved as a text file.
- You can now click Add Rule to add a new step to your mission generation process.
- Click the "Change" button on the new rule and select the rule you want. See the list above for the rules required to make a basic mission.
- Once all the required rules are added, click the Save button.
- You can now click "Generate Layout" and it will run through the rules in order, generating your mission.
Many rules have filter options. These can be used to disallow certain room or connection types.
- Specific Room
- This will place the specified room template down at one of the open exits in your layout.
- Place Components
- This rule should be added within the Generation Step rule. You can specify a number of mandatory and optional rooms that should be placed in your layout during the generation step. The Placement field for each room should be a number greater than 0 and less than 1, representing how far through the generation step this room should be placed.
- Border Cap Level
- Attempts to form a seamless edge around a level using room tiles tagged with 'Border'. Several conditions must be met for this to work properly; e.g. exits in the core of the level must be tagged with [Exit Tag to Cap] (default: 'center'), there must be sufficient variety of 'Border' pieces to create a seamless edge, tiles in the center should all be the same size, etc. This rule is useful for outdoor environments, where you can make all of your room templates the same size (e.g. 4x4) and have a set of cliff tiles marked with the 'Border' tag.
There are cases where a random level will fail to generate. This can happen if you do not have the right shape room with the right exits to fill in a gap or satisfy the rules. e.g. trying to place a specific room that only has an entrance at the west side, but your level randomly generated with no exits facing that direction. These problems can usually be solved by increasing your library of rooms and increasing the number of exits in each room.
If the level generation does fail, you can look in the console for errors to help you fix the problem, or you can just try generating the layout again.