Hi everyone,
I've been working on a splinter-cell style stealth game, using light and sound for AI detection. It was built with the July 2013 Beta version. The only UTGame code it uses is UTProjectile, which is used for the rifle bullets and thrown items, so it should be easy to divorce completely. It also uses the UT assets as placeholders. Here are the following features:
AI
- Has a suspicion meter which increases when it hears or sees the player. The amount it's increased depends on the type and loudness of the noise, and how visible the player was when they were spotted. When it is above 0.25, it will stop to look at where it last saw or heard the player, when above 0.5 it will go over to investigate the area and above 1.0 it has seen the player and will attack. It will slowly decrease over time as long as the player remains hidden and doesn't make any noise.
- Will respond to the sight of an unconscious ally and will run over to revive them
- If it is attacking the player but the player is in darkness, it will spray rounds into the last known location of the player
- Mappers can set up patrol routes and tell the AI to follow it in either a back-and-forth manner or in a loop, and tell the AI how long to pause at each point in the path
Sound
- The amount of noise the player makes when moving depends on the type of surface (dirt, stone, metal etc) and how fast they're moving
- There are objects the player can throw. These make a loud noise on impact which will distract the AI. If the AI's suspicion is above 1.0, it will even fire at that location
Visibility
- Based on how well lit the pawn is, how close they are to the observer and how fast they're moving
- Currently only pointlights (and dynamic pointlights) are supported, I haven't had time to do spotlights
- The calculation takes into account the brightness of the pointlight, the radius and the falloff exponent
- The more visible the player is, the greater the increase to the AI's suspicion when they're spotted
- Skylights and dominant directional lights not supported
Other Features
- Throwable objects complete with trajectory preview to aid with aiming
- Able to knock out an AI guard by pressing Use while behind them
- Able to drag a dead or unconscious guard by pressing Use on their body
- Simple rifle weapon system
- Debug commands:
* NoHearing - Makes all AI deaf
* NoSight - Makes all AI blind
* ShowSuspicion - Puts a number above each AI's head, telling you how suspicious they currently are
Here is a video of it in action:
The download link for the latest version can be found here:
https://dl.dropboxusercontent.com/u/...k_20131229.zip
Installation Instructions
- Unzip the StealthFramework folder in UDK-2013-07\Development\src. Keep the folder in tact.
- Unzip the StealthFrameworkGameContent folder into UDK-2013-07\UDKGame\Content. Again, keep the folder in tact.
- Modify your DefaultEngine.ini file by adding the following line in the [Engine.ScriptPackages] section: +NonNativePackages=StealthFramework (make sure it's at the bottom of the list)
- You will also need to add this line in the [UnrealEd.EditorEngine] section: +EditPackages=StealthFramework (make sure it's at the bottom of the list)
- You will need to set up keybindings for the exec functions PrimeThrow (which displays the throw arc), ThrowItem (which throws the item currently carried) and Grab (which picks up items and knocks out AI)
Known Issues
- Only pointlights (static and dynamic) are supported at this time, all other lights will either not affect your visibility at all or might have unpredictable results
- Lightmass needs to be disabled for all lights that will affect the play area, otherwise you will end up with areas that look lit but the game thinks you're in darkness. Think Doom 3 style lighting.
- Dragging is a little buggy sometimes with limbs getting stuck in static mesh actors (seems to be particularly bad on the stone floor tile mesh that comes with UDK)
- AI is unfinished and will sometimes act a little oddly, not investigating an area properly etc. Unfortunately I don't have the time to polish this up, but if you want to make any improvements I will of course credit you
- I've not commented any of my code (I know, naughty!) but unfortunately I've not had the time I'd like to dedicate to polishing this up. Hopefully it should be fairly easy to read. I'll see about getting a cleaned-up and commented version out soon
Thanks to
- EvernewJoy for his rainbow trail effect which I have modified to create the arc throw preview
Updates
29/12/2013:
- When the AI is attacking, it will no longer run to its starting position. Instead, it will move around its current location from time to time
- AI now sees and checks dead bodies as well. A check is in place to avoid the AI reacting to the same corpse more than once. Suspicion will be raised to max (10.0)
- You will now release a dragged body if you move to far from it (e.g. if it gets stuck on something)
- You can no longer knock out a corpse
- ThrownItem objects are no longer managed in individual classes, instead they use the same static mesh component as the ThrowableObject the player grabbed.
Simply place a ThrowableObject object in the map, assign a static mesh to it and the game will do the rest.
Any problems then let me know! Feedback is welcome.
I've been working on a splinter-cell style stealth game, using light and sound for AI detection. It was built with the July 2013 Beta version. The only UTGame code it uses is UTProjectile, which is used for the rifle bullets and thrown items, so it should be easy to divorce completely. It also uses the UT assets as placeholders. Here are the following features:
AI
- Has a suspicion meter which increases when it hears or sees the player. The amount it's increased depends on the type and loudness of the noise, and how visible the player was when they were spotted. When it is above 0.25, it will stop to look at where it last saw or heard the player, when above 0.5 it will go over to investigate the area and above 1.0 it has seen the player and will attack. It will slowly decrease over time as long as the player remains hidden and doesn't make any noise.
- Will respond to the sight of an unconscious ally and will run over to revive them
- If it is attacking the player but the player is in darkness, it will spray rounds into the last known location of the player
- Mappers can set up patrol routes and tell the AI to follow it in either a back-and-forth manner or in a loop, and tell the AI how long to pause at each point in the path
Sound
- The amount of noise the player makes when moving depends on the type of surface (dirt, stone, metal etc) and how fast they're moving
- There are objects the player can throw. These make a loud noise on impact which will distract the AI. If the AI's suspicion is above 1.0, it will even fire at that location
Visibility
- Based on how well lit the pawn is, how close they are to the observer and how fast they're moving
- Currently only pointlights (and dynamic pointlights) are supported, I haven't had time to do spotlights
- The calculation takes into account the brightness of the pointlight, the radius and the falloff exponent
- The more visible the player is, the greater the increase to the AI's suspicion when they're spotted
- Skylights and dominant directional lights not supported
Other Features
- Throwable objects complete with trajectory preview to aid with aiming
- Able to knock out an AI guard by pressing Use while behind them
- Able to drag a dead or unconscious guard by pressing Use on their body
- Simple rifle weapon system
- Debug commands:
* NoHearing - Makes all AI deaf
* NoSight - Makes all AI blind
* ShowSuspicion - Puts a number above each AI's head, telling you how suspicious they currently are
Here is a video of it in action:
The download link for the latest version can be found here:
https://dl.dropboxusercontent.com/u/...k_20131229.zip
Installation Instructions
- Unzip the StealthFramework folder in UDK-2013-07\Development\src. Keep the folder in tact.
- Unzip the StealthFrameworkGameContent folder into UDK-2013-07\UDKGame\Content. Again, keep the folder in tact.
- Modify your DefaultEngine.ini file by adding the following line in the [Engine.ScriptPackages] section: +NonNativePackages=StealthFramework (make sure it's at the bottom of the list)
- You will also need to add this line in the [UnrealEd.EditorEngine] section: +EditPackages=StealthFramework (make sure it's at the bottom of the list)
- You will need to set up keybindings for the exec functions PrimeThrow (which displays the throw arc), ThrowItem (which throws the item currently carried) and Grab (which picks up items and knocks out AI)
Known Issues
- Only pointlights (static and dynamic) are supported at this time, all other lights will either not affect your visibility at all or might have unpredictable results
- Lightmass needs to be disabled for all lights that will affect the play area, otherwise you will end up with areas that look lit but the game thinks you're in darkness. Think Doom 3 style lighting.
- Dragging is a little buggy sometimes with limbs getting stuck in static mesh actors (seems to be particularly bad on the stone floor tile mesh that comes with UDK)
- AI is unfinished and will sometimes act a little oddly, not investigating an area properly etc. Unfortunately I don't have the time to polish this up, but if you want to make any improvements I will of course credit you
- I've not commented any of my code (I know, naughty!) but unfortunately I've not had the time I'd like to dedicate to polishing this up. Hopefully it should be fairly easy to read. I'll see about getting a cleaned-up and commented version out soon
Thanks to
- EvernewJoy for his rainbow trail effect which I have modified to create the arc throw preview
Updates
29/12/2013:
- When the AI is attacking, it will no longer run to its starting position. Instead, it will move around its current location from time to time
- AI now sees and checks dead bodies as well. A check is in place to avoid the AI reacting to the same corpse more than once. Suspicion will be raised to max (10.0)
- You will now release a dragged body if you move to far from it (e.g. if it gets stuck on something)
- You can no longer knock out a corpse
- ThrownItem objects are no longer managed in individual classes, instead they use the same static mesh component as the ThrowableObject the player grabbed.
Simply place a ThrowableObject object in the map, assign a static mesh to it and the game will do the rest.
Any problems then let me know! Feedback is welcome.
Comment