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.
/************************************************************************************************ * 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 }