Skip to content

Conversation

@daveey
Copy link
Contributor

@daveey daveey commented Dec 25, 2025

TL;DR

Added Area of Effect (AOE) resource effects to grid objects, allowing objects to emit resource effects to agents within a configurable range.

What changed?

  • Added AOEEffectConfig class to configure resource effects with a range and resource deltas
  • Extended GridObjectConfig with an optional AOE configuration
  • Implemented AOEHelper class to manage AOE effects for grid objects
  • Added CellEffect struct to track accumulated resource effects at each grid cell
  • Modified Grid class to track and apply AOE effects across the grid
  • Updated object initialization to support AOE effects in walls, chests, and assemblers
  • Added Python bindings for the new AOE functionality
  • Implemented proper cleanup of AOE effects when objects are removed

How to test?

  1. Create a grid object with AOE effects:
from mettagrid.config import AOEEffectConfig, WallConfig

# Create a healing station that gives +1 health per tick
healing_station = WallConfig(
    map_name="healing_station",
    aoe=AOEEffectConfig(
        range=2,  # Manhattan distance of 2
        resource_deltas={"health": 1}  # +1 health per tick
    )
)
  1. Place the object in your environment and observe agents within range receiving the configured resource effects each tick.

  2. Test different ranges and resource combinations, including negative values for resource depletion effects.

Why make this change?

This feature enables more dynamic environments where grid objects can passively affect nearby agents. It supports a variety of gameplay mechanics such as:

  • Healing stations that restore health to nearby agents
  • Toxic areas that drain resources
  • Resource generators that provide benefits to agents in proximity
  • Environmental hazards with area effects
  • Support for territory control mechanics where objects provide benefits to agents in controlled areas

This creates richer strategic gameplay where positioning relative to these effect-emitting objects becomes important.

Copy link
Contributor Author

daveey commented Dec 25, 2025

@daveey daveey changed the title Add AOE effects to grid objects Add Area of Effect (AOE) resource effects to grid objects Dec 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants