anchorWorld Marker & Anchor for Minimap

RTS World Anchor System

The RTS World Anchor System provides a way to integrate non-agent objects (buildings, towers, objectives, waypoints) with the Enemy Masses RTS features like Fog of War and Minimap. It consists of two components that work together:

  • EnemyMassesRTSWorldAnchor – Marks individual objects that should appear on the minimap and/or reveal fog

  • EnemyMassesRTSWorldMarker – Defines the visibility and fog rules for a group of anchors


Why This System Exists

In RTS games, you typically have many objects beyond just units that need to interact with the fog of war and minimap systems:

Object Type
Fog Behavior
Minimap Behavior

Player Buildings

Reveal fog around them

Always visible

Enemy Buildings

Don't reveal fog

Only visible when not in fog

Neutral Objectives

May or may not reveal fog

Often always visible

Watchtowers

Reveal large fog radius

Always visible

Resource Nodes

Don't reveal fog

Visible based on discovery

Without this system, you'd need to write custom code for each object type. The World Anchor System provides a unified, configurable solution that:

  1. Centralizes rules – Define visibility rules once on a parent object (World Marker), and all child anchors inherit them

  2. Supports factions – Different behavior for friendly, enemy, and neutral objects

  3. Integrates with Fog of War – Anchors can reveal fog and respect fog visibility for minimap display

  4. Works with the Minimap – Anchors automatically register with the minimap system


When to Use This System

Use the World Anchor System when you have:

  • Static buildings that should reveal fog and appear on the minimap

  • Defensive structures (towers, turrets) that provide vision

  • Objectives or capture points that players need to see

  • Neutral structures that become visible when discovered

  • Any non-agent object that needs fog/minimap integration

circle-info

This system is for static or semi-static world objects. For moving units controlled by Enemy Masses, the RTS controller handles fog and minimap integration automatically.


Architecture Overview

The World Marker acts as a rules provider for all World Anchors in its hierarchy. Anchors automatically find their parent marker and query it for visibility rules.


Setup Guide

Step 1: Add a World Marker (Rules Provider)

The World Marker defines the rules for how anchors behave based on their faction.

  1. Create or select a parent GameObject that will contain your anchors (e.g., "PlayerBase" or "EnemyBase")

  2. Add the EnemyMassesRTSWorldMarker component:

    • Add Component → Enemy Masses → RTS → World Marker

World Marker Settings

Section
Property
Description

Minimap Visibility Rules

Friendly Visibility

When player-controlled anchors appear on minimap

Enemy Visibility

When enemy anchors appear on minimap

Neutral Visibility

When neutral anchors appear on minimap

Fog Reveal Rules

Reveal Fog For Friendly

Allow player anchors to reveal fog

Reveal Fog For Enemy

Allow enemy anchors to reveal fog (usually false)

Reveal Fog For Neutral

Allow neutral anchors to reveal fog

Fog Visibility

Fog Provider Override

Optional reference to your fog system

Fog Visibility Threshold

Alpha threshold for "visible" (lower = stricter)

Visibility Rule Options

Rule
Behavior

Always

Anchor always appears on minimap regardless of fog

OnlyWhenVisible

Anchor only appears when not covered by fog

Never

Anchor never appears on minimap

Step 2: Add World Anchors to Objects

For each object that should participate in fog/minimap:

  1. Select the GameObject (building, tower, etc.)

  2. Add the EnemyMassesRTSWorldAnchor component:

    • Add Component → Enemy Masses → RTS → World Anchor

World Anchor Settings

Section
Property
Description

Anchor

Anchor

Optional transform for position (defaults to this transform)

Faction

Faction

PlayerControlled, Enemy, or Neutral

Minimap

Minimap Color

Color of this anchor's icon on the minimap

Fog of War

Fog Reveal Radius

Radius in world units that this anchor reveals

Rules

Rules Provider

Optional explicit reference to a World Marker

Auto Find Rules Provider

Search parents for a World Marker automatically

Position Offset

Position Offset

Offset from anchor transform for fog/minimap position

Gizmos

Show Gizmos

Display fog reveal radius in Scene view


Example Configurations

Example 1: Player Base

A player-controlled base where all buildings reveal fog and appear on the minimap.

World Marker Settings:

  • Friendly Visibility: Always

  • Enemy Visibility: OnlyWhenVisible

  • Neutral Visibility: Always

  • Reveal Fog For Friendly:

  • Reveal Fog For Enemy:

  • Reveal Fog For Neutral:

World Anchor Settings (per building):

  • Faction: PlayerControlled

  • Fog Reveal Radius: 15 (main building), 8 (barracks), 25 (watchtower)

Example 2: Enemy Base

An enemy base that doesn't reveal fog and only shows on minimap when discovered.

World Marker Settings:

  • Friendly Visibility: Always

  • Enemy Visibility: OnlyWhenVisible

  • Neutral Visibility: Always

  • Reveal Fog For Friendly:

  • Reveal Fog For Enemy:

  • Reveal Fog For Neutral:

World Anchor Settings (per building):

  • Faction: Enemy

  • Fog Reveal Radius: 0 (no fog reveal)

Example 3: Neutral Capture Point

A neutral objective that's always visible but doesn't reveal fog until captured.

World Marker Settings:

  • Neutral Visibility: Always

  • Reveal Fog For Neutral:

World Anchor Settings:

  • Faction: Neutral

  • Fog Reveal Radius: 0

When captured, change the faction via script:


Scripting API

EnemyMassesRTSWorldAnchor

EnemyMassesRTSWorldMarker

Changing Faction at Runtime


Integration with Other Systems

Fog of War Integration

The World Anchor System integrates with fog of war through two interfaces:

  • IRTSFogRevealer – Allows anchors to reveal fog

  • IFogVisibility – Allows the marker to query fog state

Anchors automatically register with the RTSWorldUnitRegistry when enabled, and the fog system reads from this registry.

Minimap Integration

Anchors implement IRTSMinimapIcon and register with the RTSWorldUnitRegistry. The minimap controller queries this registry to display icons.


Best Practices

circle-check
circle-check
circle-exclamation
circle-info

Fog Visibility Threshold: Lower values (like 32) mean anchors hide more quickly as fog rolls back in. Higher values (like 128) keep anchors visible longer during refogging. Adjust based on your fog speed.


Troubleshooting

Anchor not appearing on minimap

  1. Check that the anchor's faction matches the visibility rules

  2. Verify the World Marker's visibility rule isn't set to Never

  3. If using OnlyWhenVisible, ensure the area is revealed by fog

Anchor not revealing fog

  1. Check that Fog Reveal Radius is greater than 0

  2. Verify the World Marker has "Reveal Fog For [Faction]" enabled

  3. Ensure a fog of war system is present in the scene

Anchor not finding its World Marker

  1. Make sure Auto Find Rules Provider is enabled

  2. Ensure the World Marker is on a parent or in the same hierarchy

  3. Try manually assigning the Rules Provider reference


See Also

  • Fog of War System – How fog of war works

  • Minimap Controller – Minimap configuration

  • RTS Controller – Main RTS control system

Last updated