Skip to main content
The Build component (registry name "Build") allows BasicMobileAgent instances to spend one unit each of Wood and Stone to construct a House landmark on their current tile, receiving a coin payment in return. Building has a configurable labor cost and supports heterogeneous skill levels that modify each agent’s payout.
The agent must be standing on an empty tile — no existing landmark or resource — and must possess the required resources in their inventory before the build action takes effect.

Constructor parameters

int
default:"10"
Base amount of Coin an agent receives for successfully building a house. Must be >= 0.
int
default:"1"
Upper bound on the skill multiplier applied to payment. Must be >= 1. When set above 1, skilled agents can earn up to payment * payment_max_skill_multiplier per build.
string
default:"none"
Distribution used to sample each agent’s build skill at episode reset.
float
default:"10.0"
Labor units charged to agent.state["endogenous"]["Labor"] each time a house is successfully built. Must be >= 0.

Resource cost

Building a house always consumes exactly: These costs are fixed and defined in self.resource_cost = {"Wood": 1, "Stone": 1}. Required world entities: Wood, Stone, Coin, House, Labor.

Action space

This component adds 1 discrete action for each BasicMobileAgent:

Building sequence

When an agent takes action 1, component_step() calls agent_can_build() to verify all preconditions, then:
  1. Deducts 1 Wood and 1 Stone from the agent’s inventory.
  2. Calls world.create_landmark("House", row, col, agent.idx) to place the landmark.
  3. Adds agent.state["build_payment"] (the skill-adjusted coin amount) to the agent’s inventory.
  4. Charges build_labor to agent.state["endogenous"]["Labor"].

Build preconditions

agent_can_build() returns True only when all three conditions hold:
  • The agent has >= 1 Wood in inventory.
  • The agent has >= 1 Stone in inventory.
  • The current tile contains no existing resource or landmark.

Agent state fields

This component adds the following state fields to every BasicMobileAgent:
float
Effective coin payout for the next build action. Initialized to payment and updated each episode reset according to the sampled skill multiplier.
float
Raw sampled skill value (before clamping). Initialized to 1.

Observations

Agents observe their own normalized build skill. The planner receives nothing from this component.
float
Agent’s current build_payment normalized by the base payment value.
float
The raw sampled skill value stored in sampled_skills[agent.idx].

Action masks

The single build action is masked to 0 whenever agent_can_build() returns False (insufficient resources or tile already occupied). It is unmasked (1) otherwise.

Metrics

get_metrics() returns a dict with per-agent build counts and a total:
int
Number of successful builds by this agent over the episode.
int
Total number of House landmarks currently on the map (world.maps.get("House") > 0).

Dense log

get_dense_log() returns a list (one entry per timestep) of build-event lists. Each build event is a dict:
int
Agent index that performed the build.
ndarray
[row, col] location where the house was placed.
float
Coin payment received for this build.

Skill sampling

At every episode reset additional_reset_steps() re-samples each agent’s skill:
skill sampling

Example usage