https://unrealwiki.unrealsp.org/index.php?title=Legacy:MonsterController&feed=atom&action=history
Legacy:MonsterController - Revision history
2024-03-28T11:16:23Z
Revision history for this page on the wiki
MediaWiki 1.34.1
https://unrealwiki.unrealsp.org/index.php?title=Legacy:MonsterController&diff=8065&oldid=prev
imported>Email.rtassoc.com: removed comments on *bot* AI, as they are not the same as *monster* AI, -SuperApe
2007-11-09T13:47:04Z
<p>removed comments on *bot* AI, as they are not the same as *monster* AI, -SuperApe</p>
<p><b>New page</b></p><div>{{classbox| [[Legacy:UT2003|UT2003]] :: [[Legacy:Object|Object]] >> [[Legacy:Actor|Actor]] >> [[Legacy:Controller|Controller]] >> [[Legacy:AIController|AIController]] >> [[Legacy:ScriptedController|ScriptedController]] >> MonsterController (Package: SkaarjPack)}}<br />
<br />
Simple AI that always hunts down players as enemies.<br />
<br />
// note ut2004 monster controller code is just about identical<br />
<br />
// but ut2004 has a problem a serious one the monsters jump though states too fast <br />
<br />
// and will crash the entire game by calling the find new enemy function untill the recursions exceed 10000<br />
<br />
==Properties==<br />
<br />
All MonsterController properties are hidden.<br />
<br />
===Magic numbers===<br />
<br />
(from remark in code) "Distance based, so scale to bot speed/weapon range"<br />
; MAXSTAKEOUTDIST = 2000 (const)<br />
; ENEMYLOCATIONFUZZ = 1200 (const)<br />
; TACTICALHEIGHTADVANTAGE = 320 (const)<br />
; MINSTRAFEDIST = 200 (const)<br />
; MINVIEWDIST = 200 (const)<br />
<br />
===Flags===<br />
; bool bCanFire : Used by TacticalMove and Charging states<br />
; bool bStrafeDir :<br />
; bool bLeadTarget : Lead target with projectile attack<br />
; bool bChangeDir : Tactical move boolean<br />
; bool bEnemyIsVisible :<br />
; bool bMustCharge :<br />
; bool bJustLanded :<br />
; bool bRecommendFastMove :<br />
; bool bHasFired :<br />
; bool bForcedDirection :<br />
<br />
===Advanced AI===<br />
; float AcquireTime : Time at which current enemy was acquired<br />
; float LoseEnemyCheckTime : ''Not implemented.''<br />
; float StartTacticalTime :<br />
; vector HidingSpot :<br />
; float ChallengeTime :<br />
<br />
===Modifiable AI===<br />
; float Accuracy : -1 to 1 (0 is default, higher is more accurate)<br />
; float StrafingAbility : -1 to 1 (higher uses strafing more)<br />
; float CombatStyle : -1 to 1 = low means tends to stay off and snipe, high means tends to charge and melee<br />
; float ReactionTime :<br />
<br />
===Team AI===<br />
; string GoalString : For debugging - used to show what bot is thinking (with 'ShowDebug')<br />
; string SoakString : For debugging - shows problem when soaking<br />
<br />
===Used in ChooseAttackMode() State===<br />
; int ChoosingAttackLevel :<br />
; float ChooseAttackTime :<br />
; int ChooseAttackCounter :<br />
; float EnemyVisibilityTime :<br />
; Pawn VisibleEnemy :<br />
; Pawn OldEnemy :<br />
; float StopStartTime :<br />
; float LastRespawnTime :<br />
; float FailedHuntTime :<br />
; Pawn FailedHuntEnemy :<br />
<br />
===Miscellaneous===<br />
; int NumRandomJumps : Attempts to free monster from being stuck<br />
<br />
==Functions==<br />
<br />
(incomplete)<br />
; Trigger( Actor Other, Pawn EventInstigator ) : If Other is a Pawn and <tt>Pawn.Health >= 0</tt>, calls <tt>SetEnemy( EventInstigator, true )</tt>.<br />
; FightEnemy( bool bCanCharge ) : Decides how to attack: Hunt, StakeOut, Melee, Ranged, etc. Also performs a "teleport" ''(SetLocation() to a PlayerStart)'', if the <tt>FailedHuntTime</tt> is reached and the controlled Pawn not currently seen by the enemy.<br />
; ChooseAttackMode() : Handles tactical attacking state selection - choose which type of attack to do from here.<br />
; bool FindBestPathToward( [[Legacy:Actor|Actor]] A, bool bCheckedReach, bool bAllowDetour ) : Assumes the desired destination is not directly reachable. It tries to set Destination to the location of the best waypoint, and returns true if successful.<br />
; bool NearWall( float walldist ) : Returns true if there is a nearby barrier at eyeheight, and changes FocalPoint to a suggested place to look.<br />
; rotator AdjustAim( [[Legacy:FireProperties|FireProperties]] FiredAmmunition, vector projStart, int aimerror ) : Returns a rotation which is the direction the bot should aim - after introducing the appropriate aiming error.<br />
; bool Formation() : Returns false.<br />
; DoStakeOut() : Switches to state StakeOut.<br />
; DoCharge() : If in WaterVolume and <tt>bCanSwim</tt> is false or if <tt>bCanFly</tt> and <tt>bCanWalk</tt> are false, calls <tt>DoTacticalMove()</tt>. Otherwise, switches to state Charging.<br />
; DoTacticalMove() : Switches to state TacticalMove.<br />
; bool DefendMelee( float Dist ) : Return true if defending against melee attack.<br />
; bool IsStrafing() : Returns false.<br />
; bool IsHunting() : Returns false.<br />
; bool Stopped() : Returns <tt>bPreparingMove</tt>.<br />
; GameHasEnded() : EMPTY<br />
<br />
==States==<br />
<br />
===NoGoal===<br />
: EMPTY<br />
<br />
===RestFormation===<br />
: Ignores EnemyNotVisible(). Calls <tt>WaitForLanding()</tt>.<br />
<br />
====Functions====<br />
; CancelCampFor( Controller C ) : Calls <tt>DirectedWander(Normal(Pawn.Location - C.Pawn.Location))</tt>.<br />
; bool Formation() : Returns true.<br />
; Timer() : Calls <tt></tt> and enables NotifyBump.<br />
; PickDestination() : If <tt>TestDirection(VRand(),Destination)</tt>, return. Otherwise, call <tt>TestDirection(VRand(),Destination)</tt>.<br />
; BeginState() : Sets <tt>Enemy = None</tt>, <tt>Pawn.bCanJump = false</tt>, <tt>Pawn.bAvoidLedges = true</tt>, <tt>Pawn.bStopAtLedges = true</tt>, calls <tt>Pawn.SetWalking(true)</tt> and sets <tt>MinHitWall += 0.15</tt>.<br />
; EndState() : Sets <tt>MonitoredPawn = None</tt> and <tt>MinHitWall -= 0.15</tt>. If <tt>Pawn != None</tt>, sets <tt>Pawn.bStopAtLedges = false</tt> and <tt>Pawn.bAvoidLedges = false</tt>, calls <tt>Pawn.SetWalking(false)</tt> and if <tt>Pawn.JumpZ > 0</tt>, sets <tt>Pawn.bCanJump = true</tt>.<br />
<br />
====Events====<br />
; MonitoredPawnAlert() : Calls <tt>WhatToDoNext(6)</tt>.<br />
; '''''Begin''''' : Calls <tt>WaitForLanding();</tt> ...<br />
; '''''Camping''''' : Sets <tt>Pawn.Acceleration = vect(0,0,0)</tt>, <tt>Focus = None</tt>, <tt>FocalPoint = VRand()</tt>. Calls <tt>NearWall(MINVIEWDIST)</tt>, <tt>FinishRotation()</tt> and <tt>Sleep(3 + FRand())</tt> ...<br />
; '''''Moving''''' : Calls <tt>WaitForLanding()</tt> and <tt>PickDestination()</tt> ...<br />
; '''''WaitForAnim''''' : If <tt>Monster(Pawn).bShotAnim</tt>, calls <tt>Sleep(0.5)</tt> and goes to WaitForAnim. Calls <tt>MoveTo(Destination,,true)</tt>. If <tt>Pawn.bCanFly</tt> and <tt>Physics == PHYS_Walking</tt>, calls <tt>SetPhysics(PHYS_Flying)</tt>. Calls <tt>WhatToDoNext(8)</tt>. Goes to Begin.<br />
<br />
===MoveToGoal===<br />
<br />
===MoveToGoalNoEnemy extends MoveToGoal===<br />
: EMPTY<br />
<br />
===MoveToGoalWithEnemy extends MoveToGoal===<br />
: When Timer() is called, calls <tt>TimedFireWeaponAtEnemy()</tt>.<br />
<br />
===Roaming extends MoveToGoalNoEnemy===<br />
: Ignores EnemyNotVisible.<br />
; '''''Begin''''' : Calls <tt>SwitchToBestWeapon()</tt>, <tt>WaitForLanding()</tt> and <tt>MoveToward(MoveTarget,FaceActor(1),,ShouldStrafeTo(MoveTarget))</tt>.<br />
; '''''DoneRoaming''''' :<br />
<br />
===Charging extends MoveToGoalWithEnemy===<br />
: Ignores SeePlayer and HearNoise.<br />
; '''''Begin''''' :<br />
; '''''WaitForAnim''''' :<br />
; '''''Moving''''' :<br />
<br />
===TacticalMove ===<br />
: Ignores SeePlayer and HearNoise.<br />
; '''''TacticalTick''''' :<br />
; '''''Begin''''' :<br />
; '''''DoMove''''' :<br />
; '''''WaitForAnim''''' :<br />
; '''''DoStrafeMove''''' :<br />
; '''''RecoverEnemy''''' :<br />
; '''''FinishedStrafe''''' :<br />
<br />
===Hunting extends MoveToGoalWithEnemy ===<br />
: Ignores EnemyNotVisible.<br />
; '''''AdjustFromWall''''' :<br />
; '''''Begin''''' :<br />
; '''''WaitForAnim''''' :<br />
; '''''SpecialNavig''''' : <br />
<br />
===StakeOut ===<br />
: Ignores EnemyNotVisible. <br />
; '''''Begin''''' :<br />
<br />
===RangedAttack ===<br />
: Ignores SeePlayer, HearNoise and Bump.<br />
; '''''Begin''''' :<br />
<br />
===WaitForAnim ===<br />
: Ignores SeePlayer, HearNoise, KilledBy, NotifyBump, HitWall, NotifyPhysicsVolumeChange, NotifyHeadVolumeChange, Falling, TakeDamage and ReceiveWarning.<br />
<br />
====Events====<br />
; AnimEnd( int Channel ) : Calls <tt>Pawn.AnimEnd(Channel)</tt>. If <tt>!Monster(Pawn).bShotAnim</tt>, calls <tt>WhatToDoNext(99)</tt>.<br />
<br />
===WaitingForLanding===<br />
<br />
====Functions====<br />
; bool DoWaitForLanding() :<br />
; bool NotifyLanded( vector HitNormal ) :<br />
; Timer() : If <tt>Focus == Enemy</tt>, call <tt>TimedFireWeaponAtEnemy()</tt>, else call <tt>SetCombatTimer()</tt>.<br />
; BeginState() : Set <tt>bJustLanded = false</tt>. If <tt>MoveTarget != None</tt> and <tt>Enemy == None</tt> or <tt>Focus != Enemy</tt>, set <tt>FaceActor(1.5)</tt>. If <tt>Enemy == None</tt> or <tt>Focus != Enemy</tt>, call <tt>StopFiring()</tt>.<br />
<br />
==Related Topics==<br />
* [[Legacy:Monster|Monster]]<br />
* [[Legacy:Controller Overview|Controller Overview]]<br />
* [[Legacy:Artificial Intelligence|Artificial Intelligence]] - Super topic for all AI (bots, Monsters, NPCs, etc)<br />
** [[Legacy:Monster Support|Monster Support]]<br />
<br />
==Discussion==<br />
<br />
'''SuperApe:''' Created. Could use brief definitions of each state. Rest of functions need to be added.<br />
<br />
----<br />
<br />
[[:Category:Legacy Class (UT2003)]]<br />
<br />
[[:Category:Legacy Class (UT2004)]]<br />
<br />
[[:Category:Legacy To Do]] &ndash; Finish state definitions.<br />
[[Category:Legacy Class (UT2003)|{{PAGENAME}}]]<br />
[[Category:Legacy Class (UT2004)|{{PAGENAME}}]]<br />
[[Category:Legacy To Do|{{PAGENAME}}]]</div>
imported>Email.rtassoc.com