Reader small image

You're reading from  Learning Game AI Programming with Lua

Product typeBook
Published inNov 2014
Reading LevelBeginner
PublisherPackt
ISBN-139781783281336
Edition1st Edition
Languages
Right arrow
Author (1)
David Young
David Young
Right arrow

Decaying auditory events


Now, we can update our AgentSenses update loop to prune both the bulletImpacts as well as bulletShots entries that are being stored on the blackboard. Pruning out old events prevents Lua from consuming large amounts of data, as both of these event types occur frequently:

AgentSenses.lua:

function AgentSenses_UpdateSenses(
    sandbox, userData, deltaTimeInMillis)

    PruneBlackboardEvents(
        userData.blackboard,
        "bulletImpacts",
        deltaTimeInMillis);
    
    PruneBlackboardEvents(
        userData.blackboard,
        "bulletShots",
        deltaTimeInMillis);
    
    ...

end
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Learning Game AI Programming with Lua
Published in: Nov 2014Publisher: PacktISBN-13: 9781783281336

Author (1)