Kraven Manor is a first-person, survival-horror game set in a dark and haunted manor.
The player has the power to dynamically alter the layout by interacting with a miniature scale model of the manor, located in its extravagant entryway.
Reviews
- Gamespot: House of Horrors – Kraven Manor
- Alienware Arena: “plays better, looks better, and ultimately scares better than the vast majority of horror games”
- Creepy Gaming: Kraven Manor, when AAA quality meets horror indie games.
- Jayisgames: Kraven Manor possesses some of the best atmosphere around.
Postmortem
What Went Well
- I succeeded in iterating several times on gameplay components – allowing for polish.
- I stayed ahead of designers in terms of implementing design tools and game components to a usable state before the designers actually needed them.
- My estimated schedule for components I was responsible for implementing was less than actual development time – allowing for more iteration/polish.
What Went Wrong
- My tests were not elaborate enough to match the use of some my components in the actual game.
- For some tough bugs, I initially panicked and resorted to trial and error bug fixing instead of taking the time to critically think about the cause of the problem – this ultimately wasted more time than simply doing the latter first.
- In some cases, I failed to properly document the implementation and use of components and tools I made which led to spending more time than necessary educating team members on their use.
What I Learned
- Spend the extra time to create elaborate tests that closely match the final gameplay early on. Better yet, involve designers and motivate them to create a whitebox level that tests the core gameplay components very early.
- Document tools and components right away and submit to users for feedback. As soon as first pass implemented, schedule time to walk users through implementation and how to use. This also serves as a great opportunity to gather feedback to iterate.
- Any time faced with a tough bug, step back and take the time to properly understand the problem and isolate the root cause.
Project Contribution
- Collaborated with designers to specify game-play systems.
- Implemented Artificial Intelligence systems.
- Implemented enemy animation systems.
- Implemented core shifting room mechanic.
- Implemented interactive objects and possessed objects systems.
- Created tools for designers (Kismet actions and events).
Source Code
Below is the source code for an AI Controller: Fred, the code-name for one of the enemy statue types.
- Archetyped the class to expose all public data to designers.
- UDK’s Navigation Mesh used for path finding.
- Worked with designers to generate good nav-meshes.
- HandleBeingStuck() implemented to nudge the AI pawn to a better location when stuck.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 |
/************************************************************************************************ * Copyright (c) 2012-2013 The Guildhall at Southern Methodist University. All Rights Reserved. * ---------------------------------------------------------------------------------------------- * Kraven Manor * Demon Wagon Studios, Cohort 18 * * @Author: Warsam Osman * * ---------------------------------------------------------------------------------------------- * @Updated: 06/10/2013 * @File: KM_Fred.uc * @Brief: Fred - codename for statue that chases player and launches ghosts at her. ************************************************************************************************/ class KM_Fred extends KM_AIController placeable; // placeable only so LDs can create archetypes ////////////////////////////////////////////////////////////////////////////////////////////////// // Public Class Variables ////////////////////////////////////////////////////////////////////////////////////////////////// var(FredController) public float AttackRange; var(FredController) public float DamageToPlayerPerTick; var(FredController) public float PlayerDetectionRadius; var(FredController) public float AttackCoolDownSeconds; var(FredController) public int AttackAfterTeleportCoolDown; var(FredController) public bool IsFrozen; var(FredController) public int TriggerTeleportAfterNumLooks; var(FredController) public float DeathDelay; var(Ghost) public float SecondsToWaitBeforeFiring; var(Ghost) public int GhostDamageToPlayerOnTouch; var(Ghost) public float SecondsToFlickerFlashLight; var(Ghost) public float SecondsToKeepFlashLightOff; var(Ghost) public float PositionOffsetAbovePlayerToSpawn; var(Ghost) public float WindUpTime; var(Ghost) public float GhostSpeed; var(Ghost) public float GhostMaxSpeed; var(Ghost) public float GhostAccelerationRate; ////////////////////////////////////////////////////////////////////////////////////////////////// // Private Class Variables ////////////////////////////////////////////////////////////////////////////////////////////////// var private KM_GhostProjectile m_spawnedGhostProjectile; var private float m_attackRangeSq; var private Vector m_locationLastFrame; var private Vector m_nextDestination; var private ParticleSystem m_CustomFX, m_FxTakeDamage; var private ParticleSystemComponent m_PSC,m_PSCTakeDemage, m_windupEmitter; var private bool m_bStatueEnabled; var private bool m_bGhostInFlight; var private bool m_bDebug; var private bool m_bReadyToAttack; var private bool m_bReadyToShootGhost; var private float m_timeToSpendRecoveringWhileStuck; var private bool m_bStuck; var private float m_stuckCheckDistance; var private float m_distanceToTeleportSq; ////////////////////////////////////////////////////////////////////////////////////////////////// // Events / Functions ////////////////////////////////////////////////////////////////////////////////////////////////// event PostBeginPlay() { super.PostBeginPlay(); m_attackRangeSq = AttackRange * AttackRange; } function bool IsWithinAttackRangeOfEnemy() { if( Pawn == None ) return false; return VSizeSq( GetEnemy().Location - Pawn.Location ) < m_attackRangeSq; } //Fast trace pawn collision extent to check for clear path to destination function bool CanReachDestination( Vector checkDestination ) { local Vector pathCollisionExtent; if( Pawn == None ) return false; GetPawnCollisionExtent( pathCollisionExtent ); //Check if line of sight if( !FastTrace( checkDestination, Pawn.Location, pathCollisionExtent ) ) return false; return true; } function KM_Pawn GetEnemyWithinDetectRadius() { local KM_Pawn playerPawn; if( Pawn == None ) return None; foreach OverlappingActors( class'KM_Pawn', playerPawn, PlayerDetectionRadius, Pawn.Location ) { return playerPawn; } return None; } // Create the pawn collision extent function GetPawnCollisionExtent( out Vector pawnCollisionExtent ) { if( Pawn == None ) return; pawnCollisionExtent.X = Pawn.GetCollisionRadius(); pawnCollisionExtent.Y = Pawn.GetCollisionRadius(); pawnCollisionExtent.Z = Pawn.GetCollisionHeight(); } //Globes are ignored as design advocates for Fred to shoot at a globe if player is on other side of it. //Note: it is intended the globe to be hit even if there is obstruction between the globe and player function bool HasLineOfSightToPlayerIgnoringGlobes( optional Vector Extent = vect( 30.0, 30.0, 30.0 ) ) { local Actor HitActor; local Vector HitLocation, HitNormal; local Vector StartShot, EndShot; local TraceHitInfo HitInfo; // Perform a trace to find what the player is looking at StartShot = Pawn.Location; StartShot.Z += PositionOffsetAbovePlayerToSpawn; EndShot = GetEnemy().Location; HitActor = Trace(HitLocation, HitNormal, EndShot, StartShot, True, Extent, HitInfo, TRACEFLAG_Bullet ); if( m_bDebug ) { DrawDebugLine(Pawn.Location,HitActor.Location,0,255,0,true); DrawDebugSphere(HitActor.Location,16,20,0,255,0,true); } if( HitActor == Self ) return false; else if( HitActor.IsA( 'KM_Pawn') ) return true; else if( HitActor.IsA( 'KM_Globe') ) return true; return false; } //Swing open unlocked doors when chasing the player. function DetectAndAttemptOpenDoor( Vector checkDestination ) { local Actor HitActor; local Vector HitLocation, HitNormal, pathCollisionExtent, StatueFacingTarget; local Vector endLoc; local KM_InterpDoor theDoor; local KM_Door DoorOwner; if( Pawn == None ) return; GetPawnCollisionExtent( pathCollisionExtent ); StatueFacingTarget = Normal( checkDestination - Pawn.Location ); endLoc = Pawn.Location + ( StatueFacingTarget * ( Pawn.GetCollisionRadius() + 5.0 ) ); //Magic so trace hits when adjacent to door. foreach TraceActors(class'Actor', HitActor, HitLocation, HitNormal, endLoc, Pawn.Location, pathCollisionExtent) { theDoor = KM_InterpDoor(HitActor); if( theDoor == None ) continue; DoorOwner = theDoor.DoorFrame; if( DoorOwner == None ) continue; if( !DoorOwner.IsDoorLocked() && !DoorOwner.IsDoorOpen() ) theDoor.DoorFrame.SetIsDoorOpen( true,, Pawn ); } } //Stops pawn moving towards final destination and stops it moving function StopMovement() { if( Pawn == None ) return; Pawn.Acceleration = vect(0,0,0); } function SetFrozen( bool frozen ) { IsFrozen = frozen; } function SetFireGhostReady() { m_bReadyToShootGhost = true; } function AttemptFireGhostAtPlayer() { local ParticleSystem windupFx; local Vector SpawnPosition; if( m_bGhostInFlight || !m_bReadyToShootGhost ) return; if( !IsInFlashLightBeam() ) return; //Check if there is clear LOS to player if( HasLineOfSightToPlayerIgnoringGlobes() ) { m_bReadyToShootGhost = false; SpawnPosition = Pawn.Location; SpawnPosition.Z += PositionOffsetAbovePlayerToSpawn; //Play windup particle windupFx = ParticleSystem'KM_Ghost.Particles.KM_P_GhostWindUp'; m_windupEmitter = WorldInfo.MyEmitterPool.SpawnEmitter( windupFx, SpawnPosition,,,Self ); //Fire ghost after windup complete SetTimer(WindUpTime,false,'FireGhostAtPlayer'); } } function FireGhostAtPlayer() { local Vector AimDirection; local Vector SpawnPosition; SpawnPosition = Pawn.Location; SpawnPosition.Z += PositionOffsetAbovePlayerToSpawn; m_spawnedGhostProjectile = Spawn(class'KM_GhostProjectile',,, SpawnPosition, Pawn.Rotation ); if ( m_spawnedGhostProjectile != None ) { //Aim ghost projectile towards player, init, and apply settings AimDirection = Normal( GetEnemy().Location - Pawn.Location ); m_spawnedGhostProjectile.Init( AimDirection ); m_spawnedGhostProjectile.SeekTarget = GetEnemy(); m_spawnedGhostProjectile.Damage = GhostDamageToPlayerOnTouch; m_spawnedGhostProjectile.Speed = GhostSpeed; m_spawnedGhostProjectile.MaxSpeed = GhostMaxSpeed; m_spawnedGhostProjectile.AccelRate = GhostAccelerationRate; //Play launch sound KM_KravenManorGame( WorldInfo.Game ).SoundManager.PlaySoundAtActor( KM_SOUND_ENEMIES_STATUE_GHOSTLAUNCH, self ); //Assign travel and impact sounds to projectile m_spawnedGhostProjectile.AmbientSound = KM_KravenManorGame( WorldInfo.Game ).SoundManager.GetSoundCue( KM_SOUND_ENEMIES_STATUE_GHOSTTRAVEL ); m_spawnedGhostProjectile.ExplosionSound = KM_KravenManorGame( WorldInfo.Game ).SoundManager.GetSoundCue( KM_SOUND_ENEMIES_STATUE_GHOSTIMPACT ); m_bGhostInFlight = true; m_spawnedGhostProjectile.SCSpawner = Self; //Stop windup emitter WorldInfo.MyEmitterPool.DetachComponent( m_windupEmitter ); } } function bool IsInFlashLightBeam() { local KM_PlayerController pc; pc = KM_PlayerController( GetEnemy().Controller ); if( pc != None ) return pc.IsInFlashLightBeam( Pawn ); } function SetGhostIsInFlight( const bool isInFlight ) { if( m_bGhostInFlight ) { m_bGhostInFlight = isInFlight; SetTimer(SecondsToWaitBeforeFiring,false,'SetFireGhostReady'); } } function ToggleDebug() { m_bDebug = !m_bDebug; } function private SetAttackReady() { m_bReadyToAttack = true; } function HandleDestroyed() { local KM_PlayerController pc; //Stop attacking the player and make sure they are released pc = KM_PlayerController( GetEnemy().Controller ); if( pc != none ) { pc.StatueRelease(); } IsFrozen = true; GotoState('FredIdle'); //Death delay so designers can sync up kismet SetTimer( DeathDelay, false, 'KillFred' ); } function KillFred() { //Destroy emitters WorldInfo.MyEmitterPool.DetachComponent( m_windupEmitter ); m_windupEmitter = None; Pawn.Destroy(); } function HandleBeingStuck() { local Vector teleportLoc, leftPawnFacing; local Vector leftLoc, rightLoc, forwardLoc; //Attempt to reposition to sides if clear and get better path m_bStuck = false; ///Statue facing is vect( 1.0, 0.0, 0.0 ) >> Pawn.Rotation; leftPawnFacing = vect(0.0,1.0,0.0)>>Pawn.Rotation; leftLoc = Pawn.Location + ( leftPawnFacing * m_stuckCheckDistance ); rightLoc = Pawn.Location + ( -leftPawnFacing * m_stuckCheckDistance ); forwardLoc = Pawn.Location + ( (vect(1.0,0.0,0.0)>>Pawn.Rotation) * m_stuckCheckDistance ); if( m_bDebug ) { DrawDebugLine(Pawn.Location,leftLoc,0,255,0,true); DrawDebugSphere(leftLoc,16,20,0,255,0,true); DrawDebugLine(Pawn.Location,rightLoc,0,255,0,true); DrawDebugSphere(rightLoc,16,20,0,255,0,true); DrawDebugLine(Pawn.Location,forwardLoc,0,255,0,true); DrawDebugSphere(forwardLoc,16,20,0,255,0,true); } if( CanReachDestination( forwardLoc ) ) teleportLoc = forwardLoc; else if( CanReachDestination( leftLoc ) ) teleportLoc = leftLoc; else if( CanReachDestination( rightLoc ) ) teleportLoc = rightLoc; Pawn.SetLocation( teleportLoc ); } ////////////////////////////////////////////////////////////////////////////////////////////////// // States ////////////////////////////////////////////////////////////////////////////////////////////////// auto state FredIdle { function BeginState( Name PreviousStateName ) { local KM_FredPawn fredPawn; if( m_bDebug ) `Log( self @ "begin state "@GetStateName()@" from " @ PreviousStateName ); fredPawn = KM_FredPawn( Pawn ); if( fredPawn != None ) { if( GetEnemy() != None && !GetEnemy().bIsBeingAttacked ) fredPawn.SwitchToState( KM_STATUE_IDLE ); } KM_KravenManorGame( WorldInfo.Game ).SoundManager.StopSound( KM_SOUND_ENEMIES_STATUE_MOVEMENT ); StopLatentExecution(); StopMovement(); } function Tick( float DeltaTime ) { if( GetEnemy() == None ) SetEnemy( GetEnemyWithinDetectRadius() ); if( !IsFrozen && !GetEnemy().bIsBeingAttacked && m_bReadyToAttack ) { Focus = GetEnemy(); GotoState('FredChase'); } } function EndState( Name NewStateName ) { if( m_bDebug ) `Log( self @ "end state "@GetStateName()@" going to state " @ NewStateName ); } } state FredFireGhost { function BeginState( Name PreviousStateName ) { local KM_FredPawn fredPawn; if( m_bDebug ) `Log( self @ "begin state "@GetStateName()@" from " @ PreviousStateName ); fredPawn = KM_FredPawn( Pawn ); if( fredPawn != None ) { if( GetEnemy() != None && !GetEnemy().bIsBeingAttacked ) fredPawn.SwitchToState( KM_STATUE_HOVER ); } StopLatentExecution(); StopMovement(); Focus = GetEnemy(); } function Tick( float DeltaTime ) { if( IsFrozen ) GotoState('FredIdle'); Focus = GetEnemy(); AttemptFireGhostAtPlayer(); if( !IsInFlashLightBeam() ) GotoState('FredIdle'); } function EndState( Name NewStateName ) { if( m_bDebug ) `Log( self @ "end state "@GetStateName()@" going to state " @ NewStateName ); } } state FredAttack { function BeginState( Name PreviousStateName ) { local KM_FredPawn fredPawn; if( m_bDebug ) `Log( self @ "begin state "@GetStateName()@" from " @ PreviousStateName ); fredPawn = KM_FredPawn( Pawn ); if( fredPawn != None ) { if( GetEnemy() != None && !GetEnemy().bIsBeingAttacked ) fredPawn.SwitchToState( KM_STATUE_GRAB ); } StopLatentExecution(); StopMovement(); Focus = GetEnemy(); } function Tick( float DeltaTime ) { local KM_PlayerController pc; if( IsFrozen ) GotoState('FredIdle'); if( !IsWithinAttackRangeOfEnemy() ) GotoState('FredIdle'); //Make sure not behind something before attacking if( CanReachDestination( GetEnemy().Location ) ) { pc = KM_PlayerController( GetEnemy().Controller ); if( pc != none && !GetEnemy().bIsBeingAttacked ) { Focus = GetEnemy(); m_bReadyToAttack = false; pc.StatueGrab( DamageToPlayerPerTick ); SetTimer(AttackCoolDownSeconds,false,'SetAttackReady'); GotoState('FredIdle'); } } } function EndState( Name NewStateName ) { if( m_bDebug ) `Log( self @ "end state "@GetStateName()@" going to state " @ NewStateName ); } } state FredChase { ignores SeePlayer; function BeginState( Name PreviousStateName ) { local KM_FredPawn fredPawn; if( m_bDebug ) `Log( self @ "begin state "@GetStateName()@" from " @ PreviousStateName ); fredPawn = KM_FredPawn( Pawn ); if( fredPawn != None ) { if( GetEnemy() != None && !GetEnemy().bIsBeingAttacked) fredPawn.SwitchToState( 1 ); } } function Tick( float DeltaTime ) { KM_KravenManorGame( WorldInfo.Game ).SoundManager.PlaySoundAtActor( KM_SOUND_ENEMIES_FRED_MOVEMENT, self ); Focus = GetEnemy(); if( IsFrozen ) GotoState('FredIdle'); if( IsWithinAttackRangeOfEnemy() && m_bReadyToAttack ) GotoState('FredAttack'); //Check if we can fire ghost at enemy if( IsInFlashLightBeam() && HasLineOfSightToPlayerIgnoringGlobes() ) GotoState('FredFireGhost'); } function EndState( Name NewStateName ) { if( m_bDebug ) `Log( self @ "end state "@GetStateName()@" going to state " @ NewStateName ); } event MoveUnreachable(vector AttemptedDest, Actor AttemptedTarget) { `Log( "MoveUnreachable" ); } function bool FindNavMeshPath() { // Clear constraints NavigationHandle.PathConstraintList = none; NavigationHandle.PathGoalList = none; // Create constraints class'NavMeshPath_Toward'.static.TowardGoal( NavigationHandle,GetEnemy() ); class'NavMeshGoal_At'.static.AtActor( NavigationHandle, GetEnemy(), AttackRange * 0.4 ); class'NavMeshPath_EnforceTwoWayEdges'.static.EnforceTwoWayEdges( NavigationHandle ); // Find path return NavigationHandle.FindPath(); } Begin: // If the pawn is not walking, then wait until it does if( Pawn.Physics != PHYS_Walking ) { Sleep(0.1); Goto('Begin'); } //Check if directly reachable if( NavigationHandle.ActorReachable( GetEnemy() ) ) { if( m_bDebug ) FlushPersistentDebugLines(); //Direct move MoveToward( GetEnemy(), GetEnemy() ); m_locationLastFrame = Pawn.Location; } //Otherwise compute path else if( FindNavMeshPath() ) { NavigationHandle.SetFinalDestination(GetEnemy().Location); if( m_bDebug ) //Draw debug pathing { FlushPersistentDebugLines(); NavigationHandle.DrawPathCache(,TRUE); } // move to the first node on the path if( NavigationHandle.GetNextMoveLocation( m_nextDestination, Pawn.GetCollisionRadius()) ) { if( m_bDebug ) { DrawDebugLine(Pawn.Location,m_nextDestination,255,0,0,true); DrawDebugSphere(m_nextDestination,16,20,255,0,0,true); } MoveTo( m_nextDestination, GetEnemy() ); m_locationLastFrame = m_nextDestination; } } else //Stuck - attempt to recover { if( !m_bStuck ) { SetTimer(m_timeToSpendRecoveringWhileStuck,false,'HandleBeingStuck'); m_bStuck = true; } //Failed to recover from being stuck - stand perfectly still... like a statue //We'll get a better path once player moves. GotoState('FredIdle'); } goto 'Begin'; } ////////////////////////////////////////////////////////////////////////////////////////////////// // Private Events / Functions ////////////////////////////////////////////////////////////////////////////////////////////////// DefaultProperties { IsFrozen = false DamageToPlayerPerTick = 1.0 AttackRange = 90.0 PlayerDetectionRadius = 1200.0 AttackAfterTeleportCoolDown = 160 TriggerTeleportAfterNumLooks = 5 m_bStatueEnabled = true m_bGhostInFlight = false GhostDamageToPlayerOnTouch = 200 m_bDebug = false; SecondsToWaitBeforeFiring = 1.0 SecondsToFlickerFlashLight = 0.5 SecondsToKeepFlashLightOff = 0.5 m_bReadyToShootGhost = true m_bReadyToAttack = true PositionOffsetAbovePlayerToSpawn = 160.0 AttackCoolDownSeconds=5.0 WindUpTime=1.5 GhostSpeed=200.0 GhostMaxSpeed=400.0 GhostAccelerationRate=600.0 m_timeToSpendRecoveringWhileStuck=6.0 m_bStuck=false m_stuckCheckDistance=80.0 DeathDelay=2.5 m_distanceToTeleportSq = 0.0 } |