It's probably not a surprise by now but as the title says, yes - we are idiots. Let us explain...
NPC Behaviour
Current Implementation
NPC behaviour in our game has been based on a state machine. An NPC can have a state, whether sleeping, eating, or just wandering. When certain conditions are met, the state of an NPC will change, and they'll start to do some predefined behaviour that we tell them to do. An example would be that when it is past 11 pm, and an NPC has a bed, the NPC should pathfinder to the bed and sleep.
Example of a state machine
This works completely fine for the most part until weird scenarios start popping up. For instance (as a pure hypothetical), what happens if there's an unexpected event such as an emergency at 11 pm? In that case, we may have to go through our existing codebase, and make a check for this event, essentially micromanaging what an NPC can do at any one time within different parts of the codebase. Furthermore, NPCs can seem very robotic - in our example you know that at 11 pm on the dot they will go to sleep no matter what.
Now it's obvious that this isn't a great long-term plan, but we completely missed better alternative approaches - until right now. Introducing... Utility Systems aka Utility AI.
Utility AI
Utility AI is a popular way to model the behaviour of NPCs, found in games such as The Sims series. The main idea is that every NPC has a set of needs that they would want, which we are calling desires- such as rest, food or comfort. Each of these desires has a score associated with it, that is constantly decreasing at certain fine-tuned rates, which increase when a related action is being performed. For example, one of the desires will be `bladder`, whereby when they go to the toilet, their score will increase. NPCs ideally want each desire to be as high as possible, so to replenish their scores, they can choose to do actions in the world to satisfy all their needs.
To get a list of possible actions, any object in the game can advertise itself as a "fix" for a desire - for example, a toilet will advertise itself as "Use me to get +10 `Bladder`" or "Clean me to get +5 `Tidiness`", or NPCs can offer themselves as a way to relieve (Social) desires.
The final step is every NPC looking at all the advertisements in the world, and ranking them from highest score to lowest score, using their own current scores, the distance away from the action, the amount the advertisement will satisfy a desire etc. This final ranking then helps to decide the NPC's next action, by taking 1 of the top ranking actions - not always the top one, otherwise what's the point of playing the game when it plays optimally for you? ;)
By giving NPCs different desires, we can simulate NPCs better than before, with unique personalities shining through more, and less predictable behaviour which still makes sense.
Why wasn't this already a thing?
See the title :'(
What does this mean for the roadmap?
The biggest benefit is that this will cut down on future work immensely. New features can be added by just getting an object to advertise a particular desire, and NPCs will interact with them seamlessly - no touching of an ever-growing code base needed. Therefore, this has been pushed to the top of our agenda in the coming weeks, with other development branches put on hold temporarily.
While this would push back the roadmap, we fully believe that in the long run, this will speed up development time AND make the NPCs in the game significantly better and life-like. Therefore, we will be releasing a new roadmap after this is completed, but fingers crossed everything should be moving forwards - not back.
Other Game Development News
With the headline out of the way, a smaller bit of news regarding Containment Procedures. Conditional statements have now been added to the GUI (see below).
An example of a containment procedure with 3 conditions
Multiple conditions can be chained together that will then allow you to define containment procedures depending on current conditions within your facility. The next part for Containment Procedures is the actual "action" part, whereby you can direct your NPC's behaviours but... this may actually use Utility AI desires to implement this functionality rather than the whole kerfuffle of directing NPCs around the site. We hope you can see the immediate impact this new AI overhaul will have!
Case Closed
As far as meaningful progress, this week has been pretty light. A mixture of personal commitments - including graduation ceremonies and celebrations - have left us a bit short of time, but the main part of this week has been designing the new Utility AI system which will change everything for the better. In the meantime, thank you for reading, and we'll see you on Monday (hopefully not Tuesday) for the newest anomaly release!!
If you’re all caught up on the devlog series for An Elaborate History of Chess, you'll definitely want to watch the third entry all about our turn-based dungeons! It's out now over on YouTube:
In this devlog we talk about the kingdom levelling system that always provides the player with a challenge. We also introduce the turn-based dungeons which really bring home the Chess-like strategy experience.
Keep an eye out for the next update soon, and subscribe to our YouTube channel for a notification the second it goes live and don't forget to wishlist the game now on Steam!
Hi Please Be Warn if Your Interested in Playing This Game My Computer Had a Bad Windows Update and I Lost the files for this project So If Theres a Bug I Cannot Fix It i Contacted Steam And the Game Will Be Taken Down Shortly Im Sorry Blame Windows
Hi Please Be Warn if Your Interested in Playing This Game My Computer Had a Bad Windows Update and I Lost the files for this project So If Theres a Bug I Cannot Fix It i Contacted Steam And the Game Will Be Taken Down Shortly Im Sorry Blame Windows
Hi Please Be Warn if Your Interested in Playing This Game My Computer Had a Bad Windows Update and I Lost the files for this project So If Theres a Bug I Cannot Fix It i Contacted Steam And the Game Will Be Taken Down Shortly Im Sorry Blame Windows
- Ability to bend Israel to your ideology if Iraq, Iran, Afghanistan, Syria and Pakistan are in the player's military alliance. - A new special ending for Israel with feudal socialism in it. - New Achievement.
Custom wind, rain and weather system with sparkling water droplets shader.
Finally all that work writing a custom vegetation shader is paying off. This has allowed adding water droplets on leaves, complete with sparkly light refraction/reflection effects and subsurface translucency. Plus better wind speed blending without jittering. Doing this in a 3rd party vegetation shader would be very hard to impossible if they did not provide full source.
In the future I plan to add some sort of exposure system. Staying out in the rain can't be good and should encourage you to build a shelter.