Move towards incorporating sound into ai

This commit is contained in:
2021-09-08 17:41:13 +01:00
parent 45bbf9b005
commit 643cd5a420
25 changed files with 150 additions and 144 deletions
+31 -4
View File
@@ -10,7 +10,8 @@ import Dodge.Data
import Dodge.Item.Data
import Dodge.Creature.Stance.Data
import Dodge.Creature.State.Data
import Dodge.Creature.AlertLevel.Data
import Dodge.Creature.Perception.Data
import Dodge.Creature.Memory.Data
import Dodge.SoundLogic
import Dodge.Picture.Layer
import Geometry
@@ -49,16 +50,42 @@ defaultCreature = Creature
,_strideLength = 40
}
, _crActionPlan = ActionPlan [] [] WatchAndWait [LiveLongAndProsper]
, _crPerception = defaultPerceptionState
, _crMemory = defaultCreatureMemory
, _crMeleeCooldown = 0
, _crAwakeLevel = Vigilant
, _crAttentionDir = AttentiveTo IM.empty
, _crAwarenessLevel = IM.empty
, _crFaction = NoFaction
, _crTarget = Nothing
, _crMvTarget= Nothing
, _crGroup = LoneWolf
, _crMvType = defaultAimMvType
}
defaultCreatureMemory :: MemoryState
defaultCreatureMemory = MemoryState
{ _soundsToInvestigate = []
}
defaultPerceptionState :: PerceptionState
defaultPerceptionState = PerceptionState
{ _crAwakeLevel = Lethargic
, _crAttentionDir = AttentiveTo IM.empty
, _crAwarenessLevel = IM.empty
, _crVision = defaultVision
, _crAudition = defaultAudition
}
defaultVision :: Vision
defaultVision = Eyes
{ _viFOV = f
, _viDist = g
}
where
f x | abs x < 0.5 * pi = 1
| otherwise = 0
g x | x > 500 = 0
| otherwise = 1
defaultAudition :: Audition
defaultAudition = Ears
{ _auDist = \x -> 1 / (x * x)
}
defaultChaseMvType :: CrMvType
defaultChaseMvType = ChaseMvType
{ _mvSpeed = 3