Visibility System Overhaul


This article covers the changes made in Empires version 2.39.0 to improve how the game handles entity visibility and networking. The new system is designed to be more efficient, more reliable and more adaptable for future improvements and features.


Table of Contents

Overview

The new visibility system introduces a robust framework for managing how entities interact and become visible to players. At its core are two fundamental components that work in tandem to control entity visibility:

How It Works

Visibility components are processed by a new visibility manager game system.

  • The system continuously evaluates interactions between detectable and detector components and determines if visibility states should be applied.
  • Visibility is determined on a per-entity basis, based on an evaluation of defined factors.
  • Detectable entities are only networked to players if the detectable component has a visibility state greater than “Hidden” or if the player is within a server-defined visibility range of the entity (potentially visible set rules still apply).

Visibility Components

Detectable component

A component added to entities that allows them to be detected by other entities. A detectable component can be in one of four distinct visibility states (see Visibility States), which determine how and when they are revealed to players. When not explicitly assigned a global state, the system determines if the entity should be visible to players based on visibility ranges configured in the server settings.

Visibility timers

Detectable components are designed with an interface for setting timed visibility states. The visibility timer component is used to store the visibility state and the time at which it should expire. This is used for spotting and attacker detection. Visibility timers are processed in order of priority, with the highest priority timer taking precedence. If a timer is active, the detection state is set and the detectable will not be evaluated further by the visibility manager.

Visibility states

A detectable component can be assigned one of the four visibility states below:

StateFunctionalityData networkedNotes
HiddenDetectable entity is hidden to all players unless the player is within visibility range of the entity (potentially visible set rules still apply).Only sent to players within server-defined visibility range of the entity.See Server Settings to check the default visibility ranges for each detectable entity type.
VisibleDetectable entity is visible to all players.YesCurrently not used, but reserved for potential future use.
DetectedDetectable entity is visible to all players and is shown on the enemy mini-map.Yes
SpottedDetectable entity is visible to all players and is shown on the enemy mini-map. Also enables spotting indicators on the HUD for enemy players (orange diamonds).Yes

Network recipient list

The detectable component is designed with an interface for building a list of recipient players that should receive the entity’s data. As a final check within the visibility manager, the recipient list is compiled and used to determine if the entity should be networked to a specific players (potentially visible set rules still apply).

Detector component

A detector component controls detection behavior of an entity. It uses a detection capabilities class, which stores a map of detection profiles.

Detection capabilities

  • The capabilities class is used to store all of the possible detection profiles for a detector component. It acts as an interface to add, remove and query profiles. It is mainly used by the Visibility Manager to determine if a detector should be able to detect a detectable entity.
  • Detection profiles are stored within the capabilities class as a map, the unique key for each profile added to the map is a combination of the detection type and component type. TThis design allows profiles to be added/updated with ease. Example profile with it’s respective key: Area detection profile that targets vehicle detectable components.

Detection profiles

Profiles define the criteria for detection of a specific detection method for a detectable component type:

ProfileDescription
RangeUsed for checking if the detectable is within range of the detector
Team TargetWhich teams that this detector targets
Spot enabledWhether or not this detector should spot the target
DurationDuration of the detection - 0 Default, apply visibility states only while detection method applies.
Motion ThresholdDetectors only detect detectables moving faster than this velocity threshold

Profiles will likely be extended in the future, for example to allow for range multipliers and detection effectiveness multipliers.

Detection methods

These are the available methods of automatic detection via the detector component:

Detection MethodDescription
Area detectionDetects everything within range that matches the detector’s filter criteria (types, team, etc.)
Motion detectionDetects everything moving above a defined speed threshold within range that matches the detector’s filter criteria (types, team, etc.)
Attacker detectionAutomatically reveals attackers that match the detector’s filter criteria (types, team, etc.)

Visibility Manager

The visibility manager is a game system that is responsible for processing all visibility components and determining if visibility states should be applied.

Processing stages

The visibility manager is responsible for processing all visibility components and determining if visibility states should be applied. It does this by:

  1. Checking detectables’ visibility timers. Update visibility state based on the highest priority active timer. Remove any expired timers.
  2. Checking if the detectable is within range of an area detector. Update visibility state accordingly.
  3. Checking if the detectable is within range of a motion detector and moving faster than the defined motion threshold. Update visibility state accordingly.
  4. Checking if the detectable is within range of players, update network recipient list accordingly.

Detection and Spotting Mechanics

Manual spotting

The below outlines the duration of spotting for each type of spotting.

Spot TypeBuildingPlayerVehicle
Regular spotting8 seconds6 seconds6 seconds
Spotting via binoculars2 minutes30 seconds1 minute

Auto detection

The below outlines the various detectors and their detection profiles.

When the table indicates “Active” it means that the detector is actively detecting the entity while its filter criteria is met (no duration is set). Buildings and vehicles use edge-to-edge detection based on their defined collision radius.

Buildings

All buildings have detector components, except for walls - which do not detect other entities. The detectable component on walls has a max visibility state of Visible, this prevents walls from being spotted or displayed on the mini-map.

Building TypeDetection TypeTarget detectable typeTeam TargetVisibility stateDurationRangeMotion Threshold
Engineer cameraMotion detectionPlayerEnemySpotted2 second2,000 units10 units per second
Engineer radarArea detectionBuildingEnemyDetectedActive4,000 unitsN/A
Engineer radarMotion detectionVehicleEnemySpotted2 second4,000 units10 units per second
Engineer RadarArea detectionVehicle CarcassEnemySpottedActive4,000 unitsN/A
RadarArea detectionBuildingEnemy (Detects friendlies if sabotaged)DetectedActive10,000 unitsN/A
RadarArea detectionVehicleEnemy (Detects friendlies if sabotaged)Spotted3 second10,000 unitsN/A
RadarArea detectionVehicle CarcassEnemySpottedActive10,000 unitsN/A
RadarAttacker detectionPlayer & VehicleEnemyDetected5 second2,000 unitsN/A
All other buildingsArea detectionBuildingEnemyDetectedActiveCollision radius + 500 unitsN/A
All other buildingsAttacker detectionPlayer & VehicleEnemyDetected5 secondCollision radius + 500 unitsN/A
All other buildingsMotion detectionVehicleEnemyDetected1 secondCollision radius + 500 units10 units per second

Players

Detection TypeTarget detectable typeTeam TargetVisibility stateDurationRangeMotion Threshold
Area detectionBuildingEnemyDetected1 secondClass specific (see table below)N/A
Area detectionVehicle CarcassEnemyDetectedActiveCollision radius + 2,000 unitsN/A

These are configured within the player class definition script.

ClassBuilding auto-spot range
EngineerCollision radius + 1,000 units
GrenadierCollision radius + 1,000 units
RiflemanCollision radius + 1,000 units
ScoutCollision radius + 2,000 units

Vehicles

Detection TypeTarget detectable typeTeam TargetVisibility stateDurationRangeMotion Threshold
Motion detectionVehicleEnemyDetected1 secondCollision radius + 1,000 units10 units per second
Area detectionVehicle CarcassEnemyDetectedActiveCollision radius + 2,000 unitsN/A

Mini-map

Icon colors

The below outlines all of the detectable entity icon colors drawn on the mini-map. These are applied for each type, in the order they appear in the table.

Entity TypeStateDescription
PlayerFiringBrief white flash when friendly player fire weapons
PlayerTaking damageBrief dark flash when friendly player take damage
PlayerOrdersGreen pulse for 8 seconds when a player issues a radio command
PlayerRevive skillLighter team color
PlayerDeadGray color
VehicleDead (Carcass)Yellow color (This is new, yellow was chosen to match the ‘unbuilt’ state on buildings.)
VehicleFiringBrief white flash when friendly vehicle fire weapons
VehicleTaking damageBrief dark flash when friendly vehicle take damage
VehicleUnoccupiedLighter team color
BuildingTaking damageBrief white flash when friendly building take damage
BuildingUnbuiltYellow color
ALLAnything elseTeam color

Configuration

Server Settings

The below console variables control network visibility range, if the entity is not globally visible:

Console VariableDefault valueDescription
emp_sv_netvisdist_player10,000Distance at which a player will be networked/visible to enemies
emp_sv_netvisdist_vehicle10,000Distance at which a vehicle will be networked/visible to enemies
emp_sv_netvisdist_building10,000Distance at which a building will be networked/visible to enemies

Fixes or changes introduced as a result of this overhaul

Mini-map icon color for player’s with the revive skill is updated more reliably

Due to improvements in how player data is networked, the revive icon color is now more reliable. There were situations in previous versions where the icon color would not be updated correctly.

Scout ‘Enhanced Senses’ skill is more reliable

Enhanced Senses skill has been changed to detect players in range regardless of potentially visible set.

Previously if a player was within range but optimized away due to PVS - they just wouldn’t be detected. That is no longer the case, all players within radius will now be detected.

In practice, this change makes the skill work as originally intended. There were situations where scouts could be missed, despite having the skill; purely because they were not being drawn due to optimization.

Vehicle carcasses are now drawn on the mini-map (Yellow color)

Due to previous limitations enforced on the mini-map, vehicles were no longer drawn once they were destroyed. This limitation has been removed so as an experiment, vehicle carcasses are now detected & displayed.

This change may be subject to change if it is deemed to be detrimental to overall clarity of the mini-map.