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 ¶
- type Atmosphere
- type Config
- type Haze
- type Level
- type Lower
- type Plugin
- func (p *Plugin) DefaultBindings() []control.Binding
- func (p *Plugin) DrawnHeights() ground.Heights
- func (p *Plugin) Dressing() look.Dressing
- func (p *Plugin) EventHandler() control.EventHandler
- func (p *Plugin) Heights() ground.Heights
- func (p *Plugin) Install(ctx plugin.Installer) error
- func (p *Plugin) Look() look.Look
- func (p *Plugin) Name() string
- func (p *Plugin) Populate() error
- func (p *Plugin) Publish()
- func (p *Plugin) Queues() []command.CommandQueue
- func (p *Plugin) Read(w int) *Read
- func (p *Plugin) Restore()
- func (p *Plugin) Rise(from, to cell.ID) float64
- func (p *Plugin) RunPlan(ctx goke.RunCtx, d time.Duration)
- func (p *Plugin) Serializable() plugin.Serializable
- func (p *Plugin) Settings() []control.Setting
- func (p *Plugin) Style(name string, s painter.Style) *Plugin
- func (p *Plugin) Swap()
- func (p *Plugin) Top(c cell.ID, height float32) (corners [4]float32, level float32)
- func (p *Plugin) WithAtmosphere(a Atmosphere) *Plugin
- func (p *Plugin) WithSea(s painter.Sea) *Plugin
- func (p *Plugin) WithShading(s painter.Shading) *Plugin
- func (p *Plugin) Write() *Write
- type Raise
- type Read
- type Relief
- type Resources
- type Settings
- type Shaping
- type Write
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Atmosphere ¶
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.
type Plugin ¶
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 ¶
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
DrawnHeights is the ground's height as the frame drawn holds it (board.Read.DrawnHeights).
func (*Plugin) 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 ¶
Heights is the relief: the ground's height at any point, for sight and navigation.
func (*Plugin) Install ¶
Install registers the plugin's systems, and has the heights on the topography's entities as each tick ends.
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
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
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 ¶
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) Style ¶
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) 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
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 ¶
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.
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
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
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) Reporter ¶ added in v0.4.0
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.
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
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
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
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
Relief is the ground's heights, to read and set from a game's code.
Source Files
¶
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. |