| Publication Type | honors thesis |
| School or College | School of Computing |
| Department | Computer Science |
| Faculty Mentor | Rogelio Cardona-Rivera |
| Creator | Gardone, Michael |
| Title | Post-mortem of the sheriffs in ballad of the masked bandits |
| Date | 2020 |
| Type | Text |
| Publisher | University of Utah |
| Language | eng |
| Rights Management | (c) Michael Gardone |
| Format Medium | application/pdf |
| ARK | ark:/87278/s6q8js5q |
| Setname | ir_htoa |
| ID | 2947096 |
| OCR Text | Show POST-MORTEM OF THE SHERIFFS IN BALLAD OF THE MASKED BANDITS by Michael Gardone A Senior Honors Thesis Submitted to the Faculty of The University of Utah In Partial Fulfillment of the Requirements for the Honors Degree in Bachelor of Science In The School of Computing Approved: Rogelio Cardona-Rivera, PhD Thesis Faculty Supervisor _____________________________ Ross Whitaker, PhD Chair, Department of Computing _______________________________ Erin Parker, PhD Honors Faculty Advisor _____________________________ Sylvia D. Torti, PhD Dean, Honors College May 2020 Copyright © 2020 All Rights Reserved 1 ABSTRACT With all games, there needs to be a personality or charm it drives forward. Games like Assassin’s Creed and Uncharted have enemies that patrol in squads, interact with one another, and clearly communicate what they are trying to do. The various games of the Super Mario franchise all have a unique way of communicating their actions to the player in the cartoonish environment. As Ballad of the Masked Bandits is in the style of minimalist cartoons, the agents that provide danger and tension for the player must also follow a similar over-the-top style that the protagonists do with their animation cycles. This must work well within the framework of the intelligence system to feel good, responsive, and keep the players wanting to come back for more. As well, the early iterations of the AI systems the game used promoted frustration and anger as they would have erratic behavior or would not react in a similar way given the same stimulus. As such, this paper will take a deep dive into the mechanisms for the agents in Ballad of the Masked Bandits and what they have at their disposal. This paper will examine what the underlying state machine looks like, how it changed from its first iteration to the final release and the benefits and drawbacks of the systems in place. It will also look at the future of the current philosophy of the systems and see how it will evolve from Steam’s Early Access program to its final release in August. 1| Ballad of the Masked Bandits TABLE OF CONTENTS 1 Abstract ............................................................................................................................................................................................................ 1 Table of Contents............................................................................................................................................................................................. 2 2 Introduction ................................................................................................................................................................................................... 3 3 Initial Design of the Artificial Intelligence ........................................................................................................................................ 4 3.1 System Diagram................................................................................................................................................................................... 5 3.2 Vision Cone and “Danger Zone” .................................................................................................................................................... 7 3.3 Listening System ...............................................................................................................................................................................10 3.4 Distraction System ...........................................................................................................................................................................13 3.5 Interaction with Unity’s NavMesh System.............................................................................................................................14 3.6 Dog Enemies........................................................................................................................................................................................15 4 Redesign of the Artificial Intelligence ..............................................................................................................................................17 4.1 System Diagram.................................................................................................................................................................................18 4.2 Vision Cone and “Danger Zones”................................................................................................................................................20 4.4 Interaction with Unity’s NavMesh System.............................................................................................................................23 4.5 Procedural Animation - FastIK ...................................................................................................................................................23 4.6 Decoupling Overly Complex Behavior .....................................................................................................................................25 4.7 New Distraction System .................................................................................................................................................................26 4.8 Removed Components....................................................................................................................................................................27 4.8.1 Fear State ...................................................................................................................................................................................27 4.8.2 Listening System.....................................................................................................................................................................27 4.7.3 Dog Enemies .............................................................................................................................................................................28 6 Final Reception & Conclusion ..............................................................................................................................................................29 6.1 Future Developments to the AI System ..................................................................................................................................29 2| Ballad of the Masked Bandits 2 INTRODUCTION Ballad of the Masked Bandits was a game for the 2020 undergraduate Entertainment Arts & Engineering capstone. As the elevator pitch by the vision leader Deborah Landis goes, “Battle of the Masked Bandits is a stealth game where you play as three raccoons pulling off wacky wild west heists.” Overall, the game remained true to its word when it was originally pitched by the vision leader: to be a fun, engaging, casual gaming experience for general consumers. Drawing from ideas in the Legend of Zelda: Breath of the Wild, Hitman, and The Swindle, the core experience was designed thoroughly by a team of fourteen people. These fourteen people are, in alphabetical order: Aaron Anderson Michael Rapley Patrick Chou Aron Selimovic Jason Jackson Kimmy Workman Sterling Beecroft Michael Gardone Deborah Landis Jessica Murdock Tim Seitz Daniel Williams S. Brian Zavala Fukuan Zeng 3| Ballad of the Masked Bandits Initial pitch one-sheet. Starting off, the team initially consisted of ten people who were sold on the idea of the cute idea of three raccoons in a trench coat. Tasked with creating two prototypes, the group set out to put something together for a panel that would decide the fate of the game. Within the first week, the team scrapped the second prototype idea in favor of putting all their effort into one idea. This initial prototype laid the foundation for what would be the design philosophy of the first cycle of development. These initial ideas gave the group feedback and ideas for how to improve the game. The primary idea was raccoons first and foremost, with unique abilities both in the stack and individually. While a lot of the code needed to be reworked, and art assets added in, the game performed well but every playtest session that the producer ran received a similar answer to something feeling off. Towards the end of the first semester, with the game performing adequately well with a large testing, anonymous testing group consisting of first time gamers to the most avid first person shooter fans, the group received what information it needed to proceed into the second half of the year. The Day of Play the EAE Department ran told the group, they needed to rework the core philosophy. The new one-sheet after the shifts in ideation and design. The game underwent many iterations on ideas in terms of gameplay, graphics, and design. Particularly when coming upon the second semester of the course, many core ideas regarding how the game’s artificial intelligence and raccoons changed. Part of our design shifted from three raccoons with three unique abilities to simply three raccoons in a trench coat. This was by far the largest and most radical shift in philosophy the game underwent but it was a necessary shift. Due to the time limitations being a release by the end of the year, this simplified the issues that the team faced. Another was the various camera techniques that were attempted: first a static third person camera, then a free rotating third person 2| Ballad of the Masked Bandits camera, finally settling on the original Silent Hill style of camera. Many of these types of shifts were moves to simplify the team’s problems with creating unique, memorable interactions for each of the individual raccoons that were readable for the player. The way to describe this shift in ideas was a shift from the uniqueness of each raccoon, to the uniqueness of the group and the situations that a player can find themselves in. The two sets of unique abilities – dubbed active and passive – were scrapped for the betterment of the outlook of the project. This opened a huge avenue of design and mechanical changes that could be explored. New levels were designed and tested, receiving much better feedback. Feedback shifted from feeling like one raccoon was valued too much or there being an “always right” strategy, to issues regarding readability, user interface, etcetera. From that new data, many other developments took place that changed the way the user interface read, the team’s organization, and, what this paper is concerned with, how the artificial intelligence was now re-integrated more tightly with the player’s experience. 3| Ballad of the Masked Bandits 3 INITIAL DESIGN OF THE ARTIFICIAL INTELLIGENCE The initial philosophy behind the artificial intelligence systems was based on two things: mid-grade computers and being simple. The initial AI system was implemented quickly and touched by the entire team, with no core guiding implementation principle. The AI was a secondary system that was given cursory glances and ideas as there were other pressing matters; namely, the three active and passive abilities of the raccoons. The agents of the initial run were polling whether or not they saw the raccoons every frame, where constantly holding references to objects that weren’t necessary, and in some instances if there were too many agents, around ten or more, in the scene the frame rate would dip to around 40 frames per second. For our second level, the Saloon, this would be a terrible issue as there were more than ten agents in the scene. Two guards at the door, one patrolling around the premise, eight audience members, a barkeep, two patrons at said bar, and the owner in their office. The scaling of resources became unfeasible and a large chunk of the final Day of Play levels had to be thrown out and redone to accommodate the limitations that version of the agents had. Instead, all levels had no more than a max of six agents. The last level, the initial version of the jail which no one really got to, had that maximum. Even then, the AI did not appear to “play nicely” with one another as they would run into each other rather than slow down or, in the most egregious of cases, run through walls the player could not pass through. Those that played this level expressed anger at not just the gameplay elements, but the AI doing weird and questionable things that they could not anticipate. For this section, there will be a 4| Ballad of the Masked Bandits deep dive into the way this system was written looking at both conceptual and application of it. 3.1 SYSTEM DIAGRAM Initial system diagram created post-Day of Play. As stated earlier, there was little communication of what the AI would look like between the programmers. The AI was built to fulfill a particular purpose: be an obstacle. As such, when a designer came to a programmer regarding a specific interaction, they would add it into the system. This led to a bloated controlling script with a lot of logic cluttered together. Again, given the design principle and initial platform targets, this worked just fine to get the game’s mechanics out the door and tested. As can be seen in the diagram above, there is a lot of data bundled into the EnemyPatrol objects that is also shared with the DogPatrol objects. This data is very, 5| Ballad of the Masked Bandits very close but does not come from a base class which is not a good practice. As well, the functions that exist in both scripts function in the same manner. The underlying mechanics remain the same, save the dog would have been able to detect the player in a three stack and alert other agents in the nearby vicinity. The functionality also became bloated in each function, specifically when trying to determine whether to continue its patrol, go to the raccoon, or go to the last seen point of the raccoon. As well, a persistent bug was introduced with the agents getting stuck in what is known as the “valley of indecision” due to the way the raccoons were tracked when they were close enough. This will be covered more in-depth in section 3.2, but the basic idea is that when the three raccoons enter the vision cone on certain frames, they can freeze up until one of them leaves as it attempts to decide which on to go for, every frame. Continuing, there is a lot of interlinked data that can be decoupled. In some of these instances, it looks for the components too often which is one of the primary issues with time the game encountered. In the other cases, the data can be packaged with something else and sent as a message over direct polling. Especially with the way the patrolling and “sighted” behaviors work, there is a lot of time being spent on which decision to make as it relies heavily on knowing if the raccoons are in a trigger zone and within a certain range of the AI. The AI system also has the PatrolPoint script. While it does not interact substantially with the system, it does keep around information that it should not keep. Most importantly, as the game does not use Unity’s Burst compiler for performance, MeshRenderer components that are kept around occupy more space 6| Ballad of the Masked Bandits in memory than necessary. For the simple scenes with one or two agents, it’s not too concerning. However, in the planned finale for the game, there would have been an upwards of twenty agents with paths ranging between one patrol point up to ten, with potentially more paths needed to add in for the shifting of cars in the trainyard shift. As the team is also not using the Entity-Component System or Jobs System that Unity provides as other design patterns, a lot of miscellaneous information would be sitting in memory for no reason other than to potentially be turned back on. Of course, continuing with this design philosophy, the EnemyPatrol script would have been expanded to accompany that new gameplay element. The ideas for this system were unsustainable for scaling up in complexity of the game. With the new philosophy after Day of Play the designers proposed, this system would break simply under the weight of their demands. The system was designed simply for being used to make an obstacle, not for making unique situations. As well, there was no ability to properly hook a procedural animation system in to make the agents react in a more playful, engaging, and thematic manner. 3.2 VISION CONE AND “DANGER ZONE” The vision “cone” before the change was a large 3D rectangle. This decision was made early on to keep the system simple. The artists were busy making assets and the programmers were busy trying to make all the tools and mechanics necessary for the designers to put levels together for testing. So, this was opted for by the team to be a temporary solution. So long as the raccoons were within a specific area, shown in the next figure, they would be seen. The final implementation 7| Ballad of the Masked Bandits details also had two rays fired from the player if they were in a two stack. Once to see if the raccoons were in range and a second one to see if it is within the actual visual field. Vision cone and “Danger Zone” created post-Day of Play. The circle around the boid, representing the agent in this case, is the “danger zone” for the raccoons. That is, if one or two of the three raccoons get into the sphere, the AI will immediately know that they are there. If the raccoons are in a three stack, the agent ignores it and continues its path. 8| Ballad of the Masked Bandits Example of potential distances between a one and two stack for the agent, created post-Day of Play. These design ideas carried over into the current version of the agents. However, the issue arises in how it was programmed. Every frame, each state that this system can trigger is polled; each scene had before EAE Day of Play had a minimum of three agents. In the recent version of Ballad of the Masked Bandits, there are around fifteen agents patrolling in the Jail level and even more in the Saloon level to add tension to the cross walk. 9| Ballad of the Masked Bandits Vision cone and “Danger Zone” for the dog agent, created post-Day of Play. The dogs followed a similar system, although it is a much smaller set. Again, the issue comes up that the code is duplicated and needlessly complex for such a simple agent. The dog is meant to be an obstacle to make the three-stack need more thinking and ideation. The dog could be tricked with individual raccoons – the inverse of the humanoid agents. These were to be placed strategically in areas that would make sense for a dog to be. This would be in places like dog houses but never too close to a human that makes it impossible to traverse the area. A “hide in the dark” system was considered but abandoned as it would serve no purpose for a lighthearted game. It would work well for The Swindle, but it would not work for a game that was based on a brighter color scheme. 3.3 LISTENING SYSTEM 10 | B a l l a d o f t h e M a s k e d B a n d i t s Audio path with obstacles for the prototype. One proposed system that nearly made it into the game was an audio detection system for the AI. The initial design was to make it so large interactions – situations involving TNT, moving objects, etcetera – would project noise. This way, some decisions would have to be made on what paths were going to try to attempt. Would they want to use the TNT on this specific wall and draw the agents nearby, or would it be better to try and sneak through the puzzle laid out over yonder in the scene? The first implementation of the audio system was intended for the initial prototype. Being that there was only three weeks to get the main tasks done, this was a rough and dirty method for noise finding. It involved enabling a trigger sphere 11 | B a l l a d o f t h e M a s k e d B a n d i t s collider and then ray casting to all enemies that have stepped into the trigger. If there was an object in the way, the agent would not be triggered to move to that point. If the agent were triggered and got to the point, it would resume normal functionality after “examining” for three seconds where it could still spot the raccoons. If the raccoons were not seen, it would begin moving back to its patrol point. Audio path without obstacles created post-Day of Play. Moving from there to the alpha build, the programming team decided it was best to figure out how to make a better system. The following system was planned and implemented but scrapped for the alpha as the “fun” of the game would be compromised from focus testing. The system was an interesting but common implementation of sound systems in some large AAA titles. Pictured in the prior figure, the boid-agent is moving around when some sound cue goes off in the world that necessitates checking if it heard the sounds. This involves a similar system as before, but rather than just firing a ray around, it uses Unity’s NavMesh system. A similar trigger sphere comes up but loops over the agents found inside it – and only once. Luckily, the NavMesh system is a mature API the engine provides so the agent can call for the path, receive an array of points along said path, and then iterate over them for a set distance cost. If it is outside the 12 | B a l l a d o f t h e M a s k e d B a n d i t s maximum distance, such as around a wall as demonstrated in the next figure, then the AI would not be triggered. Audio path with obstacles, failing the check created post-Day of Play. 3.4 DISTRACTION SYSTEM Like the Listening System that was proposed in 3.3, the team also determined the ability to distract the agents would be a more interesting mechanic over knocking out the agents. This would move Brawn’s, the strongman raccoon, ability to Beauty and allow her to “charm” the agents by playing an interesting array of instruments like guitars, pianos, and flutes to name a few. However, all those sugarcoating items simmer down into one thing: a way for the agents to be “flies caught in the honey” and allow the raccoons to act unhindered in a specific area. Boiling it down to its core, in the following figure, it was a seemingly simple system that would make for a massive headache in the group for both designers and programmers. The idea was simple: use a sphere trigger collider that is centered around an object. This object would be put in strategic locations to maximize its benefit to the player; it was later added that the player should not be 13 | B a l l a d o f t h e M a s k e d B a n d i t s allowed to walk around with the instrument. The distraction sphere would draw the agents in close, making them stop after a few seconds of traveling. Distraction sphere created post-Day of Play. Now, the issues arose as more functionality was layered on the EnemyPatrol script. As the developers created more unique levels, a lot of corner cases came up that were solved by each programmer throwing in their own fix. Now, these corner cases were cobbled together but created a lot of errors with the distraction. One notable bug was that the agents could still run out after the raccoons after they got too close; another more insidious bug was that the agents would lose their ability to resume normal functions even after the distraction zone went away. Some of these bugs were very, very easy to fix up such as colliders not turning off, status flags not being set, etcetera. There existed a very big issue under the hood, however, as the fixes could very easily come undone with what was planned for later levels. 3.5 INTERACTION WITH UNITY’S NAVMESH SYSTEM Luckily for the team, Unity provides a fantastic in-engine solution to navigating a scene. This has been discussed before but was used only minimally for the implementation here. It acted as the primary pathfinding algorithm as any solution the team would attempt to make would be inferior and bug prone. 14 | B a l l a d o f t h e M a s k e d B a n d i t s However, in the original implementation, it does not make use of several of the features that is offered. This led to issues such as the agents pushing the raccoons out of the playing field, overshooting targets, and turning very slowly that caused moonwalking issues with the animation. 3.6 DOG ENEMIES The dog enemies, mentioned at the start of the section, were an interesting gameplay element trying to get the player to think much more about the stacking mechanic and be aware of who was on top, the composition, and what was around their current objective. The original design had the three-stack being so overpowered, there was no reason for risk outside failing a puzzle and having to redo it. Part of the mentality, then, became how to make the risk exist beyond the puzzles to keep the whole game having an atmosphere of tension. As stated briefly in 3.2, the dogs were the inverse of the humans. They could detect a three-stack but were followed by the raccoons being on their own. This way, there would have to be some variation to how the player needs to approach the puzzles. They would not be able to just sprint to the end with the three-stack at the ready. However, when it comes to the actual implementation, it is essentially a rewrite of the human agents. Most of the functionality has remained the same as the place where they differ is in how the triggers are called in the AIStateTrigger scripts. However, that script was bloated because it checks for the type of agent rather than 15 | B a l l a d o f t h e M a s k e d B a n d i t s just being assumed to be connected to the right kind of agent through Unity’s Prefab system. 16 | B a l l a d o f t h e M a s k e d B a n d i t s 4 REDESIGN OF THE ARTIFICIAL INTELLIGENCE With the shift in design perspective come the second semester to situational design, the system had to be remade. It was not designed to handle situations like this, plus the rigid animation sequences made it difficult to make scenes feel alive. Before a deep dive is taken into the artificial intelligence systems, it would be imperative to understand why this rework was a necessary objective aside from the inadequacies in the previous system. At the start of the second semester, the designers, programmers, producer, and vision lead sat down together to discuss the proceedings of the coming semester. We reviewed the data gathered from the survey and the information gained from the think-aloud sessions that happened. The game was found to be ultimately very cute and unique on its presentation alone with the gameplay being fun and interesting, but ultimately feeling bland and uninspired. This led to an intense two-week restructure of the project to be focused around new objectives: 1. The situations of the raccoons as a group, over the raccoons individually, 2. The larger thematic levels over small vignettes, 3. AI-driven tension when chasing, and 4. The raccoons share each other’s abilities. This restructure was meant to simplify the process, which it was able to do with end-of-February playtest data. Colleagues of the team greatly enjoyed the way the game was progressing. The new design ideas, while rough as this was their first runthrough, were well received. From there, though, the game was running considerably slower. With the original Jail level, having about twenty agents 17 | B a l l a d o f t h e M a s k e d B a n d i t s wandering the scene, the game was averaging around 40 frames per second outside of the engine. Now, to the team, this was an issue as this game was not meant to push systems to their brink. As well, the team officially decided that a Switch release was desired at some point in the near future as the game was patched and fixed through the Steam update. As such, a few of the shaders would need to be rewritten. The inefficiencies of the AI on a system like the Switch would be greatly highlighted in the new levels. The designers’ end level, a train heist, is planned to have upwards of thirty agents wandering about in a train station. The designers, an animator, and I sat down to discuss what this new system would entail. They came with their levels in mind so that way the AI would be robust and better about handling cases over the loose collection of code that made up the previous iteration of it. We came to the final principles of what this new system would exist to serve: 1. The original stack detection idea for the humanoids is to be preserved, 2. All agents’ values must be uniform across all scenes, 3. Agent interactions can take place in the following of three ways: Player-Agent, Agent-Agent, and Agent-Environment, and 4. The Agents should be aware when the player is not currently looking at a raccoon; it should take longer for the chase sequence to begin. 4.1 SYSTEM DIAGRAM 18 | B a l l a d o f t h e M a s k e d B a n d i t s New system diagram. The newer system contains, by far, less redundant data. Each of these scripts either does something unique or takes care of a specific, unique issue. As well, the data has been greatly simplified within the functions. The original functions TriggerDetection, TriggerInterest, and ReTriggerInterest were complex and brittle in terms of scalability and readability. They were very obviously patched and did too many things at once; they started off simple, but due to the lack of communication and architecture design meetings they became behemoths of spaghetti code. By changing this out, the code has become easier to maintain as each state now has its own method if it requires it. A big change was the underlying method of communication between the detection family of scripts and the AgentControl master script. This change, which is detailed even further in 4.6, means that the communication is based on events over direct polling of each other. This also means that other systems can peer in and 19 | B a l l a d o f t h e M a s k e d B a n d i t s observe the status of the ecosystem to see if something important has happened like a raccoon is being chased by one of the agents. 4.2 VISION CONE AND “DANGER ZONES” New vision cone and “Danger Zones.” The new vision system, as seen in the above figure, relies on frustums over squares. This makes it so the AI has a bit more of a natural viewing angle. Before, the extreme angle that the agents could see the players at was frustrating to casual/first time players; around 34% of the play testers felt the AI was a bit overpowered being able to see them at odd angles that were not humanly possible. So, the colliders were replaced with something that felt much more natural and forced there to be an “angle of sight” aspect for the enemy. This way, casual players can expect more human-like abilities over computer-like. Unfortunately, as the Launch Day was cancelled, we were unable to aggregate user’s views on the new vision system officially. 20 | B a l l a d o f t h e M a s k e d B a n d i t s Example vision cone with a potential two stack distance line. Rather than the original’s two ray cast solution, this solution only used one ray. As Unity stores ray casting information in a RaycastHit object, the distance of the ray is also stored. The forward frustum shape collider would check to see if the raccoon or raccoons could be seen. If they were not obscured by a wall, the height of the raccoon’s stack would be checked. If it is a one stack, it could be seen all the way to the edge of the collider. If it is a two-stack, the hit distance would have to be within a specific range as determined by design team. If it was a three stack, it is ignored. The ray cast, if they are in a group, is sent to the lowest raccoon. It will not send it to all the raccoons in the group, as the tail is the only noticeable thing sticking out from the bottom of the trench coat thematically. When it comes to the danger zones rework, their concept remains the same but two new zones are added. This will make the agent turn to look at the what is in their periphery and starts the timer there. Rather than the original method’s side 21 | B a l l a d o f t h e M a s k e d B a n d i t s view instant aggression method, this allows the player some time to react as the agent will now continue to shift and look at them so long as they are in view. So, now, the question comes in how this system is better over the original system? Firstly, the new communication protocol between the patrolling script and the looking scripts is based on events. The events prevent the constant polling for data from the looking scripts; the target position, and status of the agent, will only ever update when the view models have something important to send. This saw a decent improvement over the original system of about 0.5 – 0.7ms per frame. Secondly, by simplifying the logic down, there was less information needing to be checked. The only data that needed to be polled was: the lowest raccoon in the stack, the stack height, and hiding status of the raccoon. Before it was requesting quiet a decent amount of data about the stack itself. The hard lock to the first seen raccoon, or the lowest raccoon in the stack, made it so only one reference needed to be stored and checked against. This also greatly reduced the number of corner cases that was being checked and assessed in the original design. Third, with the rework of the raccoon interest system, the AI can shift targets if one goes out of sight and another one comes in. That is, the agent remains on alert and will not just go back to patrolling if a raccoon comes into view or is sitting in view when if the AI loses the other raccoon. 22 | B a l l a d o f t h e M a s k e d B a n d i t s In-engine, sight line pointing to the next target position. 4.4 INTERACTION WITH UNITY’S NAVMESH SYSTEM The new AI movement code interacts very heavily with the NavMesh components of Unity. For starters, in order to stop the agents from continuously trying to push the raccoons through walls a stopping distance was used. As well, the angular acceleration fields were updated properly to reflect what the designers wanted. Further information was given to them to understand how these fields work so they could better suit it to their levels. To keep in line with the second principle of the new AI, the designers needed to know how this worked to prevent the prior issue of hacking parts together to get something partially functional. The increased usage of the NavMesh’s properties allowed for smoother interactions, reduced apparent bugginess, and made the agents feel smarter and responsive. These small changes vastly improved the look and feel of the agents. 4.5 PROCEDURAL ANIMATION - FASTIK The procedural animation system being used by the game is called FastIK. The reason for using this library is like the argument for using Unity’s NavMesh API: this is a well-test library with well documented functionality. The purpose of using 23 | B a l l a d o f t h e M a s k e d B a n d i t s FastIK is to remove the reliance on the Mixamo animations the agents use. While it will not get rid of it, it will allow for more interesting animation blends between the rigid, hand-crafted animations and physically influenced actions. Currently, the FastIK implementation for Ballad of the Masked Bandits is being worked on. The primary goal was to get the behavior and general look feeling good for the player. A separate development branch for working on the procedural animation system is being used in the event something goes wrong with the package. However, this system has been attached to the event system driving the logic of the agents. This way, the FastIK implementation can, just as all the other systems, be told what is currently happening in the world. Take this example: the agent has just seen a raccoon that was left in the open by the player. Currently, with the Mixamo animation set, the agent will just stare at the raccoon. While this works for an Early Access build, this has no personality. The procedural animation would instead see that the agent is currently in a questioning state and select on of the animation tracks to blend from the walk cycle to a more energetic and revealing animation/pose. The purpose of this would be to help with an age-old issue of properly signaling to the player what the AI’s intentions are. In doing so, the inverse kinematics system needs to know what state the agent is in so it can select the right one. Had this been using the old system, each agent would have had its animation controller poll it to find out what the current state is. IK, or inverse kinematics, is the problem where you have a start and end position, and potentially a few frames or intermediate positions, and have to go 24 | B a l l a d o f t h e M a s k e d B a n d i t s from start to end mathematically over the usual hand animated way like in traditional walk cycles. For the agents, these frames would be supplied as coordinates for parts of the body to move towards using Unity’s built-in animation tools to allow the animators more free reign over the raccoons’ animations and to reduce the complexity on my own end for patching up the animations. 4.6 DECOUPLING OVERLY COMPLEX BEHAVIOR As a result of the new event-driven system versus the original polling system, a lot of different facets of the game can wait for messages as well. The audio system, which dynamically updates the music player, and game over screen used to sit and poll for changes every frame on every AI. This was the largest sink of time between each frame for the larger levels. Now, with this new event-based system, all manners of UI, audio, player, and game over could easily be hooked in and in-sync with each AI. The onus of time was placed less on during play, and more on the scene’s loading section with hooking up each necessary part to the event object in the agent. This way if one agent raised an alarm, the whole system would know something changed. On the implementation details, the events sent three pieces of information: the status the agent should be in (AgentStatus), the destination position (a Transform object), and the time this step should take. This alone saw a total of up to 7ms time reduction in a standalone build without assistance from other Unity or third-party packages. According to Unity’s processing order, all events will be processed before anything else is done. Events have the highest priority on the start of the next frame. 25 | B a l l a d o f t h e M a s k e d B a n d i t s Of course, this means that there is some delay in reaction automatically to the next frame, but this is a necessary tradeoff for the improvements seen in the rest of the system. 4.7 NEW DISTRACTION SYSTEM The new distraction system comes with a new model of thinking behind it. Rather than the original single layer system, this one uses two triggers to indicate what the AI should be doing. This removes a lot of the guess work from the agents’ internal models from deciding what it should do to being told what it should do. This works in the same way as the vision system described in 4.2; it uses the event system to tell the agent to “be curious” or “dance.” Shown in the figure below is a model of the new distraction system. New two-layer distraction system model. This two-tier distraction model allows for two of the unique status IDs to be used: hear distraction and distracted. Hear distraction falls back on the patrol code 26 | B a l l a d o f t h e M a s k e d B a n d i t s as it goes to the center of the source, so it just goes to there. It is primarily there to showcase a difference for future debugging purposes to see what is happening. The distracted identifier brings in a new mechanic: it shuts down everything. It will stop at some random time within the circle, determined by the designers, and dance. Rather than enabling and disabling potentially a lot of objects, which can cost a lot of time on the CPU for lower end systems, the methods simply first check if the agent is distracted. If they are, the agents will skip all other checks beyond that. When this status breaks, the agents will immediately go into “Search” mode again and then go back to its normal behavior. 4.8 REMOVED COMPONENTS 4.8.1 FEAR STATE The fear state, as seen in 3.1’s system diagram, was a short-lived idea where some agents would enter this state and run as far from the raccoons as they could. This idea was planned to allow agents to alert other agents and bring in other reinforcements. This system had remnants in the older Day of Play alpha build but was scrapped shortly before implementation began. The reason for it being removed was primarily for it being difficult to make it feel good in small spaces. The primary level design at that point was centered around small vignette style scenes. 4.8.2 LISTENING SYSTEM The listening system, as stated previously, was entirely scrapped. This added overly complex behavior to a system that was not necessary for the shift in design philosophy. Any interactions that would result in the AI needing to shift could be 27 | B a l l a d o f t h e M a s k e d B a n d i t s generated using the Raccoon Interaction Generator tool built by the programming team. It was nothing more than a neat idea, that was overly complex for the new levels and would not add significantly to the enjoyment of the game. 4.7.3 DOG ENEMIES The dogs became obsolete as a result of the design shift. As such, they were not included in the AI rework. They lost their meaning as a result of the shift to “all raccoons have the same ability set” as another purpose was to see through Beauty’s distractions. 28 | B a l l a d o f t h e M a s k e d B a n d i t s 6 FINAL RECEPTION & CONCLUSION Unfortunately, a large pool of players is not available at the time of writing this essay due to the cancellation the EAE Department’s yearly Launch Day event. As well, the game is due to come out on May 5th, 2020 for Steam’s Early Access program. However, many members of the team’s cohort participated in testing out the new artificial intelligence. As of the most recent build, made on April 27th, the new implementation was well received and liked by small sample groups of close friends and relatives. These play testers reported that the AI felt like it made the Jail level much more tense. The simplification of the system allowed for a decent time improvement over the previous incarnation. About 1.5ms were shaved off by removing the rows branch statements that were used to cobble the original idea together and decoupling the logic to be based on events. Overall, all systems saw a significant reduction in time spent by a profiler of upwards of 7ms as they no longer had to look at each object, each frame. Rather, these systems needed only to wait to be told what to do based on the status of the agents. 6.1 FUTURE DEVELOPMENTS TO THE AI SYSTEM Critiques were mostly about the readability of the interface, again, which is something the team struggled with up until now. As well, given the game comes out on May 5th, there will be ample feedback coming in on bugs relating to the game and more importantly the agents to fix and improve. However, unless there is significant frustration levied against the new system, there will not be a massive rewrite like 29 | B a l l a d o f t h e M a s k e d B a n d i t s before. Parts will change to make room for the new procedural animation section, but nothing like an entire rewrite of how the vision system works and operates. The designers recently came back and recommended some things they wanted to see added to the architecture of the AI. This is primarily regarding how the ray casting is handled through thin walls. Going into the future, much of the time spent working with the artificial intelligence now will be in the FastIK and procedural animation department. As the groundwork has been laid for the procedural animation system to easily hook into, this can now become a much more focused task. The current tasks will revolve around supporting the Early Access bugs and making sure those are squashed before releasing prettier animations for the AI. 30 | B a l l a d o f t h e M a s k e d B a n d i t s Michael Gardone: Honors Student Birth date: February 16, 1998 Birth place: Glendale, Arizona Address: 350 South 600 East Salt Lake City, Utah, 84112 31 | B a l l a d o f t h e M a s k e d B a n d i t s |
| Reference URL | https://collections.lib.utah.edu/ark:/87278/s6q8js5q |



