O'Reilly logo

Learning Game AI Programming with Lua by David Young

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required