topography

package
v0.24.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 31 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package topography is a map in relief over a board: the ground's heights, the light and the water on them, drawn on the GPU.

NewPlugin takes the world, the board and the Config and puts the board in relief at once: the plugin is the board's Map and the world's Ground and Look. Its state is read through Plugin.Read (Read(w) worker w's of the game's pool, 0 the game's own goroutine, with the board's read of the same worker) and changed through Plugin.Write, the game's goroutine's. The world must have heights (world.Config.Heights) and may not wrap. What a game and the other plugins both name is in one small package, painter (Style); the rest is the plugin's own, in plugins/topography/internal.

Relief

The ground's heights are Write.Relief, standing at the cells' corners on a square board and a hex one alike, seeded by Write.Seed when a game starts fresh (board.Level.Heights, or ground.MeanOfCells from a height per cell) and shaped at play by Raise, Lower and Level as the Config's Shaping says. Every step the plugin puts every unit at the surface under it, the ground or a deck carrying its domain within its step, plus its Mover's Lift; a unit carrying a motion.Drift is gravity's. A part of an aggregate standing for good (world.Fixed and world.PartOf, on no cell) is set on the ground under its middle too, and the world is given the ground's height (world.Write.SetGround) for what it previews and photographs without spawning. How steep a step from cell to cell is, is the relief's (Plugin.Rise, the board's Map's); what the slope does to a unit is the board's mobility's, in the planner and on the move alike. Write.Flatten lays a cell flat and Write.Grade puts a cell's corners at heights of their own, the ground round following within the Shaping's MaxStep: the Write is a ground.Shaper. The heights live on the topography's own entities, saved with the game, and are there as each tick ends: a save between ticks holds the ground shaped in it, by a command or in a step of the simulation.

Cage

Read(0) is a cameras.Cage for a game to hand its cameras (cameras.Config.Cage): a point is Read.Free over the ground, over the sea lying on it to its level, over the kind standing on its cell to its Height and out of a deck's slab, and under the ground in the room over a floor sunk there, and in a room standing on the ground at any height, solid under its floor; Read.Span is the lowest and the highest the ground reaches, Read.Grain how finely a line of sight steps near a deck. The ground over the mouth of a floor sunk under it, lower than its roof, is not drawn, nor the ground rising into a room standing on its cell over its floor and under its roof.

Light and shadows

The relief is lit by the light plugin's sun and lamps per pixel (light.White given none) and shaded as the light bakes it: the relief's shadows, which fall on the relief from then on (light.Plugin.OverRelief), and the Baked blocks' (render.GroundShade); the live shadows the light lays over the ground's depth. What stands receives the shadows at its height as its light.Shadow says: the relief's and the clouds' wherever it is, the blocks' near the ground. A cell takes what its kind's Takes says. The relief stands under an Atmosphere (Plugin.WithAtmosphere; still, clear air given none): its weather leans what sways and lays the clouds' shadows; its air hazes the ground and what stands on it only when asked (Write.SetHaze, Haze): far off from an eye, over the ground from above, all clear by default. How a kind looks beyond its sprite is its painter.Style (Plugin.Style): its shine, its flow, how it spreads, and its painter.Detail, a texture laid over its cells seen near as a grain round the kind's own colour, fading out as a cell shrinks on the screen; what sways on a cell (cell.Kind.Sway) leans its grain with the weather's wind and lightens under its gusts, bands going over the ground with it; the sea's waves run with the wind and stand steeper under a gust. How the light is styled is a painter.Shading (Plugin.WithShading): the sun's light in bands, the shade tinted, the sun warmed.

Water

Water lies on the ground it covers and is alive at every level short of the sheet: the sea's waves, its swell breaking into surf by the shore and the rivers running, what of them is finer than a pixel or two left out, the surf an even pale line far off. The sea over ground lower than its level, 0, is a surface of its own at that level, styled by a painter.Sea (Plugin.WithSea): the deeper the ground lies under it, the less of it shows through, its shallows of a colour of their own, its bed darker under the water.

Drawing and commands

The plugin draws the ground, a render.Direct in the opaque pass of the world's picture, handing the frame its heights (render.GroundHeights), the board's grid on it in the board's line (board.Surface), and under no atmosphere hands the frame its still sky, giving way to a sky some other source hands it. In a world cut into sectors the ground drawn is that of the sectors a camera sees, each at the level it sees it at as the lod package's words for the ground say (on a hex board the cells' tops alone from L3, a quad a sector at L5), the skirt to the horizon as at L5, turning into the fog before its sight's end; from L4 the sheet of what stands there (world.Read.Sheet) rises over the ground as relief in the frame's light, at L5 in half, the skirt bare; a camera with an eye, riding or free in the perspective, sees no sheet, a photograph from above where what stands hangs as discs in the air from the side: the world draws what stands there as points for it. The world's entities stand on the relief as billboards, upright or lying; a kind with a body (world.Body) stands whole, each part met in the pixel, as far as the world's bodies reach and as a card of it beyond, both in the frame's light and leant with the wind's gusts. What a look has uncovered (world.Slot.Uncovered) shows through what gives way before it (world.Slot.GivesWay), a billboard, a card, a body or what lies, left out in part round it, unless the ground hides it. Read.Reporter is the panel's line on how many sectors a frame drew at each level. Write.Miniature is the board painted flat as one picture, a minimap's ground. It is a plugin.CommandHandler for the shaping's and the haze's commands (Plugin.Queues, Plugin.DefaultBindings); call Plugin.RunPlan after the world has moved and before the cameras' RunPlan.

Vocabulary

Commands, a player's: Raise, Lower, Level (the shaping); Haze. Settings (Settings, saved with the game, in Resources): the haze. A game's looks: painter.Style and painter.Detail by kind (Plugin.Style), painter.Shading (Plugin.WithShading).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Atmosphere

type Atmosphere interface {
	DrawnAir() air.Weather
}

Atmosphere is the weather over the relief as the frame drawn reads it, what leans what sways, hazes the far off and casts the clouds' shadows: plugins/atmosphere's Read. Given none the relief stands in still, clear air. The light is the light plugin's; given none, light.White, which the relief hands the frame itself.

type Config

type Config struct {
	Shaping Shaping
}

Config is the topography: Shaping zero is a quarter of a cell a step and any slope.

type Haze

type Haze struct{ On bool }

Haze has the air haze the ground and what stands on it, through any camera, as thick as the weather makes it, or clear (Settings.Haze). The settings screen alone.

func (Haze) Command

func (Haze) Command()

type Level

type Level struct{ From, To geom.Vec }

Level brings the ground between From and To to the height at From.

func (Level) Command

func (Level) Command()

type Lower

type Lower struct{ At geom.Vec }

Lower sinks the ground at At by one Shaping.Step, as Raise lifts it.

func (Lower) Command

func (Lower) Command()

type Plugin

type Plugin struct {
	*world.Self

	Res Resources
	// contains filtered or unexported fields
}

Plugin is a map in relief over a board: the ground's heights, lit and shaded. It is the board's Map, the world's Ground and the cameras' Cage.

func NewPlugin

func NewPlugin(worldPlugin *world.Plugin, boardPlugin *board.Plugin, lightPlugin *light.Plugin,
	cfg Config) *Plugin

NewPlugin puts boardPlugin, over worldPlugin, in relief as cfg says, lit by lightPlugin (nil, light.White), whose shadows fall on the relief from then on: the topography is the board's Map and the world's Ground and Look. It panics for a world that wraps.

func (*Plugin) DefaultBindings

func (p *Plugin) DefaultBindings() []control.Binding

DefaultBindings are Shift+= and Shift+- raising and lowering the ground under the cursor (= and - alone zoom the camera) and a left drag with L held levelling it.

func (*Plugin) DrawnHeights added in v0.5.0

func (p *Plugin) DrawnHeights() ground.Heights

DrawnHeights is the ground's height as the frame drawn holds it (board.Read.DrawnHeights).

func (*Plugin) Dressing

func (p *Plugin) Dressing() look.Dressing

Dressing is the painter: the light, the blends, the coasts, the water and the ways over the tiles.

func (*Plugin) EventHandler

func (p *Plugin) EventHandler() control.EventHandler

EventHandler is nil: the topography takes commands, not input.

func (*Plugin) Heights

func (p *Plugin) Heights() ground.Heights

Heights is the relief: the ground's height at any point, for sight and navigation.

func (*Plugin) Install

func (p *Plugin) Install(ctx plugin.Installer) error

Install registers the plugin's systems, and has the heights on the topography's entities as each tick ends.

func (*Plugin) Look

func (p *Plugin) Look() look.Look

Look is look.Nothing: the ground is drawn on the GPU, not as tiles.

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) Populate

func (p *Plugin) Populate() error

Populate raises the seeded heights.

func (*Plugin) Publish added in v0.5.0

func (p *Plugin) Publish()

Publish hands the frame drawn next the relief as it stands, its heights copied as they change, and the topography's settings.

func (*Plugin) Queues

func (p *Plugin) Queues() []command.CommandQueue

Queues are where the shaping's and the haze's commands land.

func (*Plugin) Read added in v0.4.0

func (p *Plugin) Read(w int) *Read

Read reads the topography's state on worker w of the game's pool, 0 the game's own goroutine; the other workers' reads come with Install.

func (*Plugin) Restore

func (p *Plugin) Restore()

Restore takes the Settings loaded and shades as they say.

func (*Plugin) Rise added in v0.7.0

func (p *Plugin) Rise(from, to cell.ID) float64

Rise is how steep the step from one cell to its neighbour is: the relief's rise between their middles over the run, negative downhill.

func (*Plugin) RunPlan

func (p *Plugin) RunPlan(ctx goke.RunCtx, d time.Duration)

RunPlan carries out the shaping commands at once, in the tactical pause too, and puts every unit at its altitude in the simulation. Call it after the world has moved and before the cameras' RunPlan.

func (*Plugin) Serializable

func (p *Plugin) Serializable() plugin.Serializable

Serializable is the topography's Settings, kept whole; the heights live on its entity.

func (*Plugin) Settings

func (p *Plugin) Settings() []control.Setting

Settings are the haze (plugin.Tunable).

func (*Plugin) Style

func (p *Plugin) Style(name string, s painter.Style) *Plugin

Style sets how the kind named name looks in relief beyond its sprite; a kind without one is plain ground.

func (*Plugin) Swap added in v0.5.0

func (p *Plugin) Swap()

Swap has the relief and the settings published last drawn.

func (*Plugin) Top

func (p *Plugin) Top(c cell.ID, height float32) (corners [4]float32, level float32)

Top is c's corners with height standing on them, and its ground level.

func (*Plugin) WithAtmosphere

func (p *Plugin) WithAtmosphere(a Atmosphere) *Plugin

WithAtmosphere puts the relief under a: its weather leans what sways, lays the clouds' shadows and hazes the far off. Call it before the first frame is drawn.

func (*Plugin) WithSea added in v0.22.0

func (p *Plugin) WithSea(s painter.Sea) *Plugin

WithSea styles the sea lying over ground lower than its level as s says: how deep it hides its bed and the colour of its shallows. Nothing on a hex board.

func (*Plugin) WithShading

func (p *Plugin) WithShading(s painter.Shading) *Plugin

WithShading styles the light on the relief as s says: the sun's light in bands, the shade tinted, the sun warmed. Nothing on a hex board.

func (*Plugin) Write added in v0.4.0

func (p *Plugin) Write() *Write

Write changes the topography's state, on the game's goroutine.

type Raise

type Raise struct{ At geom.Vec }

Raise lifts the ground at the corner nearest At by one Shaping.Step.

func (Raise) Command

func (Raise) Command()

type Read added in v0.4.0

type Read struct {
	// contains filtered or unexported fields
}

Read reads the topography's state on one goroutine at a time: Plugin.Read(w), worker w's, through the board's read of the same worker.

func (*Read) Free added in v0.4.0

func (r *Read) Free(x, y, z float32) bool

Free reports whether nothing solid fills the point (x, y, z): the ground, but for the room over a floor sunk under it, the water over it to the sea's level, the kind standing on its cell to its Height, a deck's slab.

func (*Read) Grain added in v0.4.0

func (r *Read) Grain(x, y float32) (step, thin float32)

Grain is how far a line of sight may step near a deck and how thin the thinnest one is; zero away from the decks.

func (*Read) Hazes added in v0.4.0

func (r *Read) Hazes() bool

Hazes reports whether the air hazes the ground.

func (*Read) Reporter added in v0.4.0

func (r *Read) Reporter() render.Reporter

Reporter is the topography's part of the telemetry panel: in a world cut into sectors, how many the last frame drawn drew the ground of at each level, a line each.

func (*Read) Span added in v0.4.0

func (r *Read) Span() (low, high float32)

Span is the lowest and the highest the ground reaches.

func (*Read) StyleOf added in v0.4.0

func (r *Read) StyleOf(name string) painter.Style

StyleOf is how the kind named name looks, as Style set it.

type Relief

type Relief interface {
	ground.Heights
	Altitude(c cell.ID) float32
	SetHeights(heights func(p geom.Vec) float32)
}

Relief is the ground's heights as a game reads and sets them: ground.Heights, a cell's level and all of them at once from a function.

type Resources

type Resources struct {
	Settings Settings
}

Resources is what the topography publishes: its Settings.

type Settings

type Settings struct {
	Haze bool
}

Settings is what the topography lets the players adjust, saved with the game.

type Shaping

type Shaping struct{ Step, MaxStep float32 }

Shaping is how Raise, Lower and Level move the ground: Step per Raise or Lower, and at most MaxStep between two corners along a cell's edge, the ground round about following as in Transport Tycoon. MaxStep zero lets any slope stand.

type Write added in v0.4.0

type Write struct {
	// contains filtered or unexported fields
}

Write changes the topography's state, on the game's goroutine.

func (*Write) Flatten added in v0.4.0

func (w *Write) Flatten(c cell.ID, h float32) bool

Flatten lays the cell c flat at h, the ground round it following within the Shaping's MaxStep, and reports whether it did. Nothing moves where a road would be left lying as Transport Tycoon would not lay it.

func (*Write) Grade added in v0.17.0

func (w *Write) Grade(c cell.ID, corners []float32) bool

Grade puts the cell c's corners at corners, in CellOutline's order, the ground round them following within the Shaping's MaxStep, and reports whether they stand so. Nothing moves where a road would be left lying as Transport Tycoon would not lay it.

func (*Write) Miniature added in v0.4.0

func (w *Write) Miniature() (img *render.Image, perUnit float32)

Miniature is the board painted flat from above, perUnit pixels a world unit, for a minimap to lay under its marks: the painter's on a square grid, the hexes' tops on a hex one; nil before the board's atlas is closed.

func (*Write) Relief added in v0.4.0

func (w *Write) Relief() Relief

Relief is the ground's heights, to read and set from a game's code.

func (*Write) Seed added in v0.4.0

func (w *Write) Seed(heights func(p geom.Vec) float32)

Seed sets the ground's heights raised when the Stage starts fresh.

func (*Write) SetHaze added in v0.4.0

func (w *Write) SetHaze(on bool)

SetHaze has the air haze the ground and what stands on it as thick as the weather makes it, through any camera: far off from an eye, over the ground from above; off by default, all clear (Settings.Haze).

Directories

Path Synopsis
internal
billboards
Package billboards is how the world's entities look on a map in relief, drawn on the GPU: in the views in relief they stand as billboards upright in the world on their centres at their altitudes, as tall on the screen as their Height stands there, hidden by the ground where it stands before them; from above they lie over their boxes as the world's own flat look draws them.
Package billboards is how the world's entities look on a map in relief, drawn on the GPU: in the views in relief they stand as billboards upright in the world on their centres at their altitudes, as tall on the screen as their Height stands there, hidden by the ground where it stands before them; from above they lie over their boxes as the world's own flat look draws them.
hexes
Package hexes is the ground of a hex board in relief drawn on the GPU: every cell six triangles from its middle at its level out to its corners at theirs, as the relief lies, walls only down from the board's edge, its kind's Height not raised, as the terrain draws a square board; coloured from the board's tiles and ways drawn from above, lit by the sun the way the ground faces at the corners and hazed as the terrain is.
Package hexes is the ground of a hex board in relief drawn on the GPU: every cell six triangles from its middle at its level out to its corners at theirs, as the relief lies, walls only down from the board's edge, its kind's Height not raised, as the terrain draws a square board; coloured from the board's tiles and ways drawn from above, lit by the sun the way the ground faces at the corners and hazed as the terrain is.
painter
Package painter is the topography's painter: the board's Dressing in relief and the board painted flat for the ground drawn on the GPU.
Package painter is the topography's painter: the board's Dressing in relief and the board painted flat for the ground drawn on the GPU.
relief
Package relief is the ground's heights under a board: how high every corner stands, the ground between them, how steep a step is, how it is shaped, and the heights saved with the game.
Package relief is the ground's heights under a board: how high every corner stands, the ground between them, how steep a step is, how it is shaped, and the heights saved with the game.
terrain
Package terrain draws a relief on the GPU as a mesh, every lattice corner a vertex at its height, in place of the board's tiles: a Renderer (New) is a render.Direct source in the opaque pass over a Ground (the relief), looking as its Surface says (Painted: the board painted flat, its water, the shores, the grid) under a Sky, lit by the sun and the lamps the frame holds and shaded as the light baked it (render.GroundShade).
Package terrain draws a relief on the GPU as a mesh, every lattice corner a vertex at its height, in place of the board's tiles: a Renderer (New) is a render.Direct source in the opaque pass over a Ground (the relief), looking as its Surface says (Painted: the board painted flat, its water, the shores, the grid) under a Sky, lit by the sun and the lamps the frame holds and shaded as the light baked it (render.GroundShade).
topotest
Package topotest is what the topography's tests share: an installer without an engine, a world with heights over a board in relief, a level island seen isometrically.
Package topotest is what the topography's tests share: an installer without an engine, a world with heights over a board in relief, a level island seen isometrically.
water
Package water is the topography's water as its shaders draw it: the materials of the sea (Glint) and of running water (Stream), registered with the composer's library; the way to the shore from a point of water (Shore, Shores); how fast water runs (Flow); and the layers the water is painted in for the ground drawn on the GPU (Layers, FlowSpan).
Package water is the topography's water as its shaders draw it: the materials of the sea (Glint) and of running water (Stream), registered with the composer's library; the way to the shore from a point of water (Shore, Shores); how fast water runs (Flow); and the layers the water is painted in for the ground drawn on the GPU (Layers, FlowSpan).
Package painter is what a game says of how its kinds look in relief beyond their sprites: a Style for each kind's name, with its Detail, the texture over its cells, and a Shading of the light over them all, given to the topography.
Package painter is what a game says of how its kinds look in relief beyond their sprites: a Style for each kind's name, with its Detail, the texture over its cells, and a Shading of the light over them all, given to the topography.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL