Team communications
So far, team communication has revolved around agent visibility; we can now extend these communications to include behavioral logic selections such as new enemy selection, position updates, and retreat positions.
The EnemySelection event
To coordinate attacks, our agents need to notify their teammates when they've selected a new enemy. Sending out an event when a new enemy is being pursued requires you to add a new EventType
string. With a specific EventType
, we can create a wrapper function that will message the team about the enemy:
AgentCommunications.lua
:
AgentCommunications.EventType.EnemySelection = "EnemySelection";
SoldierActions.lua
:
local function SendEnemySelection(sandbox, agent, enemy) AgentCommunications_SendTeamMessage( sandbox, agent, AgentCommunications.EventType.EnemySelection, { agent = agent }); end function SoldierActions_PursueInitialize(userData) ... userData.controller...