1. Containcorp
  2. News

Containcorp News

Forensic Friday 49

This marks the culmination of an AI overhaul, addressing bugs and enhancements in the system. Notably, Prisoners Expanded V3 or maybe its V4?... introduces improved functionality, including socializing, recreation, and sleeping arrangements. Wandering NPCs improve mental health, while upcoming features like Hauling, Builders, Combat, and Experiments remain on the horizon!

The game now supports underground floors, and NPC pathfinding around corners has been refined. The roadmap's resurgence is closer than ever after a brief setback due to personal commitments. But that's life!

Read the full blog here!

Or the bigger link if you prefer!
Forensic Friday 49

Forensic Friday 48

Welcome to the 48th installment of Forensic Friday! It's crazy looking back that we're almost at the big FF50 in a couple weeks, and also humbling that it's really taken this long for a project that was meant to be done over 1 summer...

A quick technical overview


Numerous refactors and rewrites have defined such long periods, and the current implementation of Utility AI is no exception. We're still battling through a few bugs, but day by day we're getting closer to completion.

Our NPC pathing algorithm has had a makeover this week, using new multithreaded code utilising Unity Jobs. While previously NPCs would queue up certain tasks, the new Utility AI system has made this all redundant. Therefore, we're now able to use multithreading for pathing, which has given us a bit of extra work, but is definitely worth it for the performance payoff.

New activities such as going to the toilet and Category-Cs using beds have also been implemented this week, along with the more complex work on porting builders to the new desire based system (which is what saw the end of the task queue).

New Developer Tools


This week also saw the introduction of a new developer console, using a handy, open source package which you can find here. This new console makes it easier for us to add new commands to our existing codebase using a custom defined attributes above methods. Further Unity inspector tools to easily load up items and NPCs on start have made setting up the game world for testing that much easier!

The new developer console

Case Closed


It has felt like every week, for the last couple blogs, that we predict Utility AI will be completed before the next blog. However, without a doubt we're closer to being finished than before, and while there were and are unforeseen bugs, we're slowly squashing them. Thank you all for your continued patience with us, and we'll see you on Monday for the release of the next Anomaly document!

Case Closed.
The Team
Plasmarc Studios








Forensic Friday 47

Welcome to Forensic Friday Friday- Fri- F- day----- what -Pd- I don't know----
RESTARTING...
RESTARTING...
RESTARTING...

WELCOME BACK...

Oops I seem to be broken, much like our development currently! But not to fret, we are merely overexaggerating. This week we have been stuck in the metaphorical hole of development hell. Hell because we are not enjoying ourselves in the slightest? Why? Rewrites and Bugfixes! That's why! But as the week comes to a close, we are finally starting to climb out of the hole we dug ourselves by not researching effective designs for AI systems :/

Anyways, what's important is the news! The news is both good and bad. Starting with the bad news: We are behind on the roadmap! But the good news: We are nearly done with revamping our NPC AI, and with that will come a significantly smoother development. With any new system, it takes a bit of beating in before its robust and reliable enough, which is what we have spent most of the week doing. A mountain of bugs and issues, is surprisingly a good thing, as it just means we are finding all the possible edge cases and extreme scenarios, and pushing our new AI system to the limit.

So in lieu of that... we will get back on the road(map) soon! We may need another week or 2, but hopefully in no more than 2 weeks time, the roadmap will resume in all its glory, and maybe at an accelerated pace.

Multithread pathfinding

In other news... pathfinding is multithreaded. NICE. Or at least the code exists to support it, but it hasn't been meshed into the game yet, but eventually it will make its way through!

Recreational Activities

NPCs also now can watch TV, using the new AI system. Once all the bugs have been ironed out with the underlying system, this kind of activity could probably be done in half an hour (probably less) of development time which is a good feeling. This also led to a discovery that NPCs could see through walls placed diagonally to one another, so now NPCs detect if they can see a location using a modified version of Bresenham's line algorithm that gets all tiles between themself and the location they are looking at correctly! Many thanks to this) lovely blog post for the idea!

Anomaly Poll Winner

And to end on, the anomaly poll winner for this week is... _drum roll_

S-0133 - "The floor between floors":
S-0033 appears as a completely normal elevator/lift from the outside. It can effect any lift by random. so doesn't have one defined appearance. Using the effected lift allows access to a whole new floor, only accessible through the lift.

(sad 119 noises)

Many thanks to all that voted, and we'll see you in the next Mechanical Monday in 2 weeks to show off the document in full!

Case Closed




Time to file this case, and close it for good. Thanks for reading, and your patience. We hope to get back on the roadmap as much as you guys.


Case Closed.
The Team
Plasmarc Studios






Forensic Friday 46

Hiya everyone! Apologies for the delayed Forensic Friday post, but we're here now. There's not too much new content this week, but still some interesting parts nonetheless (at least in our opinions! :D). Happy reading!

NPC AI Overhaul Begins


There's not too much more to say on this that wasn't described last week. However, in case someone decides to use this blog as inspiration for their own game, we'll describe a couple of the quirks we have encountered along the way, and our solutions so far.

[h2]The "tunnel-vision" NPC problem[/h2]

One of the biggest issues we've encountered has been the "tunnel-vision" NPC problem, that occurs when NPCs in game start one task, and fixate on it until it's conclusion, without considering other relevant factors in their environment. This can make NPCs appear stupid, as they fail to react appropriately to changing circumstances or prioritise tasks effectively. While in other games, like the Sims, this is just passed off as "dumb" behaviour, in our game this may often be the difference between life and death, or successful containment and containment breaches.

Therefore, to counteract this problem, we now make NPCs rank and choose their preferred task every game tick. However, due to the random nature of NPCs choosing one of their top 3 ranked tasks, we've made it so NPCs only change tasks if a new task is made available that an NPC ranks higher than their current task. By making it change every tick, NPCs now will be able to react to events in real time, which hopefully makes them more flexible and adaptive. For instance, a builder may stop by a coworker for a chat, before continuing with moving materials to a construction site, or someone taking a shower will now stop if someone starts shooting at them - all common-sense and realistic behaviours.

[h2]Fighting for tasks (Race conditions)[/h2]

Another issue that arose came because of this change to reranking and choosing tasks every game tick. Depending on which NPC executed its code first, that NPC would get first choice for every task available in the world. However, since the order in which NPCs execute code isn't always the same, this would lead to high rated tasks constantly switching hands between NPCs, all relying on the lottery of which NPC would choose first. In real game terms, this could mean a bunch of NPCs constantly getting in and out of a shower every tick, as they jostle over the highest rated task - showering - in the area.

Therefore, we have introduced a task reservation system, whereby an object advertising a task keeps track of the NPC that is carrying out its task. This advertisement is then temporarily locked for 2 ticks to the NPC in question. If the NPC decides to stop the task, then 2 ticks later, the object can advertise to everyone again. Meanwhile, in the more common case that the NPC would continue its task, it has special priority to choose its current task, creating more seemless task completion, and less tug-of-war style situations!

Social Media Revival Underway


We've also been starting our slow social media revival over the last week, with daily posts on Twitter (yes, we're still calling it that). Whether it's bad memes, blog post announcements or just general updates, give us a follow for some of the content of all time! (plus likes and retweets for the algorithm are much appreciated)

The first twitter post

Case Closed


And that's a wrap for this week. Not too much new content to show while we continue Utility AI, but we hope to have this finished by next Friday! In the meantime, thanks for reading as always, and we'll see you on Monday in our Discord for the next anomaly poll!!


Case Closed. The Team Plasmarc Studios

Forensic Friday 45

It's probably not a surprise by now but as the title says, yes - we are idiots. Let us explain...

[h2]NPC Behaviour[/h2]
[h3]Current Implementation[/h3]
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.


[h3]Utility AI[/h3]

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.

[h2]Why wasn't this already a thing?[/h2]

See the title :'(

[h2]What does this mean for the roadmap?[/h2]

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.

[h2]Other Game Development News[/h2]

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!

[h2]Case Closed[/h2]

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!!

Case Closed. The Team Plasmarc Studios