atmosphere

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 31 Imported by: 1 module, 0 packages

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 atmosphere is the sky over a world on the world's clock: the calendar, the light of the day, the climate and its weather, what falls, and what the weather does to the ground.

Plugin

NewPlugin takes a world with heights and a Config: the calendar's (plugins/atmosphere/calendar), the sky's (plugins/atmosphere/sky), the climate's (plugins/atmosphere/climate) and which of its workings go on (Running; Write.SetRunning switches them as the game goes). The light runs once a tick, in the tactical pause too; the weather in every step of the simulation, carried over the world by the wind: a new one is born at the horizon it blows from and comes in over the world, and rain and snow fall only under their clouds. Read.DrawnAir is what a board takes to shade itself and lean what sways (board.Plugin.WithAtmosphere, topography.Plugin.WithAtmosphere).

Plugin.Over, as the plugin is made, has the low clouds hang over a board's ground, their bands fitted to its relief: under the peaks, covering them and over them, whatever height they reach. Plugin.WithWeathering does that too and lays the weather on the board (plugins/atmosphere/weathering): snow, ice and what sways, as effects on the cells; the ground standing up into the low clouds holds them back, piling up before it and clearing past it, and the rules of its cells let rain fall out of the air over them and gather its damp into clouds. The atmosphere is an entity of its own: it plays roles, whose rules of climate.Weathering are told the weather once a step, and a command may be for it.

Commands

Freeze stops the light of the day, Hour freezes it at an hour, ChangeWeather throws the next weather and SetWeather names one, either over the world within seconds; Clouds has the clouds drawn in a CloudLook, CloudsDrawnAt at a quarter, a sixth or an eighth of the pixels, CloudReach as bodies out to a share of the sight; AdaptClouds has them follow the cameras' frame budget, the Write a cameras.Lever: drawn at fewer pixels first, as bodies to half the sight last, the look never. None has a key of its own: the settings screen sets the light, the clouds and the weather; its hour shows the day's time and, moved, freezes the light there.

Drawing

The plugin draws the sky behind the world (plugins/atmosphere/backdrop), which hands every frame the sun and the weather; the clouds in two layers, low heaps and high shreds, flat or as bodies as a scene shows them (Write.ShowClouds): heaped on the sky from under them, the low ones half see-through over the world from above and before the slopes from under them (plugins/atmosphere/aloft), hiding and hidden by what stands nearer — the high ones never over the map from above, where they veiled it; and the rain and the snow before it (plugins/atmosphere/precipitation); whoever draws the ground shadows it under the clouds, each layer's along the way to the sun. All of it draws the atmosphere as published once a frame (Plugin.Publish): the weather, its air masses copied where they changed, the sun, the heavens and the Settings; Read.DrawnAir is that weather, Read.Air the live one the simulation reads. Read.Reporter adds the daylight, how the clouds look and share their bands and whose shadows they cast to the telemetry panel; a game showing the time, the season, the moon and the weather nowhere else adds the calendar's and the climate's reporters too (Read.Calendar, Write.Climate).

HUD

The atmosphere gives a scene elements to place, each on a see-through panel as the telemetry's: Plugin.TimeOfDay the hour of the game's day, Plugin.Date the season and the date with the moon's phase beside them while the moon runs, Plugin.Weather the weather, the temperature and the wind, left out while none of the climate's workings run, and Plugin.Bar the three side by side on one panel, for an edge of the screen (ui.TopMiddle, ui.BottomMiddle). The pointer passes through each to the picture under it: the cameras' scroll zones work under the bar as they are drawn over it. The weather is read through a drawer of its own: it goes in the tree a scene is made with, never one ui.Scene.Replace puts in.

Sky

The sky is the Earth's unless a game gives its own: a Sky, in a file of its own (sky.go), noted in the Stage's Figures link (Plugin.Skies). Its Look sets the parts of the dome (plugins/atmosphere/backdrop) it draws its own way: the vault, the sun, the moon, the stars; a part's Feed reads the heavens the sky is drawn under from its backdrop.Values.

Vocabulary

Moments, for a role's rules, hosted by its parts: sky.Moonrise and climate.Weathering (the atmosphere's own entity, once a step), weathering.Overhead (a board's cell, once a second, with WithWeathering). Knobs, for an effect's Alter: sky.Moon and climate.Spread (on the atmosphere's own entity), weathering.Wring (on every cell of the board). Commands, a player's: Freeze, Hour, ChangeWeather, SetWeather, Downpour, Clouds, CloudsDrawnAt, CloudReach, AdaptClouds, GroundShade, FigureShade, HighShade. Settings (Settings, saved with the game, in Resources): the frozen light and its hour, the clouds' look, pixels and reach, their shadows, their following.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdaptClouds

type AdaptClouds struct{ On bool }

AdaptClouds has the clouds follow the cameras' frame budget, or not (Settings.AdaptiveClouds): the atmosphere's Write is a cameras.Lever (cameras.Config.Levers), the clouds drawn at a sixth of the pixels, then an eighth, then as bodies to half the sight alone as the rate falls under the budget, and back up as it stays over; the look stays as set. The settings screen alone.

func (AdaptClouds) Command

func (AdaptClouds) Command()

type ChangeWeather

type ChangeWeather struct{}

ChangeWeather has the weather go on to its next state now.

func (ChangeWeather) Command

func (ChangeWeather) Command()

type CloudLook

type CloudLook uint8

CloudLook is how the clouds are drawn: FlatClouds as flat sheets on the sky and the low ones from above, LowBodies the low ones as bodies, heaped from under them and half see-through from above, AllBodies the high ones heaped on the sky too, ShadowsAlone none, only their shadows on the ground; the high ones never over the map from above, where they veiled it.

const (
	FlatClouds CloudLook = iota
	LowBodies
	AllBodies
	ShadowsAlone
)

func (CloudLook) String

func (l CloudLook) String() string

String is the look's name: flat, the low as bodies, all as bodies, shadows alone.

type CloudReach

type CloudReach struct{ Share float32 }

CloudReach has the clouds drawn as bodies out to Share of the camera's sight from where it looks and flat beyond (Settings.CloudReach), 1 everywhere. The settings screen alone.

func (CloudReach) Command

func (CloudReach) Command()

type CloudShadows

type CloudShadows struct{ Ground, Figures, High bool }

CloudShadows is whose shadows the clouds cast: on the Ground, on the Figures standing on it, and whether the High clouds' fall too, or the low ones' alone. A cloud shades itself only as a body lit from above, darker under its brow.

func (CloudShadows) String

func (c CloudShadows) String() string

String says whose shadows fall: "both layers' on the ground and the figures".

type Clouds

type Clouds struct{ Look CloudLook }

Clouds has the clouds drawn in the Look (CloudLook, Settings.Clouds). The settings screen alone.

func (Clouds) Command

func (Clouds) Command()

type CloudsDrawnAt

type CloudsDrawnAt struct{ Coarse int }

CloudsDrawnAt has the clouds drawn at a Coarse of the pixels each way, 4, 6 or 8 (Settings.CloudCoarse): they are soft, so a quarter of them loses nothing to the eye, a sixth or an eighth little, for a frame the cheaper. The settings screen alone.

func (CloudsDrawnAt) Command

func (CloudsDrawnAt) Command()

type Config

type Config struct {
	Calendar calendar.Config
	Sky      sky.Config
	Climate  climate.Config
	Running  *Running
}

Config is the atmosphere: its calendar, sky, climate and which of its workings go on from the start (all of them when Running is nil). Zero fields take each package's defaults.

type Downpour

type Downpour struct{}

Downpour has it rain now: SetWeather of weather.Rain.

func (Downpour) Command

func (Downpour) Command()

type FigureShade

type FigureShade struct{ On bool }

func (FigureShade) Command

func (FigureShade) Command()

type Freeze

type Freeze struct{ On bool }

Freeze stops the light of the day at the hour it stands (Settings.Frozen), or lets a frozen light go again. Only the light stops; the calendar and the weather go on. The settings screen alone.

func (Freeze) Command

func (Freeze) Command()

type GroundShade

type GroundShade struct{ On bool }

GroundShade has the clouds shade the ground, or not (Settings.NoGroundShade); FigureShade the figures (Settings.NoFigureShade). The settings screen alone.

func (GroundShade) Command

func (GroundShade) Command()

type HighShade

type HighShade struct{ On bool }

HighShade has the high clouds shade the ground too, as the game starts, or no longer: the low ones alone do (Settings.NoHighShade). The settings screen alone.

func (HighShade) Command

func (HighShade) Command()

type Hour

type Hour struct{ At float32 }

Hour freezes the light At a part of the day, 0 to 1 round midnight (Settings.Frozen, Settings.Hour): the hour taken, Freeze{On: false} lets the day go on from there. The settings screen alone.

func (Hour) Command

func (Hour) Command()

type Plugin

type Plugin struct {
	*world.Self

	Res Resources
	// contains filtered or unexported fields
}

Plugin is the atmosphere over a world: the calendar, the light of the day, the climate and its weather, what falls, and what the weather does to a board.

func NewPlugin

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

NewPlugin puts the atmosphere of cfg over worldPlugin, its sun shone through lightPlugin's mechanism: the atmosphere's own entity carries the sun's Source and its Shining of the hour. A world without heights panics.

func (*Plugin) Bar

func (p *Plugin) Bar() *ui.Element

Bar is the hour, the date and the weather side by side on one see-through panel, for a scene to place at the top (ui.TopMiddle); the weather left out as Weather is.

func (*Plugin) CastClouds

func (p *Plugin) CastClouds(c CloudShadows) *Plugin

CastClouds has the clouds' shadows fall as c says (Settings), all three as the atmosphere starts: a game's start, set as its plugins are made.

func (*Plugin) Date

func (p *Plugin) Date() *ui.Element

Date is the season and the date, "summer, 3 August", on a see-through panel, the moon in its phase beside them, a line tall, while the moon runs (Running.Moon).

func (*Plugin) DefaultBindings

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

DefaultBindings are none: the light, the clouds and the weather are the settings screen's.

func (*Plugin) EventHandler

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

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

func (*Plugin) Install

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

Install wires the sky's, the weather's and the weathering's systems, and draws the sky behind the world, looking as its Skies say, the clouds seen from above and what falls before it.

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) Over

func (p *Plugin) Over(brd *board.Plugin) *Plugin

Over has the low clouds hang over brd's ground, their bands fitted to its relief: from its low ground, the sea's or the valleys', up to its peaks. Call it as the plugin is made; WithWeathering does.

func (*Plugin) Publish added in v0.5.0

func (p *Plugin) Publish()

Publish copies the atmosphere for the frame drawn next, of the dome the patches changed since that buffer was drawn.

func (*Plugin) Queues

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

Queues are where the atmosphere's commands land.

func (*Plugin) Read added in v0.4.0

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

Read reads the atmosphere's state on worker w of the game's pool, 0 the game's own goroutine.

func (*Plugin) Restore

func (p *Plugin) Restore()

Restore takes the Settings loaded: the light frozen at its hour, the clouds and their shadows.

func (*Plugin) RunPlan

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

RunPlan runs the atmosphere's tick. Call it after the world's.

func (*Plugin) Serializable

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

Serializable is the atmosphere's Settings, kept whole; the weather and its air masses are entities, saved with the ECS.

func (*Plugin) Settings

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

Settings are the frozen light and the hour, the clouds' look, pixels, reach and shadows, and the weather (plugin.Tunable). The hour shows the day's time, and sets it frozen.

func (*Plugin) Skies

func (p *Plugin) Skies(skies ...Sky)

Skies notes the skies the atmosphere draws, each Look in the order noted, a later part taking the place of an earlier; none is the Earth's. Called in the Stage's Figures link.

func (*Plugin) Swap added in v0.5.0

func (p *Plugin) Swap()

Swap has the atmosphere published last drawn.

func (*Plugin) TimeOfDay

func (p *Plugin) TimeOfDay() *ui.Element

TimeOfDay is the hour of the game's day, "08:15", on a see-through panel for a scene to place.

func (*Plugin) Weather

func (p *Plugin) Weather() *ui.Element

Weather is the weather, the temperature and the wind, "clear · 29°C · wind 13 E", on a see-through panel; left out while none of the climate's workings run.

func (*Plugin) WithWeathering

func (p *Plugin) WithWeathering(brd *board.Plugin, cfg weathering.Config) *Plugin

WithWeathering has the weather work on brd as cfg says, snow, ice and what sways, and brd's ground on the air over it: the low clouds hang over it (Over), held back by what stands up into them. Call it as the plugin is made; a kind cfg names that the board lacks panics as the weather first touches it.

func (*Plugin) Write added in v0.4.0

func (p *Plugin) Write() *Write

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

type Read added in v0.4.0

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

Read reads the atmosphere's state, the same on every goroutine.

func (*Read) Air added in v0.4.0

func (r *Read) Air() air.Weather

Air is the weather as the last step of the simulation left it, its clouds shading as CloudShadows say.

func (*Read) Calendar added in v0.4.0

func (r *Read) Calendar() *calendar.Calendar

Calendar is the day, the season and the moon of the world's clock.

func (*Read) CloudShadows added in v0.4.0

func (r *Read) CloudShadows() CloudShadows

CloudShadows is whose shadows the clouds cast (Settings).

func (*Read) CloudsAdaptive added in v0.4.0

func (r *Read) CloudsAdaptive() bool

CloudsAdaptive reports whether the clouds follow the frame budget.

func (*Read) CloudsDrawnAt added in v0.4.0

func (r *Read) CloudsDrawnAt() int

CloudsDrawnAt is the coarse of the pixels each way the clouds are drawn at, 4 to start.

func (*Read) CloudsReach added in v0.4.0

func (r *Read) CloudsReach() float32

CloudsReach is the share of the camera's sight the clouds are bodies out to, 1 everywhere.

func (*Read) DrawnAir added in v0.5.0

func (r *Read) DrawnAir() air.Weather

DrawnAir is the weather as the frame drawn reads it: as last published, the live one before any was.

func (*Read) Heavens added in v0.4.0

func (r *Read) Heavens() celestial.Heavens

Heavens is where the sun, the moon and the stars stand at the hour of the light.

func (*Read) Reporter added in v0.4.0

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

Reporter is the atmosphere's lines for the telemetry panel: the daylight, how the clouds look and whose shadows they cast; the time, the season and the weather are the reporters of Calendar and Climate.

func (*Read) Running added in v0.4.0

func (r *Read) Running() Running

Running is which of the atmosphere's workings go on now.

func (*Read) ShownClouds added in v0.4.0

func (r *Read) ShownClouds() CloudLook

ShownClouds is how the clouds are drawn.

func (*Read) Sun added in v0.4.0

func (r *Read) Sun() light.Distant

Sun is the light of the day as it stands: the light plugin's, the sky's of the hour as its Source scales it; the sky's own without a light plugin.

type Resources

type Resources struct {
	Settings Settings
}

Resources is what the atmosphere publishes: its Settings.

type Running

type Running struct {
	// Day: the sun and the moon cross the sky with the calendar; off, the light stands.
	Day bool
	// Weather: one weather follows another; off, the weather now stays.
	Weather bool
	// Wind: the wind blows; off, the air stands still.
	Wind bool
	// Clouds: the clouds cover the sky and shade the ground.
	Clouds bool
	// Falls: rain and snow fall.
	Falls bool
	// Weathering: the weather works on the board.
	Weathering bool
	// Stars: the stars come out at night.
	Stars bool
	// Moon: the moon shows on the sky and lights the night.
	Moon bool
}

Running is which of the atmosphere's workings go on, each to switch off to see the rest without it. None of it is saved.

func AllRunning

func AllRunning() Running

AllRunning is Running with all of it going on, the default.

type SetWeather

type SetWeather struct{ Name string }

SetWeather has the weather go into the state called Name now (weather.Clear, weather.Storm, a game's own); a name the climate lacks changes nothing.

func (SetWeather) Command

func (SetWeather) Command()

type Settings

type Settings struct {
	Frozen         bool
	Hour           float32
	Clouds         CloudLook
	CloudReach     float32 // of the camera's sight the clouds are bodies out to; zero, all
	CloudCoarse    int     // of the pixels each way the clouds are drawn at; zero, 4
	AdaptiveClouds bool
	// whose shadows the clouds do not cast (CloudShadows); zero, all of them fall
	NoGroundShade bool
	NoFigureShade bool
	NoHighShade   bool
}

Settings is what the atmosphere lets the players adjust, saved with the game: the frozen light and its hour, the clouds' look and whose shadows they cast.

type Sky

type Sky interface {
	Look(d *backdrop.Dome, p *Plugin)
}

Sky is how a game's sky looks: its Look sets the parts of the dome it draws its own way, the Earth's standing in the rest.

type Write added in v0.4.0

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

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

func (*Write) AdaptClouds added in v0.4.0

func (w *Write) AdaptClouds(on bool)

AdaptClouds has the clouds follow the cameras' frame budget, or not (Settings.AdaptiveClouds): drawn at fewer of the pixels first, as bodies to half the sight last.

func (*Write) Climate added in v0.4.0

func (w *Write) Climate() *climate.Climate

Climate is the climate and its weather.

func (*Write) Coarser added in v0.4.0

func (w *Write) Coarser() bool

Coarser draws the clouds at fewer of the pixels, or at the fewest as bodies to half the sight, true where it could (cameras.Lever).

func (*Write) DrawCloudsAt added in v0.4.0

func (w *Write) DrawCloudsAt(coarse int)

DrawCloudsAt has the clouds drawn at a coarse of the pixels each way, 4, 6 or 8 (Settings.CloudCoarse); any other, 4.

func (*Write) Finer added in v0.4.0

func (w *Write) Finer() bool

Finer brings the clouds' bodies back to the whole sight, or draws them at more of the pixels, true where it could (cameras.Lever).

func (*Write) Following added in v0.4.0

func (w *Write) Following() bool

Following is whether the clouds follow the frame budget (cameras.Lever).

func (*Write) ReachClouds added in v0.4.0

func (w *Write) ReachClouds(share float32)

ReachClouds has the clouds drawn as bodies out to share of the camera's sight from where it looks and flat beyond (Settings.CloudReach); 1 or more, or zero, everywhere.

func (*Write) SetRunning added in v0.4.0

func (w *Write) SetRunning(r Running)

SetRunning has the atmosphere's workings go on as r says, at once.

func (*Write) ShowClouds added in v0.4.0

func (w *Write) ShowClouds(look CloudLook)

ShowClouds has the clouds drawn as look says (Settings.Clouds), AllBodies till then: a game's say as it is made, the Clouds command's as it goes.

func (*Write) Sky added in v0.4.0

func (w *Write) Sky() *sky.Sky

Sky is the light of the day, to freeze and move by hand.

func (*Write) Weathering added in v0.4.0

func (w *Write) Weathering() *weathering.Weathering

Weathering is what the weather does to the board, nil without WithWeathering.

Directories

Path Synopsis
Package air is the weather over a world as it is felt and drawn: the Weather the climate makes, and what it does to what is drawn.
Package air is the weather over a world as it is felt and drawn: the Weather the climate makes, and what it does to what is drawn.
Package aloft draws the clouds seen from above: a layer the sky shows from below, the heaps as bodies the line of sight passes through, lit from above, the shreds as thin sheets at their heights, half see-through over their shadows, thinning away into the ground; and the heaps seen from under their top before the slopes that stand up into them.
Package aloft draws the clouds seen from above: a layer the sky shows from below, the heaps as bodies the line of sight passes through, lit from above, the shreds as thin sheets at their heights, half see-through over their shadows, thinning away into the ground; and the heaps seen from under their top before the slopes that stand up into them.
Package backdrop is the sky behind the world, drawn on the GPU before anything else: through a perspective the sky of the day with the sun, the moon, the stars and the clouds on it; through any other camera the viewport filled in the sky's colour wherever the ground does not cover it.
Package backdrop is the sky behind the world, drawn on the GPU before anything else: through a perspective the sky of the day with the sun, the moon, the stars and the clouds on it; through any other camera the viewport filled in the sky's colour wherever the ground does not cover it.
Package calendar turns the tactical clock's game time into days, seasons and the moon.
Package calendar turns the tactical clock's game time into days, seasons and the moon.
Package celestial is the celestial sphere over a world: where the sun, the moon and the stars stand as the world turns, and the real stars and the moon's face to draw them with.
Package celestial is the celestial sphere over a world: where the sun, the moon and the stars stand as the world turns, and the real stars and the moon's face to draw them with.
Package climate is the climate of a world: where in the world it lies, and the weather that goes by there.
Package climate is the climate of a world: where in the world it lies, and the weather that goes by there.
weather
Package weather is the kinds of weather a climate goes through, each a State.
Package weather is the kinds of weather a climate goes through, each a State.
Package precipitation draws what falls from the world's weather: rain and snow, drop by drop between the low clouds and the ground, only under the clouds it falls from and as thick as they let fall (air.Weather.FallsAt), in the light of the sun.
Package precipitation draws what falls from the world's weather: rain and snow, drop by drop between the low clouds and the ground, only under the clouds it falls from and as thick as they let fall (air.Weather.FallsAt), in the light of the sun.
Package sky is the light of the day over a world: the sun (a light.Distant; DefaultSun without a sky) and the moon of the calendar's hour.
Package sky is the light of the day over a world: the sun (a light.Distant; DefaultSun without a sky) and the moon of the calendar's hour.
Package weathering is the weather on the board: snow lying, ice on the water, what sways swaying, as effects on the board's cells cast as the world's weather says and taken off again.
Package weathering is the weather on the board: snow lying, ice on the water, what sways swaying, as effects on the board's cells cast as the world's weather says and taken off again.

Jump to

Keyboard shortcuts

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