Scoring dangerous areas
The next influence map we'll create is scoring dangerous areas from a team-specific perspective. Using the events that the agents are currently sending out for communication, we can set influence values on the information the team rightfully knows about without resorting to scoring calculations:
SoldierTactics.lua
:
require "AgentSenses" local eventHandlers = {}; local bulletImpacts = {}; local bulletShots = {}; local deadFriendlies = {}; local seenEnemies = {};
Tapping into agent events
Without modifying the existing event system, we can create simple event handlers to store, process, and prune any number of events the agents are already sending. As events are processed differently for the influence map, we store local copies of each event and manage the lifetime of events separately from how agents process them:
SoldierTactics.lua
:
local function HandleBulletImpactEvent(sandbox, eventType, event) table.insert( bulletImpacts, { position =...