Automap class final
The level as the player has seen it, from above.
A brush level already has its map: the navigation grid. Every cell an agent can stand in is a cell of floor, every cell it cannot step into from one it can is a wall, and the grid was baked from the brushes for the monsters before anybody thought of drawing it. What this adds is memory — which of those cells the player has been near — and that is the whole of an automap: floor where they walked, walls where the floor stopped, nothing where they have not been.
Revealing walks, it does not radiate
A circle of six metres around the player would show the room on the other side of the wall, which is the one thing a map must not do before the door is opened. So the reveal is a flood over the grid: from the player's cell outward across cells an agent could step between, stopping at the radius. A wall stops the flood the way it stops the player, and a doorway lets it through the way it lets the player through. The cells the flood reaches are floor; the cells around them it could not step into are the walls drawn around it.
Walls are the cells the walk could not enter, not the cells nobody can
stand in. The grid calls the roof walkable — a wall's column has one
standing place, the top of the ceiling under open sky — so "unwalkable"
would miss every wall of every room with a ceiling. What makes a wall a
wall is that the step up to it is one the player cannot take, which is
what NavGrid.canMove already decides for the monsters.
Run once per cell the player enters rather than once per step: a flood of a six-metre radius over quarter-metre cells is a few hundred cells, and a player standing still crosses none.
In the snapshot
What has been seen is part of the run — a save that forgot the map would hand the player back a level they had explored and a map that said they had not — so it is written into the snapshot and read back. As runs of bits rather than the bits: the crypt's grid is twenty-five thousand cells and its bitset four kilobytes however little was seen, where the runs of a partly explored level are a few hundred bytes. Deterministic like everything in a step: the flood's order is the grid's order, so a replay reveals what the run revealed.
Constructors
Properties
- grid → NavGrid
-
The level's walk grid, whose cells the map marks and whose step rules
decide what is a wall.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEverythingRevealed → bool
-
Whether a map pickup has shown the whole level.
no setter
- revealedCount → int
-
How many cells are on the map.
no setter
- revealRadius → double
-
How far the flood reaches from the player, in metres along the walk.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
isFloor(
int index) → bool -
Whether cell
indexis floor the player has been near. -
isRevealed(
int index) → bool -
Whether cell
indexis on the map at all, as floor or as wall. -
isWall(
int index) → bool -
Whether cell
indexis a wall: beside seen floor, and not to be stepped into from it. What the map draws dark around what it draws light. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
restore(
Map< String, Object?> from) → void - Reads what was seen. Runs that do not add up to this grid's cells — another level's, another cell size's — are ignored rather than applied over the wrong cells.
-
reveal(
Vector3 at) → void -
Reveals what a player standing at
atcan have seen. -
revealAll(
Vector3 at) → void -
Shows everything a player standing at
atcould ever walk to, the way a map pickup does. -
save(
) → Map< String, Object?> - What was seen, as runs of floor and wall cells and whether a pickup showed everything.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited