Raymond Weilacher
  • Blog
  • UX Portfolio
  • Blog
  • UX Portfolio

Sneak 'Em Up Devlog #5: Iterating on search AI based on playtesting

7/16/2020

1 Comment

 
A big part of my day job is making sure that I run designs past people before releasing anything. I almost inevitably learn a ton from just a few sessions (the UX industry standard is 5 testers).

An important part of my design strategy is to get builds into people's hands early and often. So far I've tapped some friends for feedback and this example shows how that feedback translates into design iterations.
Picture
The original search AI
I sent a couple friends a link to a test build and jumped on separate Discord calls to get their reactions. I had them share their screens and encouraged them to speak out loud about their experience and specifically whether the guards were behaving in accordance with their expectations.

Observing my friends play and getting their feedback, a persistent theme was the guard's searching behavior was not working the way the players expected. Rather than a systematic search, guards just kind of ran about randomly, as in the clip above. In fact, they were programmed to do just that: run around systematically.

I was unsure how exactly to create a search behavior that would be scalable and work in different environments and levels so I looked into some other stealth games for inspiration.
In this (rather funny) example of enemy search AI in Metal Gear Solid 2, the guards have particular places they search for the player in a way that seems believable (except for the hilarious bug at the end). They check behind objects and in containers where the player can hide. This system most likely relies on designers manually setting up each room to tell the AI where the door is, what objects to search behind, and what lockers to open. I decided to set up a test using similar, manually placed points of interest.
Picture
In the above example, the green rectangle is the Search Area and the green circles are the search waypoints. When a guard is alerted near the Search Area, he goes to the closest waypoint then begins a search at each of the waypoints until his awareness level drops to 0, at which point he returns to his patrol. Here's a clip of the guard following this behavior after spotting a dead body.
Picture
1 Comment

Sneak 'Em Up Devlog #4 - Controls

7/7/2020

0 Comments

 
Picture
Many gamers, myself included, use a variety of controls to play PC games. The two control devices I decided to support right from the beginning are the keyboard and mouse as well as the Xbox controller, which Steam data reports as the most popular gaming controller by a large margin.

Thankfully Unity makes it easy to support multiple control setups simultaneously, but I wanted the user interface of Sneak 'Em Up (working title) to also adapt in real time to the user. To do so I created a script which detected input from either the keyboard or an Xbox controller. This script then sets a global variable which other objects in the game reference. This global variable acts as a signal telling the rest of the game whether the last input made by the player was made on a keyboard or an Xbox controller.

Button prompts show up several places in Sneak 'Em Up's levels. Most obviously, they appear on the HUD UI, reminding the player which button is responsible for using equipped weapons and items.
Picture
Prompts also appear above the character's head when they are close to an interactable object such as a body or a switch. And finally, button prompts can exist in the game level itself as a "sign" during the tutorial. In the future, button prompts may also be seen in dialogs, when characters help explain how to play in the early tutorial levels.

Putting this all together, the control manager script described above sends information on the player's last input to all these systems, giving the player real time contextual prompts that make playing intuitive.
Picture
0 Comments

Sneak 'Em Up Devlog #3 - Awareness

7/7/2020

1 Comment

 
Picture
Waiting in the grass for a guard to pass by.
Awareness is a key feature of enemy AI in Sneak 'Em Up (working title). Once a player is detected (see the last post), the guard's awareness "meter" fills (there's no visual meter for each guard's awareness but this is something I plan on testing eventually). Awareness starts at 0 and goes to 100.
Picture
The script that handles Awareness.
Both the detection system and awareness system are designed to be target-agnostic--in other words, the AI does not solely respond to the player. This is to allow for emergent or systemic gameplay, in which the player manipulates the game world indirectly. The AI for each character is seeking out, not just the player, but anything that is suspicious, alerting, or on a different "team." The player will be able to use this to their advantage by arranging for opposing factions to fight it out, luring wild animals near enemies, or perhaps mind controlling enemy guards to cause mayhem.

The rate at which awareness raises is based on several variables. Visibility (formerly called Size) is a variable on every character or notable item in Sneak 'Em Up. Highly visible objects, like the standing player character, raise awareness faster than small objects such as a pack of cigarettes tossed to lure enemies. To mimic human sight, the target's speed is a major factor in awareness as well. Finally, distance to the target raises the awareness rate exponentially. This way, if the player runs up on a guard standing around the corner, the AI will go to 100% awareness almost instantly, but a distant player will cause a slow creeping awareness.
Picture
The AI's suspicious state.
Each enemy type has a "Suspicion Threshold" and an "Alerted Threshold", which define at what Awareness level a character will go check out a suspicious sight, and what level they will become alarmed and search the area. An alerting sight that the enemy identifies as a character from another team will be met with hostility.
Picture
A "playground" level built for testing. Enemies on the right have a different variation of the AI script than enemies on the left.
One way to test and tweak my AI was to build a "playground" level where I could test enemy detection and awareness at different distances and with the player character in different states such as prone or hiding in tall grass. Initially enemies had a detection area that was circular in shape (see the enemies on the left in the above screenshot). However, through playtesting my own levels and watching users try the game out, I realized that the enemy was often able to see the player before the enemy was even on the screen, causing frustration for players.
Picture
In the illustration above, the grey rectangle represents the aspect ratio for the vast majority of PC game players' monitors: 16:9. With a circular detection radius, guards who are to the left and right of the player work as expected, meaning they can't see you from off screen. However guards above or below your position can see and attack the player from off screen, which feels frustrating. The solution, after much tweaking, was to make the detection shape a capsule shape:
Picture
Even though a player's expectation is that guards see in an even circle around them, this caused a lot of frustration and instead, a capsule shaped vision area feels more fair to the player.
1 Comment

Sneak 'Em Up Devlog #2: Visual Acquisition

6/25/2020

0 Comments

 
The core system in any stealth game is the guard AI, specifically visual acquisition and detection of the player.
Picture
The states a guard passes through.
In Sneak 'Em Up (working title), the guards start in a patrol or standing state, while constantly scanning objects that enter a circular trigger around them.
Picture
The guard script monitors items that exist within the green circle.
Once an item enters the green circle, it goes through a gauntlet of questions to filter out only the items the guard should respond to:
  • Is the object a character, item, or the player?
  • Is it within the field of view in front of where the guard is facing?
  • Is the object large enough to be seen from its distance from the guard?
  • Are there any objects blocking the visibility of the object from the guard's position?
  • Is the object tagged as either "suspicious" or "alerting"?
  • If the object is on a team, is it a different team from the guard's?
If the object passes these requirements, a variable called "Awareness" starts to fill. The rate at which Awareness fills is based on the object's size multiplied by the distance to the object and the object's speed.
Picture
"Awareness" is defined as object size times target speed (exponential) times target distance.
In this way, fast-moving objects that are close to the guard fill his Awareness exponentially faster than stationary targets that are far away.

The visual acquisition system is designed to not be specific to just the player, to allow guards to react appropriately to characters from different factions or wild animals, as well as objects like distractions or dead bodies. Systems like these will provide more chances for the player to use the world itself as a tool of chaos and destruction.
Picture
Suspicious and Alerted states.
As awareness builds, the guard moves into first the Suspicious state, then the Alerted state. Taking--ahem--inspiration from the Metal Gear Solid series, the player receives visual feedback as to which state the guard is in. The Awareness system will be covered in more detail in the next Devlog.
0 Comments

Sneak 'Em Up (working title) Devlog #1

6/22/2020

0 Comments

 
This post will introduce my latest game project - a top-down third person stealth action game tentatively titled Sneak 'Em Up. Currently it's a one-man-project, with me trying to tackle all aspects of game design and development.

2D stealth games are rare, and top-down stealth games even more so, and those that are top down are likely to be squad combat or turn-based. Sneak 'Em Up, on the other hand, is a top-down action game with strong stealth mechanics. The most well known games of the same style, and the major inspiration for Sneak 'Em Up, are the original 2D Metal Gear games of the late 80s and early-mid 90s. In the early Metal Gear games, you control your character from above, distracting guards and finding hiding places. Since the advent of the 3D stealth genre in 1998, 2D top-down stealth action games have been rare.
Picture
Metal Gear, 1987

Technical Details

Picture
Sneak 'Em Up is built in Unity utilizing the Bolt visual scripting plugin. Bolt offers me several advantages:
  • I don't have to worry about getting C# syntax right. I can spend more time designing and less time chasing missing semicolons.
  • Bolt makes it easy for visual or systems thinkers to organize their work. As someone who is not a developer by trade, basic dev protocols like assigning all variables at the beginning of the script are non-intuitive and make it confusing to figure out complex code. In Bolt, I can visually organize related variables, functions, and systems to more intuitively find and understand my work.
  • Bolt provides real time feedback by animating the various functions "shooting" out data like integers, vectors, and strings. This makes it incredibly easy to troubleshoot and tweak variables in real time to see the results.
Picture
Bolt functions "shooting" out data to one another

Design Strategy

Throughout design and development, I'll be using the "find the fun" strategy of game design--that is, iterate on the basics of gameplay to find what mechanics "work" and are enjoyable for the player, then worry about the overall game story, theme, pacing, as well as details like art style, animations, lighting, etc.

My plan is to use very basic assets to prototype mechanics and interactions and iterate/tweak those to find what type of gameplay is satisfying. Once the core gameplay loop is established, I'll then design the rest of the game around that loop, providing the player with a story arch, a possible leveling system, varied tools and weapons, and special sections that twist and vary the core gameplay loop.

High fidelity art will also wait until after the core gameplay loop has been discovered. I will be creating some sprites in the meantime to practice my pixel art skills. I'm particularly proud of this guard, my second pixel art character ever!
Picture
0 Comments

    Raymond Weilacher

    Writing about UX, game development, and hobbies!

    Archives

    June 2020

    Categories

    All
    AI
    GameDev

    RSS Feed

© 2020 Raymond Weilacher