Entities
The two entity types in Asteroids, both ballistic: a rock and a bullet. Each is pure data, the constant parameters of its flight, so it is sent once when it appears and never again; the front end and the server both compute its live position from those parameters and the clock. Neither has an update body.
<gamehoster-config-contentRoot>/
game.gamehoster.org/
gamehoster-games/
asteroids/
gamehoster-entities/
bullet/
gamehoster-entity-schema.json
rock/
gamehoster-entity-schema.json
Contents
One folder per entity type; each holds a single parameter schema.
| Name | Type | Description |
|---|---|---|
bullet/ | directory | A fired bullet, ballistic. |
rock/ | directory | A drifting rock, ballistic. |
bullet/
A bullet: where it started (x0/y0), the spawnTick it was fired on, its firing angle and its owner. Every field is public. It stores no velocity. The vx/vy are derived from the angle and the constant bullet speed. The owner is streamed so the server can credit a hit to the player who fired; the front end draws every bullet the same and ignores it. The start position and angle carry min/max/decimals range hints.
[
{
"gamehoster-entity-schema-name": "x0",
"gamehoster-entity-schema-type": "number",
"gamehoster-entity-schema-default": 0,
"gamehoster-entity-schema-visibility": "public",
"gamehoster-entity-schema-min": 0,
"gamehoster-entity-schema-max": 3600,
"gamehoster-entity-schema-decimals": 1
},
{
"gamehoster-entity-schema-name": "y0",
"gamehoster-entity-schema-type": "number",
"gamehoster-entity-schema-default": 0,
"gamehoster-entity-schema-visibility": "public",
"gamehoster-entity-schema-min": 0,
"gamehoster-entity-schema-max": 2400,
"gamehoster-entity-schema-decimals": 1
},
{
"gamehoster-entity-schema-name": "spawnTick",
"gamehoster-entity-schema-type": "tick",
"gamehoster-entity-schema-default": 0,
"gamehoster-entity-schema-visibility": "public"
},
{
"gamehoster-entity-schema-name": "angle",
"gamehoster-entity-schema-type": "number",
"gamehoster-entity-schema-default": 0,
"gamehoster-entity-schema-visibility": "public",
"gamehoster-entity-schema-min": -3.15,
"gamehoster-entity-schema-max": 3.15,
"gamehoster-entity-schema-decimals": 3
},
{
"gamehoster-entity-schema-name": "owner",
"gamehoster-entity-schema-type": "string",
"gamehoster-entity-schema-default": "",
"gamehoster-entity-schema-visibility": "public"
}
]
rock/
A rock: where it started (x0/y0), its velocity (vx/vy), the spawnTick it appeared on, its starting rotation rot0 and spin, its size, its radius r and its shape seed. Every field is public and streamed, so the front end and the server derive the same live position and outline. Every bounded field carries min/max range hints, and floats carry decimals.
[
{
"gamehoster-entity-schema-name": "x0",
"gamehoster-entity-schema-type": "number",
"gamehoster-entity-schema-default": 0,
"gamehoster-entity-schema-visibility": "public",
"gamehoster-entity-schema-min": 0,
"gamehoster-entity-schema-max": 3600,
"gamehoster-entity-schema-decimals": 1
},
{
"gamehoster-entity-schema-name": "y0",
"gamehoster-entity-schema-type": "number",
"gamehoster-entity-schema-default": 0,
"gamehoster-entity-schema-visibility": "public",
"gamehoster-entity-schema-min": 0,
"gamehoster-entity-schema-max": 2400,
"gamehoster-entity-schema-decimals": 1
},
{
"gamehoster-entity-schema-name": "vx",
"gamehoster-entity-schema-type": "number",
"gamehoster-entity-schema-default": 0,
"gamehoster-entity-schema-visibility": "public",
"gamehoster-entity-schema-min": -3,
"gamehoster-entity-schema-max": 3,
"gamehoster-entity-schema-decimals": 2
},
{
"gamehoster-entity-schema-name": "vy",
"gamehoster-entity-schema-type": "number",
"gamehoster-entity-schema-default": 0,
"gamehoster-entity-schema-visibility": "public",
"gamehoster-entity-schema-min": -3,
"gamehoster-entity-schema-max": 3,
"gamehoster-entity-schema-decimals": 2
},
{
"gamehoster-entity-schema-name": "spawnTick",
"gamehoster-entity-schema-type": "tick",
"gamehoster-entity-schema-default": 0,
"gamehoster-entity-schema-visibility": "public"
},
{
"gamehoster-entity-schema-name": "rot0",
"gamehoster-entity-schema-type": "number",
"gamehoster-entity-schema-default": 0,
"gamehoster-entity-schema-visibility": "public",
"gamehoster-entity-schema-min": 0,
"gamehoster-entity-schema-max": 6.29,
"gamehoster-entity-schema-decimals": 2
},
{
"gamehoster-entity-schema-name": "spin",
"gamehoster-entity-schema-type": "number",
"gamehoster-entity-schema-default": 0,
"gamehoster-entity-schema-visibility": "public",
"gamehoster-entity-schema-min": -0.1,
"gamehoster-entity-schema-max": 0.1,
"gamehoster-entity-schema-decimals": 3
},
{
"gamehoster-entity-schema-name": "size",
"gamehoster-entity-schema-type": "int",
"gamehoster-entity-schema-default": 3,
"gamehoster-entity-schema-visibility": "public",
"gamehoster-entity-schema-min": 1,
"gamehoster-entity-schema-max": 3
},
{
"gamehoster-entity-schema-name": "r",
"gamehoster-entity-schema-type": "int",
"gamehoster-entity-schema-default": 46,
"gamehoster-entity-schema-visibility": "public",
"gamehoster-entity-schema-min": 14,
"gamehoster-entity-schema-max": 46
},
{
"gamehoster-entity-schema-name": "seed",
"gamehoster-entity-schema-type": "int",
"gamehoster-entity-schema-default": 0,
"gamehoster-entity-schema-visibility": "public",
"gamehoster-entity-schema-min": 0,
"gamehoster-entity-schema-max": 1000000
}
]