Renvix Assets

Teams

A team is a number that connects the components that see with the components that show what was seen.

ComponentSettingMeaning
Vision SourceTeamWhich team this source sees for
Fog Of WarTeamOpened by sources of this team
Fog HiderShown To TeamThe object is visible while a source of this team sees it

Vision Perception does not use teams. Each observer notices any Vision Target on its Notices Layers, through its own source.

A typical setup

TeamWhy
Player and allied units0 (Player)They reveal the player's fog
Fog Of War0Shows what the player's team sees
Fog Hider on enemies, itemsShown To Team 0Visible only while the player's team sees them
Guards and enemy units1 (Enemies)They see for their own team, so they do not open the player's fog

The enemies' team does not need a Fog Of War. Their sources still see, and Vision Perception still works.

Several teams

Each Fog Of War has its own memory of explored areas. For a game where the view switches between teams, such as hot seat, a replay or a spectator mode, create one Fog Of War per team and enable only the one being shown. Fog Hiders change with FogHider.ViewerTeam.

Units that share vision, such as allies in a co-op game, simply use the same team.

Team names

Names for the team numbers are set in Project Settings > Vision Fog Teams. They appear in the Team dropdowns of the Inspectors, and the dropdown has an Edit Team Names... entry that opens the settings. The defaults are Player, Enemies, Allies and Neutral.

Project Settings > Vision Fog Teams with the list of team names and the Add Team button; next to it a Team dropdown in a Vision Source Inspector.

Names are only for the Editor: at runtime a team is just its number. They are stored in ProjectSettings/VisionFogTeams.asset, so they are shared through version control. Only the last team can be removed, so the numbers of the other teams never change.

Checking visibility for a team

To ask whether a team sees a point, for example to show a ping on the minimap only when it is visible, use:

bool visible = VisionSystem.IsVisibleToTeam(0, worldPosition);

It uses the latest result of every source of that team, the same data the fog and the hiders use.