Skip to content

Latest commit

 

History

History

transformers

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

This directory contains all of the individual steps to "transform" a cavern from a context object to a completed, serialized cavern. Each step builds on the previous, and is meant to perform a single concrete task. These steps are organized into different "phases" as follows:

I. Outlines

Determine the rough position of the playable area of the cavern. The result of this phase is a graph of baseplates (non-overlapping regions of 2D space) connected by paths. This phase is loosely based on AAdonaac's dungeon generation algorithm with some modifications to make a more organic result.

  1. Partition: Starting with a square, slice it repeatedly into smaller rectangles, trimming off some edges at each step. The remaining rectangles become "baseplates" that later steps will build on.
  2. Discriminate: Choose the largest baseplates to become caves.
  3. Triangulate: Draw lines between the centers of the caves to create a mesh of triangles. These lines are now ambiguous paths.
  4. Span: Find the minimum spanning tree of paths and mark these paths as spanning. These will become halls.
  5. Clip: Remove some ambiguous paths that would be boring to include.
  6. Bore: Paths so far have been straight lines connecting caves. Add some detours where these paths intersect thus-far-unused baseplates to include them.
  7. Weave: Choose some of the ambiguous paths to become auxilliary halls.

II. Planning

Create "plans" for the baseplates and paths that will determine how the space will be used, but don't actually place anything in the map yet.

  1. Negotiate: Assign baseplates and paths to new plans. Some paths connecting two adjacent baseplates will become caves. All remaining paths become halls and all remaining baseplates become caves.
  2. Measure: Determine size information for the plans.
  3. Flood: Choose which plans will have water, lava, and erosion.
  4. Anchor: Choose which plan will be the anchor and assign an architect to it.
  5. Mod: The anchor architect has a chance to modify the cavern in any way.
  6. Establish: Perform a breadth-first search of all plans, starting with the anchor. Assign architects and and determine other information based on distance from spawn.
  7. Pearl: Create "pearls" that determine exactly where plans will go. This is the step that ensures the caves and halls will be more "natural" shapes.

III. Masonry

Place tiles and a few other related things in the map. After this phase, tiles may not be modified

  1. Foundation: Determine which tiles are assigned to which plans.
  2. Rough: All plans perform a "rough draft" of their own tile placement. This step only places floor, water, lava, dirt, loose, hard, and solid rock. Tiles may be overwritten multiple times.
  3. Brace: Find walls that would collapse immediately and add dirt so they don't.
  4. Grout: Fill single-tile "holes" that would otherwise look bad, such as single unconnected tiles of water or lava or single-tile undiscovered caverns.
  5. Sand: Downgrade single-tile spots of hard rock to loose rock.
  6. Fine: All plans add resources, buildings, and other tile types like seams, paths, and rubble. Tiles may be overritten, but plans should avoid significant changes like replacing walls with non-walls.
  7. Annex: Find any solid rock that can be collapsed by drilling adjacent walls. Mark these tiles as in-play.

IV. Plastic

Place other things in the map that rely on the tile placement being finalized.

  1. Fence: Determine the final bounds of the map.
  2. Discover: Break the map into contiguous regions of non-wall tiles. Determine which of these are open at start.
  3. Strataform: Plans determine a discrete "target height" for their tiles.
  4. Strataflux: Determine the final height of all tile corners within the map bounds, smoothing out the target height map determined earlier.
  5. Populate: Plans add miners, vehicles, landslides, erosion, and creatures (but not monster spawns).

V. Ephemera

Add everything else that doesn't necessarily have a position within the map.

  1. Aerate: Estimate the total playtime required before the player will have a working Support Station and use this to determine how much oxygen the level should have.
  2. Adjure: Determine the level objectives. This is done late in the transformation so those objectives can match reality. For example, it's possible to generate lost miners and have them discovered at map start, meaning they should not be used as an objective.
  3. Enscribe: Write the level name, briefing, success, and failure messages. This also creates a Lore object which is used to produce additional text strings during scripting.
  4. Preprogram: Perform some steps that need to be completed before writing scripts:
  5. Each plan bids for the right to perform a "cutscene" when a region is discovered. `. The anchor decides if it wants to have a hold over monster spawns
  6. Program: Plans add any scripts they need. This includes monster and slug spawns, along with some level objectives that are triggered by scripts.
  7. Serialize: Convert the cavern to a text string, which is the final contents of the level.dat file.