Gather component (registered as "Gather") allows BasicMobileAgent instances to navigate the world grid in four cardinal directions and automatically collect resources when they land on populated resource tiles. Movement and collection each incur a configurable labor cost, and agents can optionally have heterogeneous collection skills sampled from statistical distributions.
The class name is
Gather and its registry name is "Gather". It applies only to agents of subclass BasicMobileAgent.Constructor parameters
float
default:"1.0"
Labor cost incurred each time an agent successfully moves to an adjacent tile. Must be
>= 0.float
default:"1.0"
Additional labor cost incurred on top of movement cost when the agent lands on a tile containing a resource and triggers collection. Must be
>= 0.string
default:"none"
Distribution used to sample each agent’s
bonus_gather_prob at episode reset.Action space
This component adds 4 discrete movement actions for eachBasicMobileAgent:
Movement and resource collection
On each timestep the component iterates over all agents in a random order and:- Resolves the chosen direction by calling
world.set_agent_loc(). If the target tile is occupied or out of bounds the agent stays put. - Charges
move_labortoagent.state["endogenous"]["Labor"]if the agent actually moved. - Checks every resource at the agent’s final tile via
world.location_resources(). - For each resource with
health >= 1, collects1unit (or2ifrand() < agent.state["bonus_gather_prob"]), callsworld.consume_resource(), and chargescollect_labor.
Coin, House, Labor.
Collection skill
Each agent carries abonus_gather_prob state field (float in [0, 1]). When this value is non-zero, each collection event has a chance of yielding an extra unit of the resource at no extra labor cost.
Skills are re-sampled at the start of every episode via additional_reset_steps():
reset skill sampling
Observations
Each agent observes its own collection skill. The planner receives nothing from this component.float
The agent’s probability of collecting a bonus resource unit on each gather event. Keyed by agent index string.
Action masks
Generated every step, the mask for each of the 4 movement directions is1 only if the target tile is both unoccupied and accessible (according to world.maps.unoccupied and world.maps.accessibility). No-op (index 0) is always allowed.
Dense log
get_dense_log() returns a list of gather events — one list per timestep. Each gather event is a dict:
int
Index of the agent that collected the resource.
string
Name of the collected resource (e.g.,
"Wood", "Stone").int
Number of units collected (
1 or 2).list
[row, col] of the tile where collection occurred.