Instance
Gamehoster.Instance is the one view of the
instance you are in: the shared state of the match, its instance schema
fields eased for this frame at the top level, with the raw samples and a persistent bag underneath.
The instance view
| Member | Holds |
|---|---|
| fields | each instance schema field, eased for this frame, at the top level (e.g.
Gamehoster.Instance.wave, Gamehoster.Instance.rocksLeft). |
.current | the newest authoritative sample, un-interpolated. |
.prev | the previous sample. |
.data | the instance's front-end persistent bag, kept for the whole match. |
var wave = Gamehoster.Instance.wave
var advanced = Gamehoster.Instance.current.wave !== Gamehoster.Instance.prev.wave
if (advanced) Gamehoster.Instance.data.flashUntil = Gamehoster.Frame.time + 0.5
The instance bodies
Three client-only bodies sit beside the instance schema and shape the one instance view. Each is optional.
| Body | When it runs | For |
|---|---|---|
gamehoster-instance-enter.js |
when you join | Seed the instance's .data bag as the instance first comes into view. |
gamehoster-instance-smooth.js |
each frame | Shape how a field eases between authoritative samples, or override one outright. |
gamehoster-instance-exit.js |
when the instance leaves your view | Tidy up anything the instance's bag held. |
Gamehoster.Persist.Set('flashUntil', 0)
Gamehoster.Persist.Set('shake', 0)
Gamehoster.Persist.Set; the render reads it back as Gamehoster.Instance.data.