Made by Bart Kristel
Table of content
1.4 Research Methods
2.1.1 The Last Guardian
2.1.2 Fallout 4
2.1.3 The Last of Us 2
2.2 Design and creating
2.2.1 The first TMC cycle
2.2.2 The second TMC cycle
2.2.3 The third TMC cycle
2.2.4 The fourth TMC cycle
2.2.5 The fifth Iteration
3.2 All the different states
4.1 A/B tests
5.1 Product results
5.2 Test results
6.1 Future work
This project focuses on the creation of a realistic state-based companion and how to actually make this work. In this paragraph will be explained what the inspiration was for this project; what the scope is of the project; what the SMART goals are that are set up for the completion of this project and finally what the research methods were during this project.
In my personal opinion, one of the biggest strengths and at the same time most lackluster aspects of game development is NPC’s or enemies. They’re often designed and made to achieve one goal and other than that they often feel forgotten. Think of quest givers or pets in RPGs. Quest givers are often standing in one place all day and pets often feel more like a projectile you shoot off than a real companion. In almost all RPGs I’ve seen pets are there for combat purposes only. You can give them commands and they do that and will keep doing that until you give them a new command. That’s why in this project I will try to do research on ways games have made more realistic companion AI. Developers often say that the reason AI is made simple and less realistic is so it doesn’t annoy the player. I want to see if it’s possible to make a pet/companion that follows commands when it has to but will also try to make it’s own decisions and in this way feel realistic while not annoying the player. The research question put up for this project is: “how can games make in-game companions feel more realistic and engaging while not irritating the players?”
Of course making a realistic AI that feels good to play around with will require a lot of balancing and designing, which will take a lot of time and won’t be doable for one person in the span of five weeks. So for this project, the focus will be on design and research. To see if there are other games that have made realistic companions and to see if they could work and add value to the gameplay. The main question for my research is, how can games make in-game companions feel more realistic and engaging while not irritating the players?
For this project, it is also important to have a testable product. For this, some pre-made assets will be used to really focus on the behavior of the companion instead of animating and modeling. The companion I will make for this project will be a dog in the form of a german shepherd. The mechanic I find most interesting to focus on will be walking with the dog. This is the activity you will most of the time interact with in most games and is for that reason from my perspective the most important aspect to research.
For this project, there is one main goal I have in mind. That is I wish to know more about the way games use and interact with companion based AI. So the goal of this is to accumulate more knowledge on this topic and to create an introduction for myself to get more into making companions. For this, the focus of this project will lie in attempting to make something like a companion myself and researching how other games make them.
1.4 Research Methods
The main research method for this project will be Library Research. In the form of available product analysis and best good and bad practices analysis. The reason for this is in this way the project can focus on what has already been done before and what worked. Then combining the results into a proper design to base the companion on. After this adjust the design to observations and research that is out on the internet to replicate realistic behavior.
This paragraph will be a detailed overview of how the process went for this project. Three topics will mainly be focussed on. These are research, design, and the creation of the project.
First off let’s talk about the goal of the research. There were multiple goals set up for research throughout the project. The first goal was to explore more about the subject of companions in games. During this part, there was a focus on three different games. The first game was The Last Guardian about Trico, the second game was Fallout 4 with their companion Dogmeat and the third game was The Last of Us 2 with a couple of human companions. The first game was chosen because this game revolves around the companion. The second game was chosen because Dogmeat is a loved companion and is added as a tether for the players. The final game that will be looked at is The Last of Us 2. In The Last of Us 2, there are a couple of human companions that you adventure with. For this research, it’s important to also include non-animal companions for this reason the last of us 2 is chosen.
2.1.1 The Last Guardian
First of all the Last Guardian, this game revolves around a creature called Trico. Trico in The Last Guardian is a combination of bird, cat, and dog and to top it off Trico is enormous. According to Video Game Animation Study, 2019 The designers of Trico, the company GenDesign designed Trico by basing his behavior on real animals. The animals used for this were Cats, Dogs, and Tigers. Trico is an animal that climbs a lot of structures and tries to squeeze itself through openings, the animations for this were based on the movements of cats. Trico can scratch itself which was based on the movement of dogs and to get movements realistic to its size they didn’t just scale the model up but replicated the movement of tigers compared to the cat’s movement to get a right feel for the scale.
Most of this is animation based. So how does Trico work in code? The source shortly mentions something about this. Trico’s actions are based on its interests. Everything that happens around Trico will be registered by Trico and will get a priority rating based on how interesting it is for Trico. Once this interest is established Trico will search for a way to get to this interest and once it reaches the interest it will decide on an action based on the interest.
Player’s Narrative, 2021 tells us some more about how Trico’s AI work in the game. The player can give Trico certain commands and Trico can follow them, however, Trico is quite unreliable in this because he will not always follow the command you give him. About 50% of the time Trico will just not listen. Also, an interesting thing to note is that when Trico comes into contact with certain pieces of mosaic in the shape of an eye, Trico will panic and won’t listen to any command you give it.
To summarize there are three things that make Trico feel like a realistic AI. The first one is animations based on real-world animals; The second one is an interest-based system that will decide what is most interesting to Trico and what he will focus on; the final one is the unreliability of Trico, sometimes he just won’t listen.
2.1.2 Fallout 4
The second game to be looked at is Fallout 4 with as the main focus Dogmeat the animal companion of the player. According to Zwiezen, 2021, Dogmeat is a dog that is inspired by a real-life dog, a German shepherd. When the game studio started working on the companion one of the developers started placing reverence pictures of German shepherds on his desk. The owner of the reverence dog decided at that time to bring his dog to the dev team and introduced the dog as a new team member. The dev team said the following about River (the German shepherd) “The more they bonded with her, the more they saw Dogmeat as a character”.
For the traits of dogmeat that were directly taken from River, in the game dogmeat will run ahead of the player, stop, look back, and wait for the player. Other than the running ahead most of the sound effects and looks were also taken from River.
2.1.3 The Last of Us 2
The final game that is used as a reference is The Last of Us 2. Tabletop Duo 2020 gives us a good overview of the companions in The Last of Us 2. In The Last of Us 2, companions are a big part of the game. For this reason, the developers of the game designed the companions to be meaningful and designed them in such a way that you care about them. One of the concepts the game uses to achieve its design goals is that the player should always be aware of the presence of the AI. One of the behaviors the game implements in the companions is that companions should always try to walk ahead of the player. This is the same principle we’ve seen in Dogmeat from Fallout 4. Another thing The Last of Us does to ensure the companion is always ahead is to rig the movement speed of the companion. They speed the companions up so the player can’t catch up.
Another thing the Last of Us implements is scripted locations. In these locations instead of the AI just following the player, they play out a scene with unique animations and unique voice lines to talk to the player. This is also a way the game gives the AI opportunity to take the initiative. To make the AI feel more meaningful you can often see the AI taking the initiative. For example, the AI can remove certain blockades that are obstructing you from proceeding or the AI can climb a rope ahead of you to scout ahead.
Important about AI in The Last of Us is that they manage to create a meaningful AI while not bothering the player. The AI will dash out of the player’s way when it’s obstructing their path and the AI will try to remove itself from the player’s gunpoint.
In this section, a quick summary of the three games will be given about the things that stood out and why those are important for this project. There were a few similarities between the three. The first is that in Fallout 4 and The Last of Us 2, there was a clear focus on having the companion walk ahead of the player. They came from two different places. In Fallout 4 it was taken from a real dog and was observed as one of the behaviors of the said dog. While in The Last of Us 2, it came from a design choice of wanting the player to be aware of the companion.
Another similarity between this time The Last Guardian and Fallout 4 was that they both implemented the behavior of real animals. While Fallout 4 only needed 1 german shepherd to replicate, The Last Guardian needed several different kinds of animals.
A difference between the games The Last Guardian and The Last of Us 2 is that while The Last of Us 2 tried to remove the AI from disrupting the game, The Last Guardian played in on that a bit by giving Trico a chance to not listen to commands.
The final thing that really stood out was in The Last Guardian, that Trico behaves according to an interest-based system. which might be interesting to use in this project.
2.2 Design and creating
The design of the companion is an important part of the process however for this project, it was not one of the main focuses. Of course, when creating something you still go through a few design cycles and those will be explained here.
2.2.1 The first TMC cycle – setup for failure
For the first design cycle, I was thinking about what I was going to make. The first plan was to make a crossroad where the AI had three different options for going to and based on where the player previously went it will proceed in that direction. So based on machine learning, the AI weighs the probability of the player going onto one of the three roads and then choosing that direction. I got this idea from my dog. My dog always walks ahead of me and when we reach a crossroad she will start going into the path she thinks I will head into and after that stand still, look back at me, confirm I will really go that way and once that’s confirmed she continues on.
Before working out that plan. The first thing that was necessary for the project was to research how other games implement companions. The reason is that even though there are a lot of bad examples of how to implement companions, there are also a lot of good ones. It would add a lot of value to the project if there it could be based on these other games. The results of the research are in the previous chapter.
To create the crossroad idea I first had to design and make a state-based AI that had the possibility of going through that cycle. So I designed a system with enums that relate to a state where you simply change the current and it will proceed to a different state. I got this idea from how a few colleagues during my internship made state-based AI. However, because I don’t have any experience with making state-based AI this didn’t really work. It worked out at first. I created an AI that ran ahead of you however once I wanted to interrupt the state or anything that changed the state a bit it wouldn’t work out and I wasted a lot of time trying to fix that and I couldn’t get it to work. So because I didn’t have a lot of knowledge on this topic I decided that it would be better to get rid of this script and start over from scratch.
2.2.2 The second TMC cycle – fixing the failure
After my first attempt at making stated-based AI didn’t work, the plan became to create a simple state-base following a youtube tutorial. The tutorial used for this is Code Monkey, 2020. This setup was quite simple to put together. The downside of this setup was that it was mostly all from one script however it gave me way more adaptability than the previous setup and once this setup is complete, it is always possible to optimize it. instead of using a property to switch states, this new setup used two switch statements. One switch statement was in the update and called the update method of a single state. In the update method of a state is where sort of the body of the state is. The other switch statement was called on whenever a state was changed. This was used for changing animations and other stuff that had to be updated whenever a state was changed. Both switch statements switch between an enum that was made. Just like the other state base, this enum had the names of every state. During this TMC cycle, there were already a few States made. More on that will be in paragraph 3 Features.
2.2.3 The third TMC cycle – Expanding the system
Once the state base was finally set up I could start working on the actual companion. However, once I got to this point it became clear that my previous idea of adding a crossroad was not the best way of researching this AI. The reason for this new find was that a part of my research was coming together at this point and that research showed more interesting behaviors I could focus on. At this point, I put aside having to make a plan on what the AI should be able to do and started doing more research on what my available options are. To start off I searched for some available assets on which I could base my companion. Two assets I came across were a wolf and a human by MalberS Animations, 2022 and 2023. I liked these assets a lot mostly because the animal was in the form of a wolf. I myself have a German shepherd dog. So I already had an idea I could base it on her however this set it in stone and concluded that I will use my own German shepherd for observations.
Important information about the assets. For the companion, I’m only going to use the models and the animations. The entire AI will be written by me and I will also make my own animation controller. As for the Player because player movement is not what this project is about I will use all of the assets that are included for the player. This includes the player’s movement, the player’s model, the player’s animations, and the player’s animation controller.
So once the assets were ready and the state base was ready I thought of what else I needed for this project and a few things that came up during brainstorming were:
- A core mechanic for the companion
- A study on German shepherds to compare behaviors with
- Observations about my own German shepherd.
- Using the observations and study expanding on the core mechanic.
So as a core mechanic, I already had a plan in mind. The focus is on the companion leading your way and during the first state base I already made a start for that. So during the research on the perceived behaviors of German shepherds, I continued working on the companion leading the player.
So to start the research on German shepherds I found a very interesting study that did a behavior test on German Shepherds by Ruefenacht, S. (2002). The study was specifically focused on the inheritance of traits of German shepherds. This study applies to this research because for the companion the most important is the traits of the dogs and that’s mostly what the paper is about.
Over 60% of German Shepherds showed no nervousness while taking different tests.
Over 80% of German Shepherds showed no fear of gunshots. Dauntless behavior.
Over 60% of German Shepherds showed high alertness to their surroundings during the tests and in quite a large area.
Close to 70% of German Shepherds showed forceful play with toys, meaning they had an untiring interest in the different visual and acoustic objects.
Over 60% of German Shepherds showed Sharpness towards the judges of the tests. Meaning that during threatening situations the German Shepherds were alert toward the judges but when the tests were over the German Shepherds calmed down and showed friendly behavior again.
Just over 50% of German Shepherds showed a defense drive toward their handlers. Meaning that when the handlers were threatened the dogs showed guarding behaviors.
Just over 40% of German Shepherds showed a drive to attack seriously threatening judges.
The conclusion we can make from these results is as follows: German Shepherds are a generally calm and alert race of dogs. They show high interest in their surroundings and can show high focus on tasks in front of them. German Shepherds generally are quite fearless and show a need to defend their handlers from threats.
The American Kennel Club (2022) tells us some other descriptive information about the dog breed. German Shepherds are generally quite an active and athletic breed. They require a lot of exercise for their mental and physical well-being.
The in-game implementation according to these statistics will be the following. The companion should have a high alert towards other living objects in the surrounding. The surrounding, the companion checks should be quite a large area. Because of the calm and secure behavior, I would say the companion should walk in front of the player to already scout their upcoming terrain. The companion should show high alertness toward what the player will be doing. Meaning that if the player decides to walk in a different direction the companion should respond to it quite quickly. The final trait the companion should have is that it’s not walking a specified distance in front of you but it’s running quite a distance ahead and sometimes returning to check up on the player or at least stand still and look back at the player.
Now finally as a check on this research, I wanted to compare it to my own German shepherd. Some observations I found were the observed German shepherd tends to walk quite close by actually. She doesn’t run too far away however she does always keep an eye on the handler. If the handler does disappear from sight, the German shepherd will stop whatever it’s doing and run toward the last place the dog has seen the handler. The German shepherd tends to be quite defensive towards other dogs however this behavior might be learned instead of the dog’s own trait. Some other non-related observations were the German Shepherd’s base walking speed is faster than a human’s. If the human is walking at 6 km/h I would estimate the dog is walking at about 8/9 km/h. The same is true for its running speed. While trying to keep up with the dog it will sometimes start standing still because it’s simply faster and will wait until you catch up. This also happens when walking. Sometimes it will start sniffing something on the ground or start focussing on birds in its view while waiting on you. So all in all I would say the study can be fairly well compared to the behavior of the observed German Shepherd. I think both have quite the same traits however one difference is that the observed German Shepherd walks fairly close by while others could walk further away.
2.2.4 The fourth TMC cycle – Implementing the research
Now, most of the research is done. This part of the process is trying to implement what was observed and found. Out of all the discovered traits, there will have to be a selection of which ones to use. For this, I think it’s important to at least have in mind that all decisions will be made with the observed dog in mind. That is the base of the companion.
So first off for the lead state, it’s important to decide a speed the companion will have. when compared to the observations made, it should be about 1.5 times the speed of the player. This way the companion can quickly adjust to movement changes of the player and will most of the time manage to run ahead of the player.
The second thing to decide is how will the lead state work. When referencing the observed dog because the dog walks quite close by the decision is to have a few distance checks on the companion. The first one should be in a horizontal line on the player. Once the companion crosses this line it will mean it is behind the player. At this point, it should try to lead the way again and start off in a running state. The second distance check should be about 8 to 9 meters in front of the player once it crosses this line the companion should start to slow down and maybe revert to walking speed again and the final check should be about 15 meters ahead of the player. if the companion reaches this distance it should come to a halt and only start moving again once the very first distance check has been reached.
Now for the code. It isn’t a lot of code but there was a lot of balancing in it. Some things that were discovered while making it was that having it switch from running to walking again felt a bit awkward so it was changed to when it reaches the second distance check it will sit until the player moves away from it again. The first distance check was also removed. this was changed from being a horizontal line to simple being if the player walks away from the dog it will start leading again. So when the distance between the companion and the player becomes bigger it will go back into the lead state. this is checked in the fixed update.
Whenever the lead state gets initialized for the first time it will update a few settings. The companion works with a nav mesh agent. This agent does all of the path-finding and it’s as simple as adding a destination to the agent and the agent will do the rest. So when the lead state gets initialized it will set the destination of the lead state and will disable the agent from working until the correct animation is running.
The second thing the initialization of the lead state does is set the animation. Using the animations that came with the assets I made an animation sequence where the default animation is the sit animation. I choose the sit animation to be the default because dogs tend to sit down or lie down when they’re not doing anything.
Now finally the body of the lead state. The main part of the lead state is in the state handler which is located in the fixed update loop.
Every update the companion will set a new destination for the nav mesh agent. After that, it will check if the player somehow got closer to the companion and if yes it will continue leading. The next check is related to the starting point of the companion. if the companion is further away from the destination then the player will never sit down. Finally, the last check is if the companion is far away from the player. If this is true it will set a new starting position which is related to another state called the wandering state. It will switch the state to the sitting state, which as previously mentioned is the default state.
2.2.5 The fifth iteration – refactoring , Priorities and final behaviors
For the fifth and final iteration of the project, the focus was on adding more behaviors and refactoring the made code so the final behaviors can be more easily implemented without making classes with over 60 lines.
The first thing I did was refactor the written code. previously the entire AI was in a single class. So to add more behavior, I would’ve needed to make the already big class into an even bigger class. Now every single state/behavior would get its own class. the almost 200 lines of code AIBase class went from a tangled mess to these three methods.
Every individual behavior was also put into an array in the AIBase which keeps a record of the current state and makes sure only 1 behavior is active at a time.
Once the AIBase was refactored it became easier to implement the next part I wanted to add, the priority list. The priority list works as follows. Every single behavior the AI has has a priority given to it. A priority is a value between 0 and 100. Based on the priority given to the behavior the AI chooses which behavior to do. It always picks the highest number to do. To give the priority system more useability I separated each priority number into two values, the first value is the maximum priority and the second one is the current value. For example the following behavior has a maximum priority of 90, however if you are quite close to the companion you might want the companion to focus on more important stuff than following you but if it has nothing else to do you want it to follow. so instead of it overwriting pretty much every other behavior with a value of 90, you can put the current priority value to 30. this way it won’t idle because idle only has a priority value of 1, but it also won’t override more important behaviors.
All the priorities are kept in a single array. The AI Priority script checks every fixed update if there were any changes in the highest priority and uses the switch method in the AIBase to change the current behavior.
Once the priority system was in place all that was left to do was add more behaviors to the AI. This was quite simple to do because of the refactoring and the new priority system.
The new behaviors added were the Sniff Behavior; the Protection Behavior and the Entity Behavior. More on these behaviors in 3.2 The different states.
In this paragraph the focus will lie on the features implemented in the companion and the player.
One of the most important features of the companion is pathfinding. It shouldn’t walk through walls it should notice when it can’t go further. The way this companion has pathfinding is by using the Unity Nav Mesh Agent.
The Unity Nav Mesh Agent is really simple to work with. All I had to do to start the process was create a new agent. I called the new agent “dog”. I also gave it a custom height.
Once this was done I added the Nav Mesh Agent to the companion and adjusted the speed of the agent to what I wanted it to be.
All I had to do after that was make the environment in the scene static and bake the navigation onto the objects in the scene.
Now that the Nav Mesh Agent is working setting destinations for the companion is really simple all that has to be done is call the agent and set its destination, also adjusting the speed from walking to running can simply be done by setting it on the agent.
3.2 The different states
The Companion has six different states it can cycle through. This section includes each one of them and some code snippets will be presented.
3.2.1 Idle State
The default state of the companion is the Idle state. This state is a collection of three individual behaviors. The idle state has a priority value of 1 and will always be 1. If there is nothing else to do, the companion will idle because of this. The three behaviors in this state are; The Sit Behavior; The Wander Behavior and the Sleep Behavior.
188.8.131.52 Sit Behavior
The default behavior of the companion is the Idle state. When the companion has nothing else to do it will default to sitting. There are a few things included in the Sit state. Whenever the companion is going to sit down, according to the research it should keep an eye on the player. To accomplish this behavior the Nav Mesh Agent gets a new destination for the player. The companion will rotate for a second and after that, the Nav Mesh Agent will be stopped. So the player sits while looking towards the player.
The second behavior implemented in the Sit state is a decision on what to do if it gets bored. For now, this is replicated with a timer. Once this timer has reached a certain threshold. The companion will decide if it wants to lie down and sleep or if it wants to wander around. This is decided based on random chance.
184.108.40.206 Wander Behavior
One of the states the sit state can randomly transition into is the wander state. In this state, the companion walks toward a random location nearby. once it gets close to the location it will have a chance to repeat and wander to a new location or sit down again.
A few things to take note of in the wander state. It will never wander too far away. At the end of each lead state it will set a new starting position. The wander state uses this position as the origin point of a new wander location. Also the wander position won’t start until the correct animation is playing.
220.127.116.11 Sleep Behavior
As for the sleep state. This is probably the most basic state. When the sleep state is called the script will start a new timer. Once the desired time has been reached which is at the moment 30 seconds. The state method will initiate a new state. Either the wander or the sit state.
3.2.2 Call State
The second state is the call state. Every single state can be interrupted at any point by the call State because of this the call state has a maximum priority of 100. As stated in 2.2.3 the german shepherd should be highly alert of what the player is doing at all times. For this project in my opinion this would mean that it’s biggest priority should be staying close and listening to the players commands. Then what the call state does is when the player presses the key “T” on their keyboard. The companion will start running toward the player. How this works in the script is that a new destination will be given to the Nav Mesh Agent. This destination is 6 unity units in front of the player on the line between the companion and the player. Once the companion is close enough the companion will switch back to the sit state and sit near the player.
3.2.3 Follow State
The follow state is the third state of the companion. It has a maximum priority of 90 but can switch between three different values. If the companion is close by the value will be 35, if it’s a bit further away it will be 50, and on the maximum range it will go to the max priority of 90. To further expand on why these values were choosen. The lead state is in a bit of a similar spot to the call state in its opperations but because the call state is a command of the player it should have a slightly higher priority that’s why the maximum priority for the lead state is slightly lower and is 90. The next value of 50 comes from the behaviour of the german shepherd to want to protect and work for the owner. The protection state and other work/protection related states should come slightly higher because within the medium lead distance the companion is still relatively close to the player so would most likely prioritize those types of states over leading. Now 50 choosen to leave space for those types of states. Now lastly for the 35 value/ the lowest distance check. The companion is really close so it would prioritize alot above leading because securing/ protection is easily doable from this position so it’s a safe spot for the companion to do more leasure stuff.
Most of the Follow state can be found in the previous section (2.2.4). This includes code snippets.
3.2.4 Protection State
The protection state is the fourth state of the companion. It has a maximum priority of 80. It has a priority of 80 because the german shepherds in 2.2.3 showed the need to protect meaning that it would value this quite highly. I put it below outer leading because if the player is too far away there is not a lot to protect. Somewhere in the scene of the companion is a red cube hidden that will appear for 10 seconds every 30 seconds. When this cube appears it will make an explosion sound. When the companion is in range and the explosion goes off the companion will try to protect the player by running between the player and the explosion.
3.2.5 Sniff State
The sniff state is the fifth state of the companion. It has a maximum priority of 40. It’s more of a leasure activity, there is no protection involved whatsoever so it should come slightly above the lowest lead distance. In the scene are three different bushes which act as “sniff points”. Once the AI comes close to one of those sniff points it will max out the priority of the sniff state. Once the sniff priority has the highest value, the companion will run toward the sniff points and stand there for a bit. every 0.5 seconds while on the sniff point, the priority will drop by 1. This makes it that it will gradually lose interest in the point, and if the player is in the follow radius of 50 it will after 5 seconds follow the player again. If the player is in the follow radius of 35 priority it will follow the player after 12.5 seconds again.
3.2.6 Entity State
The final state of the companion is the entity state. This state has a maximum priority of 70. Unknown entities could form a protection response from the companion. The companion would highly alert to the entities, this should be about the same as the protection state however because a loud noise is more instant I deemed this to be slightly below it so in the moment it would most likely respond to the protection state. In the scene is a dumb AI cube. This cube simulates an entity. it runs between a few points. If the companion is in range of the cube it will start chasing the cube. because german shepherds showed an untiring interest in toys, I made it so that if the player is in range, the companion will keep chasing the cube indefinitely. The circle of the cube is quite big so if the player isn’t actively running with the dog the dog will be in the follow radius of 90 and will start following the player again instead of chasing the cube.
In this paragraph there will be some explanation on how and what has been tested in this project. A/B tests has been chosen as the method for user testing and there will be further explanation on how this was done and what kind of questions were put up.
4.1 A/B Test
The method for testing has been decided to be A/B testing. The reason for A/B testing is that the project is mostly about the differences in how companions have been implemented and the reasons why some companion feel better than others. A/B tests give the opportunity to compare the behaviours that have been implemented with a more basic variant. The result that is hoped to be achieved is a clear distinction between a certain behaviour and the more basic counterpart of it. Specifically the leading ahead behavior has been tested using this method.
For this A/B test two different versions have been made. One version has the dog companion that is leading in front of the player as has been researched. This will mean that this companion in general has more screen time because it will appear more often in front of the player. The second version that has been made is a version where the companion is following behind the player. This will generally mean that the player will have to look around more to see where the companion is.
Both versions have the same goal. The testers goal will be to find three different collection/sniff points. The only way to find this is with the companion because if the companion is close by it will be attracted to the points and once it collides with a point, the player will collect that point. Once all 3 points have been found or the player gives up is when the test will end.
after the test ends the player will be asked to fill in a questionair about the test. 7 testers have tested version A and 9 have tested version B.
The questionair has 7 different questions. They 6 of them are asked in the form a scale from 1 to 10 this is so the data is easier to compare between the two versions.
First the questionair will start of with how many points the tester has collected. We can compare this between the two versions and see if the achieval rate changes depending on the behaviour. The expected result is that there shouldn’t be too much of a difference and if there is a difference that it should lean towards more collected points for version A, the lead behaviour.
The second question will be if the tester found the objective difficult to achieve. The answer to this will indicate if seeing the companion more often makes the player feel like they have an easier time achieving the goal. The expected result is that players will have an easier time with version A because they will have to rotate the camera less to see what the companion is doing.
The third question will be more about if the player felt like they were in control of the companion. The fourth question will be about if the player found the companion reliable and the fifth question if the companion was responsive. all 3 of these questions give us data about the quality of the companion and using this we can compare if the companions quality is increased with leading ahead. The expected result is an improvement in control and responsiveness. Because the dog is getting distracted a lot I don’t expect a big difference in reliability.
The sixth question will be if it was difficult to keep track of the companion. The expected result of this is that version A will be more easy to keep track of because of the reduced input you’ll need to see the companion.
The final question will be if it was enjoyable to walk around with the dog. This will directly link back to main question of the research to see if it has become more annoying or not to have a companion. The expected result will once again be that version A should be more enjoyable but especially if the result is different this could be interesting.
Finally the results. In this shorter paragraph, there will be more shown about the working of the companion. There is also a short overview video
5.1 product results
The goal of this project was to learn more about how games make realistic and interesting companions. Personally, I especially liked The Last of Us 2 and the Trico example. It’s really interesting how Trico works on an interest-based system and I would really like to get to know how they exactly made it. Sadly I couldn’t find more information about it.
One of the things that didn’t quite go as planned was the first state base I made. I kept trying to get it to work but I couldn’t and that already took a few weeks. What I learned from that is definitely as a start-up it is better to use someone else’s base than try to create something way too complicated yourself. However it was fun to try and it might still be a way of optimizing the state base but I will have to test that.
Here is a video that showcases all the states the companion:
All in all I feel like the companion has gotten quite close to what I would want it to do. Most basic features are in the project. I’m very happy with the priority system, it works wonderfull but cycling back to the start of the project. I haven’t gotten around to getting valuable feedback on the workings of the companion and how to make it less “irritating” to work with. However from the research I’ve done we can atleast say that multiple solutions have to be combined depending on the situation to make a companion feel natural and good to work with. For example giving the companion more screen time with using a leading ahead state and making ways for the player to casually interact with the companion to bond a connection can help. What annoys players is random stuff to occur like with Trico to randomly just not listen to the player.
However from a personal perspective I’ve learned quite a bit from this project. I’ve learned that what I knew about state machines before this project was very limitted. During a few lessons in school I’ve extended on a state machine but never made one from scratch. Previously I’ve also almost never worked with AI except for maybe a few simple enemies. This was a new experience. During this project by refactoring my code often I discovered some tendencies I have when structuring my code and now I had the opportunity to fix that. I also re-learned that scope is very important. I first had to make an entire state machine and make external code/characters work. After that I had to make it feel semi-okay to play around with just. All this just to start testing and find ways to improve it. This wasn’t really an achievable goal.
5.2 test results
All in all the test turned out fine. Most of the testers managed to find three points. There were a few who didn’t, they had a hard time because they didn’t really understand when the dog was collecting the points. A lot of the feedback that was gotten from the test was also about the little feedback that was put in the application.
Even though many testers managed to find all three points the difference in how testers perceived the companion was quite big. The average of points testers found in version 1 was: 2.6 and in version 2 was 2.4.
The difference in average of the perceived difficulty of the test was about 1.6. One of the things noticed during the tests in version 1 was that players tended to keep moving. testers expected the companion to walk ahead of them. while in version 2 where the companion follows there were often more down times where testers were waiting on the dog. I think this is because when the testers saw the companion running ahead of them they expected this behaviour to happen again. So it was more of a given that the companion will move with them. While when the testers couldn’t see the companion because it would walk behind them. They had to sometimes check up on the companion.
The responsiveness of the companion improved a lot when using the lead state and the reliability of the companion also improved a lot. because my expectation was that the test was quite difficult I didn’t expect testers to notice a lot in reliability of the companion but they did.
Testers found the companion quite random at times. The animations were not always correct with it’s movement. They often didn’t really understand when it was searching. Also almost all of them didn’t understand how to collect points until it was explained. furthermore some animations didn’t line up with the movement which was often pointed out.
Testers found it quite easy to keep track of the companion. There weren’t a lot of differences between versions. Most answered about 3 or 4 with some exceptions where the companion was gone for a while. Probably stuck behind a tree.
As for enjoyability testers rated it between 5 and 10, a lot of 10’s we’re filled in in version B only because they happened to like dogs so the data came out not applicable.
Extra information that was gotten during the tests was that testers really lacked feedback on when they got a point and when the dog was searching for them. The testers also gave a lot of feedback about the FoV of the camera. Also afterwards I let two of the testers play the other version and they agreed that version 1 was way more pleasing to play and they also said that because it was leading ahead it felt like it was taking them somewhere and was more actively searching with them.
The research aimed to identify effective strategies on how to create companions in games that feel realistic and engaging while not irritating players. Based on the qualitative research, the research on what games have used in the past to create companions to quantitative research on the leading ahead behaviour, it can be concluded that small details like where the companion positions itself in respective to the player and how the animations flow are important factors to consider when designing and creating companions. The results indicate that players put a lot of emphasis on how the animations progressed and on how the position of the companion relative to the player gave a different feel to the companion.
The companion that was tested felt more reliable and also felt like it helped the player more when leading ahead of the player. So for this specific instance and objective leading ahead was the better position for the companion to be in. Meaning that when you have to be able to rely on a companion for a certain objective, players will find it less irritating if the companion leads ahead of the player. It makes the companion feel more like it’s doing it’s job.
While the results clearly indicates towards the difference in how the companion was perceived it does still raise some questions on the animations because this was not the goal of the test. It also comes back in the quantitative research that trico is using procedurally generated animations. This will be talked about further in 6.1 future work.
Based on these conclusions, companion designers should think of traits of the companion. Is it a companion that would take the lead or maybe walk side by side with the player. For example if you would make a beast handler class for an RPG you could make a owl that flies to the side of the player; A wolf that leads ahead and a cheatah that prowls behind the player. It all depends on the role and the objective the companion has to fulfill.
6.1 Future work
I would like to continue research on ways of making companions more realistic. In the research on Trico from the Last Guardian I discovered that they use procedurally generated animations to make the animations feel better and create them at runtime. I would like to explore more ways of intergrating the animations into the design.
Another way of making the companions more realistic is designing them towards their real life animal. During this project I tried to do it too but it felt a bit seperated from the rest of the project so I would like to do more research on how exactly designers went about researching this and dedicating a seperate project to it.
APA Sources list:
Zwiezen, Z. (2021, June 27). River, The Real-Life Dog Behind Fallout 4’s Dogmeat, Has Passed. Retrieved March 9, 2023, from https://kotaku.com/river-the-real-life-dog-behind-fallout-4s-dogmeat-has-1847181914
[Video Game Animation Study]. (2019, December 15). How Trico Was Animated / Video Game Animation Study [Video]. Youtube. https://www.youtube.com/watch?v=TfZtIKMhULw
[Player’s Narrative]. (2021, August 17). Why Trico’s AI is unreliable [Video]. Youtube. https://www.youtube.com/watch?v=4QjY2b404dY
[Tabletop Duo]. (2020, October 9). The Last Of Us: Part 2 Companion AI – Game Design Explained #3 [Video]. Youtube. https://www.youtube.com/watch?v=6WsqPM3_ahI
[Code Monkey]. (2020, January 8). Simple Enemy AI in Unity (State Machine, Find Target, Chase, Attack) [Video]. Youtube. https://www.youtube.com/watch?v=db0KWYaWfeM
[MalberS Animations]. (2022, October 12). Poly Art: Wolf [Unity Asset]. Unity Asset Store. https://assetstore.unity.com/packages/3d/characters/animals/poly-art-wolf-78795
[MalberS Animations]. (2023, February 17). Animal Controller [Unity Asset]. Unity Asset Store. https://assetstore.unity.com/packages/tools/animation/animal-controller-148877
Ruefenacht, S. (2002). A behaviour test on German Shepherd dogs: Heritability of seven different traits. ScienceDirect. https://doi.org/10.1016/S0168-1591(02)00134-X
American Kennel Club (2022, December 11). German Shepherd Dog. AKC. Retrieved March 15, 2023, from https://www.akc.org/dog-breeds/german-shepherd-dog/