Skip to content

Pieces and actors

import { Aside } from ‘@astrojs/starlight/components’;

You need a player character on the harbor tile, a tavern keeper inside the tavern, and three hostile bandits camped on the road. Each has a different role flag + collision profile + interaction behavior.

import { registerGameboardActor, spawnGameboardActor } from 'declarative-hex-worlds/actors';
const player = registerGameboardActor(world, {
id: 'player:you',
kind: 'player',
tileKey: '4,2',
team: 'players',
});
const tavernKeeper = registerGameboardActor(world, {
id: 'npc:keeper',
kind: 'npc',
tileKey: '1,4',
team: 'neutrals',
});
const bandit = registerGameboardActor(world, {
id: 'enemy:bandit-1',
kind: 'npc',
tileKey: '5,3',
team: 'bandits',
hostility: { towards: ['players', 'neutrals'] },
});
  • Trait composition. Each actor gets GameboardActor + (IsPlayerActor | IsNpcActor | IsPropActor) + (IsHostileActor if applicable) traits.
  • Team-based queries. HostileActorQuery returns just the bandits relative to the player.
  • Tile occupancy. Spawn refuses to place an actor on a tile that has a blocking placement.