Hello Folks! Welcome to Our Blog.

The Week 3 challenge is to reverse engineer an artefact using some of the prototyping techniques we’ve studied to produce a prototypal representation of the artefact. For this challenge I’ve chosen to look at Behavioural AI as it commonly found in simulation and survival games and prevalent in the RTS, FPS and RPG genres too.

Perhaps one of the most obvious examples is The Sims 4. As this is an extremely complex system, to simplify the task of reverse engineering it I propose to restrict my analysis to just look at a thin slice through the game AI and focus on the base need of Hunger. I should point out that in many ways The Sims 4 echoes real human behaviour insofar as needs, motivations and emotions are all intertwined. Just as in a human being, the base physiological need of Hunger can and will trigger a range of behaviours and emotions, this is also the case in The Sims 4, “In other words, relatively isolable as these physiological needs are, they are not completely so” . As such, my thin slice may serve the needs of creating a simplified model or prototype but it should be remembered that the actual game is far more complex than this.

Fig 1. THORN, 2020 Simplified Hunger Need — The Sims 4

The basic concept behind the Hunger need in The Sims 4 is very simple. Hunger gradually increases over time until it crosses the “Hungry” threshold. Once the Sim becomes Hungry it searches for food and eats something to reduce its hunger level again. If no food can be found, the Sim’s hunger level will continue to rise until it becomes Ravenous and shortly after will ultimately die. Note also the emotion or mood of the Sim is also affected. In the example below, this Sim is Hungry and that is making it Uncomfortable.

Fig 2. THORN, 2020 The Sims 4 — Uncomfortable owing to hunger need

When left on its own, the Sim’s AI takes over and performs a series of autonomous actions driven by a particular need. In this case, my Sim went off to find and eat some food. It is this behaviour system I want to look into and reverse engineer for this challenge activity.

This type of behavioural AI is based on the GOAP (Goal Orientated Action Plan) system as originally conceived by Jeff Orkin in his paper “Three states and a plan” . There is also an excellent overview of GOAP by Dr. Penny de Byl in her YouTube video for Hollistic3D.

Fig 3. THORN, 2020 Hunger driven behaviour prototype

In running through this example, two things immediately leapt out at me:

  1. How quickly the net list became complicated.
    For this simple case there are 10 discrete paths through the net from Hungry to Not Hungry.
  2. The amount of reuse I found for such a small model
    Several of the atomic actions I identified feature on multiple paths.

The second point is a very interesting one. If we take, for example, the ‘Take Meal’ action, it can be written, tested and debugged in isolation from all the other actions. This will significantly simplify the development of the game whilst still allowing complex behaviours to be created as they are integrated into the AI system.

For the purpose of this exercise I took the typical actions a hungry Sim would perform and manually created the above net list. In reality, the AI would have significantly more actions to call upon allowing for many more paths through the net. For The Sims 4, each character has 6 needs (Energy, Hunger, Bladder, Fun, Social and Hygiene). Hunger is perhaps one of the simpler cases as it boils down to ‘Get Food –> Eat Food’. Looking at the vast array of possible actions each Sim can perform the game AI will very likely have tens or even hundreds of thousands of paths in its net list and multiple triggers for each need.

One final and very important point to consider is how easy it is to modify the behaviour, e.g. by installing downloadable content. One simply has to install new actions and any artefacts the Sim interacts with and prompt the AI engine to rebuild the net list.

From a software architecture perspective, GOAP is a thing of beauty.

Prototype Development

Based on the above I decided to develop a GOAP-based AI concept for a survival strategy game I’m planning to develop. In it, the player controls a colony of space explorers who have crash landed onto the surface of a hostile wold (think The 100 meets Lost in Space meets Command and Conquer).

In order to survive, the player needs to maintain the Colonists’ morale and health whilst simultaneously ensuring they are not too fatigued to work or fight off the ever increasing threat from the planet’s indigenous people. To survive, the Colonists will need to collect/manufacture oxygen, power, food and building materials.

MoraleHealthFatigue
TechnologyHungerRest
WeaponsThirstAccomodation
DefensesHygieneFood and Drink
ShelterSanitationSocialising
EntertainmentPowerWork detail
PowerDiseaseOxygen
Death rate
Primary Traits and affecting factors

For this prototype I will consider the Health trait and the various game elements that contribute towards increasing and decreasing it. I’ve indicated these on the forcefield diagram below:

Fig 4. THORN, 2020 Health Trait — Incrementers (+) and Decrementers (-)

In this diagram, the closer the lozenge to the centre line, the less it impacts the trait.

Needs

Hunger

Fig 5. THORN, 2020 Hunger Need and Actions

Cook Food and Visit Canteen will only be possible if there is sufficient power available. This can be built into the system to only allow these actions if the base is powered.

Steal Food, whilst having a positive impact on the health of one Colonist, will have a negative impact on the morale of the victim of the theft and quite possibly their health too.

Thirst

Fig 6. THORN, 2020 Thirst Need and Actions

Buy Drink implies the need for the NPCs to have money or something to trade with. This itself could introduce an interesting dynamic built around some form of autonomous economy. NPCs would earn differing amounts of money depending on the jobs they perform. As the NPCs wealth increases/decreases it would, in turn, directly impact their morale. NPCs performing lower paid roles would ultimate end up very demotivated and disillusioned and be increasingly more likely to revolt. The big challenge with introducing an economy is ensuring a circular flow of cash which may be difficult to balance.

Disease

Fig 7. THORN, 2020 Disease/Sickness

Colonists suffering from extreme fatigue or eating bad food may become sick. Poor sanitation and hygiene may also lead to sickness. Depending on the nature and degree of the sickness they may need to visit the sick bay, take medication or simply just rest. In extreme cases they may perish.

Other contributing factors to sickness might be oxygen deprivation, work accident, injured defending the base from attackers.

Hygiene/Sanitation

Fig 8. THORN, 2020 Hygiene/Sanitation

Decontaminate could equally fit under sickness as well, for example if the Colonist has radiation poisoning. The flow here could be…

Fig 9. THORN, 2020 Radiation Poisoning

In this scenario I’ve indicated a more complex sequence of actions based on how quickly the NPC is decontaminated following radiation exposure.

Conclusion

The sketches above are by no means exhaustive. I found the first part of this exercise particularly difficult to complete, taking most of the day if I’m honest with most of that time invested in research, reading around the GOAP system and subsequently mapping The Sims 4 to it.

Once I’d reached that point, developing the ‘prototype’ system was fairly straightforward and the latter part of this post follows my thought process as I worked through the problem. In a real-life situation my workflow would most likely be highly iterative. The initial thoughts being loose and woolly as described here before being refined each and every time they are revisited.

Reflecting back on this post now, I feel there are improvements to be made. The overall concept for the games the potential to be significantly improved upon. As it stands I feel it’s too close to other titles within the same genre and/or not enough of a differentiating element for it to stand on its own. I like the overall theme though and plan to run this again but this time after first running it through some of the creativity techniques I studied last week. My plan now is to update the ‘Journey’ part of this blog to take the underlying theme for this game and document the entire design process from start to ‘finish’ — whatever finish means in the context of this activity. This will then form the basis for my Capstone Video assignment.

Closing thought…

There is an argument to suggest that sketches such as these are not prototypes . In this case I tend to agree. The sketches I’ve presented here are more concepts from which a prototype could be derived; the prototype in this case most likely being implemented in software as a tool to experiment with timings and balance or even just to ‘prove’ the ideas.

I’m not sure I would agree in every case though. As I’ve mentioned on previous occasions, one of my primary design tools is the whiteboard. In much of my work over the years I’ve used it to constantly refine my ideas and create a sketch that I can then ‘exercise’ and ‘stress’ by marking it up and adding annotation, at least to test the theory.

List of Images

Figure 1. THORN, 2020 Simplified Hunger Need — The Sims 4

Figure 2. THORN, 2020 The Sims 4 — Uncomfortable owing to hunger need

Figure 3. THORN, 2020 Hunger driven behaviour prototype

Figure 4. THORN, 2020 Health Trait — Incrementers (+) and Decrementers (-)

Figure 5. THORN, 2020 Hunger Need and Actions

Figure 6. THORN, 2020 Thirst Need and Actions

Figure 7. THORN, 2020 Disease/Sickness

Figure 8. THORN, 2020 Hygiene/Sanitation

Figure 9. THORN, 2020 Radiation Poisoning

References

BUXTON, Bill. 2007. ‘What Sketches (and Prototypes) Are and Are Not’. Carnegie Mellon University [online]. Available at: https://www.cs.cmu.edu/~bam/uicourse/Buxton-SketchesPrototypes.pdf [accessed 10 Oct 2020].
DE BYL, Penny. 2018. ‘An Introduction to Goal Orientated Action Planning’. YouTube [online]. Available at: https://www.youtube.com/watch?v=jUSrVF8mve4 [accessed 10 Oct 2020].
ORKIN, Jeff. 2006. ‘Three States and a Plan: The A.I. of F.E.A.R.’ [online], 18. Available at: http://alumni.media.mit.edu/~jorkin/gdc2006_orkin_jeff_fear.pdf [accessed 10 Oct 2020].
MASLOW, Abraham. 1954. Motivation and Personality. New York: Harper and Rowe, Publishers, Incorporated. Available at: https://archive.org/details/motivationperson00masl_0 [accessed 10 Oct 2020].

Share your thoughts...

text/x-generic footer.php ( PHP script text )
ScaryBlankPage®
%d bloggers like this: