Documentation
¶
Overview ¶
Package rt defines the runtime interfaces used to interact with the game world. We use interfaces rather than concrete implementations to decouple package dependencies.
Index ¶
Constants ¶
const NoResult errutil.NoPanicError = "no result"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assignment ¶
Assignment accesses values in a generic way.
type NumListEval ¶
NumListEval represents the computation of a series of numeric values.
type NumberEval ¶
NumberEval represents the result of some numeric expression.
type RecordEval ¶
RecordEval yields access to a set of fields and their values.
type RecordListEval ¶
RecordListEval represents the computation of a series of a set of fields.
type Rule ¶
type Rule struct { Name string // controls the style of transition: // when true, stops processing of any other rules; otherwise moves to the next phase. // a stop before the main rule is considered a canceled action; // and the result of the action in that case is false. Stop bool // controls when a transitions happens Jump Jump // whether the rule needs to be updated // before jumping to the next phase ( ex. for counters ) Updates bool // a chain of if-else statements is considered an "optional" rule; // otherwise its considered a mandatory rule. // mandatory rules block other rules from running ( based on stop/stop ) // optional rules only block other rules if some part of the if chain tested true. Exe []Execute }
Rule triggers a named series of statements when its filters and phase are satisfied. stopping before the action happens is considered a cancel.
type Runtime ¶
type Runtime interface { // ActivateDomain - objects are grouped into potentially hierarchical "domains". // de/activating makes those groups hidden/visible to the runtime. // Domain hierarchy is defined at assembly time. ActivateDomain(name string) error // GetKindByName -record manipulation. GetKindByName(name string) (*g.Kind, error) // Call - run the pattern defined by the passed record. // passes the expected return because patterns can be called in ambiguous context ( ex. template expressions ) Call(name string, expectedReturn affine.Affinity, keys []string, vals []g.Value) (g.Value, error) // RelativesOf - returns a list, even for one-to-one relationships. RelativesOf(a, relation string) (g.Value, error) // ReciprocalsOf - returns a list, even for one-to-one relationships. ReciprocalsOf(b, relation string) (g.Value, error) // RelateTo - establish a new relation between nouns and and b. RelateTo(a, b, relation string) error // PushScope - modifies the behavior of Get/SetField meta.Variable // by adding a set of variables to the current namespace. // ex. loops add iterators PushScope(Scope) // PopScope - remove the most recently added set of variables from the internal stack. PopScope() // GetField - various runtime objects (ex. nouns, kinds, etc.) store data addressed by name. // the objects and their fields depend on implementation and context. // see package meta for a variety of common objects. GetField(object, field string) (g.Value, error) // SetField - store, or at least attempt to store, a *copy* of the value into the field of the named object. // it can return an error: // if the value is not of a compatible type, // if the field is considered to read-only, // or if there is no object or field of the indicated names. SetField(object, field string, value g.Value) error // PluralOf - turn single words into their plural variants, and vice-versa. // each plural word maps to a unique singular. // for example, if the singular of "people" is "person", it cant also be "personage". PluralOf(single string) string // note: one plural word can map to multiple single words. // in that case the returned singular word is arbitrary ( if theoretically consistent ) // for example, "person" can have the plural "people" or "persons" and this could return either. SingularOf(plural string) string // Random - return a pseudo-random number. Random(inclusiveMin, exclusiveMax int) int // Writer - Return the built-in writer, or the current override. Writer() io.Writer // SetWriter - Override the current writer. SetWriter(io.Writer) (prev io.Writer) }
Runtime environment for an in-progress game.
type Scope ¶
type Scope interface { // note: return g.Unknown if the named field/variable isnt found. FieldByName(field string) (g.Value, error) // note: does not usually copy ( since Runtime does ) SetFieldByName(field string, val g.Value) error // errors if the field doesnt exist SetFieldDirty(field string) error }
Scope - establishes a pool of local variables. Scopes are usually accessed via the runtime Set/GetField.
Directories
¶
Path | Synopsis |
---|---|
Package generic provides implementations of Value for common types.
|
Package generic provides implementations of Value for common types. |
package kindsOf defines a handful of built-in base types for tapestry kinds.
|
package kindsOf defines a handful of built-in base types for tapestry kinds. |
Package meta provides string constants for rt.Runtime Get/SetField.
|
Package meta provides string constants for rt.Runtime Get/SetField. |
Package pattern provides tools for creating and executing functions with guards.
|
Package pattern provides tools for creating and executing functions with guards. |
Package print provides low level routines for styling output.
|
Package print provides low level routines for styling output. |