Documentation
¶
Overview ¶
Package forest plants forests over the board: fields of trees standing as a camera comes near and folding into the world's sheets as it goes.
NewPlugin takes the world and the board, whose cells and heights a forest reads. It has no pass of its own: its trees come and go by the world's moments of an aggregate.
Kinds of trees ¶
A game defines its kinds of trees in the Kinds section (Plugin.Types, Types.Define a Spec): how tall a tree stands and how wide its crown, how it looks, how it casts its shade, how much it bends in the wind, whether it stops what collides, and the game's roles it plays beside TreeRole. A tree is a part of its forest standing for good (world.Fixed), going as its sector folds. At L2 it stands in relief as a billboard of its Side, its top leaning with the wind's gusts as far as its Sway says, or as a body of it on the four sides and over the top of its box where its Spec says Body, at L3 as a billboard of its Top; from L4 out the world's sheets hold it as planted. A look left out is drawn of its Colours. A Spec with Parts is a tree with a body (world.Body), its parts in the paints Leaves and Wood: it stands whole in relief as far as the world's bodies reach and as a card of itself beyond, its Side and its Top photographed of it. Its looks are whole, drawn in render's cutout pass (world.Slot.Cutout), and give way (world.Slot.GivesWay): what a game's look has uncovered (world.Slot.Uncovered) shows through the tree before it or over it, which is left out in part round it, before the cameras the world's settings say (world.GiveWay, world.GiveWayRiding). Types.Entry is a tree for a game's own rule to stand where no forest plants it.
Stands ¶
A forest is a game's kind with world.Aggregate and world.Field playing a role the plugin makes in the Rules section (Plugin.Stands, Stands.Define a Stand): each of its sectors come down to L3 plants trees over the kinds of cells the Stand names, as many a cell as its Density, each plot sown by the forest's seed (lod.Seed) and its tree drawn by weight among the [Share]s of the Mix growing at the height of the ground there. A forest plants the same trees each time, and the world previews them into its sheets before anyone comes near. A Stand's When has an effect of the forest's choose between two stands; Stands.Felled tells a forest folding short of its trees.
Figures ¶
A Figure is a kind of forest in one piece: Define its kinds of trees on the plugin's Types and its own kind, Look its own look on the world's atlas, and, Stateful or Ruled, its effects and rules, its stands among them. Plugin.Figures, called in the Stage's Figures link, hands them on to the world's figures; Plugin.World and Plugin.Board are what they stand on.
Vocabulary ¶
Roles: TreeRole, every tree's. Words: Stands.Felled, of a world.Fold.
Index ¶
- Constants
- type Colours
- type Figure
- type Plugin
- func (p *Plugin) Board() *board.Plugin
- func (p *Plugin) EventHandler() control.EventHandler
- func (p *Plugin) Figures(figures ...Figure)
- func (p *Plugin) Install(plugin.Installer) error
- func (p *Plugin) Name() string
- func (p *Plugin) RunPlan(goke.RunCtx, time.Duration)
- func (p *Plugin) Serializable() plugin.Serializable
- func (p *Plugin) Stands() *Stands
- func (p *Plugin) String() string
- func (p *Plugin) Types() *Types
- func (p *Plugin) World() *world.Plugin
- type Ruled
- type Share
- type Spec
- type Stand
- type Stands
- type Stateful
- type Type
- type Types
Constants ¶
const ( Leaves = iota Wood )
The paints of a tree's body, which a Part of its Spec names: Leaves, in its Colours' Crown, dotted with their Leaves and with what it Bears, and Wood, in their Trunk.
const DefaultDensity = 1.5
DefaultDensity is how many trees a cell a Stand plants where its Density is zero.
const TreeRole = "forest.tree"
TreeRole is the role every tree plays, the plugin's own: a tree goes as its sector folds.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Colours ¶
type Colours struct {
Crown color.RGBA
Leaves color.RGBA
Trunk color.RGBA
// Bears is its blossom or its fruit, dotted over its body's leaves; nothing where zero.
Bears color.RGBA
}
Colours are what a tree's looks are drawn in where its Spec gives no drawer of its own, and its body is painted in: a dark green crown on a brown trunk where they are zero.
type Figure ¶
Figure is a kind of forest in one piece: its kinds of trees defined on the plugin's Types and its own kind in the Kinds section, its look declared on the world's atlas in a scene. One with states of its own is Stateful, one with roles and rules of its own, its Stands among them, Ruled.
type Plugin ¶
Plugin plants forests over the board: the kinds of trees a game defines on its Types, planted by the rules its Stands make as a forest's sectors come near and gone as they fold.
func NewPlugin ¶
NewPlugin builds the forest plugin over w and the board brd, which a forest's cells and heights are read off.
func (*Plugin) EventHandler ¶
func (p *Plugin) EventHandler() control.EventHandler
EventHandler is nil: the forest reads no input.
func (*Plugin) Figures ¶
Figures notes the kinds of forests among the world's figures, which the Stage leads through its sections. Called in the Stage's Figures link.
func (*Plugin) Serializable ¶
func (p *Plugin) Serializable() plugin.Serializable
Serializable is nil: a tree is an entity, saved as any, and a forest's state its effects.
type Ruled ¶
type Ruled interface{ Rules(p *Plugin) }
Ruled is a Figure with roles and rules of its own, defined in the Rules section.
type Share ¶
type Share struct {
Share is a kind of tree in a Stand's Mix: its name on the Types, its Weight against the others growing where it does (1 where it is zero), and the band of the ground's height it grows in, From up to To in world height units, zero for no bound.
type Spec ¶
type Spec struct {
Height float32
// Crown is the side of the tree's box.
Crown float32
// Trunk is the share of its Height under its crown where its Side is drawn of its Colours.
Trunk float32
Colours Colours
// Top is its crown seen from above, at L3 and in the world's sheets; drawn of its Colours
// where it is nil.
Top render.SpriteDrawer
// Side is its trunk and crown seen from the side, at L2; drawn of its Colours where it is nil.
Side render.SpriteDrawer
// Shadow is how it casts and takes shade, Baked taking all where it is zero.
Shadow light.Shadow
// Solid has it a post nothing walks through, which what collides meets.
Solid bool
// Body has it drawn at L2 as a body, its Side on the four faces and over the top of its box;
// a billboard of its Side unless set.
Body bool
// Sway is how much it bends in the wind, 0 not at all to 1 as far as the wind blows it.
Sway float32
// Parts are its body, each in the paint Leaves or Wood, world.MaxParts at most: whole in
// relief near the camera, a card of it beyond, its Side photographed of it and its Top where
// that is nil (world.Atlas.AddBody); none, the billboards of its Side and its Top.
Parts []world.Part
// Roles are the game's roles it plays besides TreeRole.
Roles []string
}
Spec is what a kind of tree is: how tall it stands and how wide its crown, in world units, how it looks, casts its shade and bends in the wind, whether it stops what collides, and the game's roles it plays.
type Stand ¶
type Stand struct {
// Cells are the names of the kinds of cells its trees grow on; every cell where it names none.
// No tree stands on a way's band or under a deck, nor within half the widest crown of the Mix
// and a quarter of the way's width of its band.
Cells []string
// Density is how many trees a cell it plants, DefaultDensity where it is zero.
Density float32
// Jitter is how far a tree strays from its plot each way, a share of the plots' spacing up to
// a half.
Jitter float32
// Mix is the kinds of trees it plants, each plot's drawn by weight among those growing at the
// height of the ground there.
Mix []Share
// When is what the forest must hold for the stand to plant, an effect of its own say; always
// where it is nil.
When cond.Cond
}
Stand is how a forest plants its trees: on which kinds of cells, how many a cell, how far each strays from its plot, and which kinds of trees at which heights of the ground.
type Stands ¶
type Stands struct {
// contains filtered or unexported fields
}
Stands makes the roles that plant a game's forests, in the Rules section.
type Stateful ¶
type Stateful interface{ Effects(p *Plugin) }
Stateful is a Figure with effects of its own, defined in the Effects section.
type Type ¶
type Type struct {
// contains filtered or unexported fields
}
Type is a kind of tree defined.
type Types ¶
type Types struct {
// contains filtered or unexported fields
}
Types is the register of the kinds of trees, defined on the Stage's kinds.
func (*Types) Define ¶
Define registers the kind of tree named name, as spec says: a part of its forest standing for good, playing TreeRole and spec's Roles.