Generators
Keys / Locks
Objective planning follows the key/lock pattern. This can mean literally keys and locks like "you need the red key to go through the door with the red lock," but it also could mean "you need to have high jump boots to get up here." Some logic needs to be used to prevent unbeatable worlds. For example, it would be an unbeatable situation to put the high jump boots after the ledge that is too high to get up to without the high jump boots. You'd never be able to get to any part of the world past that point.
Objective Planning
The first thing that happens when generating the world is objective planning. This process builds an objective traversal graph structure that goes from the escape pod through all of the bosses while laying out all of the items. It also ensures items needed to progress are in the available somewhere in the graph before the lock that needs them. This helps to guarantee that worlds are generated that can be fully explored.
Map Parts
The map is a nested structure of rooms made of screens built up of structures.
Rooms
A room is the smallest part of the world that can be loaded into the engine. Internally they are represented as a 2D array of screens.
Some tidbits about rooms:
- The space they contain is always bounded by a rectangle that has a position in the world.
- The space is always represented as a rectangle of screens, even not completely filled in.
- Null screens are allowed in the rectangle to indicate that a screen inside the room is not used.
- The room cannot represent multiple disconnected spaces, just make multiple rooms.
- The screens within the space of a room must touch all edges of the containing rectangle.
- Rooms are the level that represent a self contained space that is loadable by the game engine.
- A room can be as small as a single screen (1x1 array).
- There is no specific design limit on how many screens can be involved in a single room.
- Exits for the room are defined at the room level, but they are positioned based on the screens they contain.
Screens
A screen is exactly what it sounds like, the amount of space that can be represented on a screenful of space. A room can be as small as a single screen that has only one exit.
A screen represents:
- 640x360 pixels. Selected for easy integer scaling to most typical 16:9 screen resolutions.
- 32x18 tiles. Each tile is 20x20 pixels.
- A screen can have up to 4 exits, one per screen edge.
Structures
Structures are parameterized chunks of "stuff" that go in a room. They include platforms, room edges, doors, statues, hazards, generators, and anything else that can be visually placed on a screen. The placement of structures is managed by room generators that need the structure in question.
Map Display
While playing the game, the player can pull up the map at any time. This map system shows the known world in a way that allows a player to look around, figure out routes, and find places where missing items could be. Map information is updated when the player enters each screen the first time, by using map stations to reveal chunks of information all at once, and by opening doors or collecting items.
For the in-game map:
- Each in game tile (20x20 pixels) is represented as a single pixel (1x1) resulting in a 20:1 scaling factor.
- Each screen is part of the map grid and is represented as a rectangle of 32x18 pixels.
- Can be zoomed and panned to search and explore.
- There is no automatic routing system, figuring out where to go is part of the fun of exploration.
- The screen the player is currently in is highlighted on the map.
- In-world things like doors, upgrades, stations, and bosses are drawn over the map.
- Typically these symbols are larger than 1x1 pixel each, so they should be expected to obscure parts of the map.
Generators
There is a procedural generation system that creates the world. It's made up of nested layers that have specific roles in the process.
World Generator
This is the top-level system that orchestrates the layout of the entire map. Essentially it manages the use of room generators, the placement of the rooms, and the interconnection of them.
This System:
- Owns the random number generator that provides the stream of random numbers used during generation. (It's passed down through other layers of generators.)
- Makes decisions based on the world configuration.
- Decides how room generators are used to fill in the map.
- Places upgrades and doors in the world.
- Owns item progression logic.
- Selects and assigns biomes to rooms.
- Is also the creator of multi-room constructs, for example boss rooms with nearby saves.
- Escape path router that is used to calculate the amount of time allowed for the escape.
Room Generators
Room generators are pieces of code that generate individual rooms. They have several parameters that are provided by the world generator that control what is generated.
All Room Generators receive parameters for:
- The size of the room to generate, in screens.
- Details about where doors have to be to in the room to satisfy requirements of the map as a whole.
- Item limiters that are allowed to be used. These are items that could have been collected by the time the player gets to this room and can be used to limit travel through the room that will be generated.
Types
There is a collection of room generators that is used to build the world. There are also Tutorial Generators that create the specific set of rooms used for the tutorial area if needed.
Generators produce rooms that have markers for:
- Enemy spawn points with difficulty flags.
| Generator | Extra Parameters | Description |
|---|---|---|
| Single-Screen | Type
Exit Direction(s) |
This room is always exactly 1x1 screen and has a single exit. It can be any of the various 1 screen types. |
| Travel | Layout
|
This type of room is for travel across some distance. They always have 2 exits, one on each end. Some have something in them that makes them one-way or prevents travel at all until some criteria is met. Tubes suck you in immediately upon entering a door and elevators have a space that the player interacts with to cause the elevator to move. |
| Hub | Layout
|
This room is expected to have a larger number of exits than most areas. These areas facilitate interconnect between multiple places and can have upgrade items, tricky platforming, and hidden sections to make them interesting. |
| Platform Challenge | None | These rooms are specifically designed to challenge the player to get through them with a set of movement capabilities. They may be dead-ends or travel rooms, but essentially always have some sort of reward or progression at the end. |
| Boss | Type
|
Boss rooms are places where large battles take place. Rooms that are generated are done in a way that align with the selected battle. |
Structure Generators
Structures are parameterized chunks of "stuff" that go in a room. They include platforms, room edges, doors, statues, hazards, generators, and anything else that can be visually placed on a screen. The use of these is managed by the room generator that needs the stuff in question.
Types
There is a collection of structure generators that can be used by room generators to make things that go in the rooms during generation.
All structure generators receive parameters:
- Position of the structure relative to the screen layout, in tiles.
- Size of the structure, in tiles.
| Structure | Extra Parameters | Description |
|---|---|---|
| Platform | Type
Junctions |
This structure builds a platform using pipe style parts. It can also utilize either decorative junctions or simple pipe ends. |