• Home
  • Unreal Engine
  • C++
  • Blog
  • About

Projects Blog

AI Social Deduction: Week 3

6/11/2021

0 Comments

 

Tasks and Killing

In the video above, I show the behaviors of the three new crewmates that have been updated to include their ability to go do tasks and enact kills. Blue and Green are both Innocents while Red is a Killer.

The order of events in the video above goes as follows:
  1. Red, Blue, and Green split up. Red going to the bridge, Blue going to medbay, and Green headed South towards storage.
  2. Blue reaches the medical cabinet and completes his task. Red comes in the room right as he leaves.
  3. Red can see Blue headed towards him and sees that there is nobody else around, so Red kills Blue in passing, which is why Blue turns into a translucent, brighter shade of blue.

Behavior Trees

This update was majorly focused on creating Task nodes and Decorators for the behavior trees of the newly added Crewmates. 

When it comes to the Killer Crewmate's behavior tree, I've added nodes based around deciding on when the killer wishes to kill and how they will perform said kill. Excitingly, I got to begin early on implementing observation into the game through the killer's behavior tree. Each Crewmate in the game keeps a list of all seen crewmates nearby; this is handled by the AI Perception Component and AI Stimuli Component. Each Crewmate is a Sight stimuli, and due to this, the Crewmates are able to keep track of who enter and leave the vision range of the crewmates.

The Killer Crewmate's new behavior nodes are as follows:
  • Decide to Kill - A decorator which takes a random value between 0 and 100; if the value is lower than that "chanceToKill" integer, then the Killer goes down the "Attempt to Kill" branch on left side in the image below. If the Killer decides not to kill based on this chance, they will instead meander using the right path. The "chanceToKill" integer can be set in the Behavior Tree to make the Killers more or less aggressive. I plan to make this settable in the main menu in the future.
  •  Choose a Target - A task node which checks all Crewmates in sight, and then chooses the first Innocent Crewmate it finds as a target to chase down and attempt to kill. This will only target Innocent Crewmates, not other Killers. If no target is chosen,  then the Killer will instead choose to meander on the bottom middle path.
  • Perform Kill - A task node which first checks if there are no more Crewmates in sight that are Innocents. If there are none visible to that Killer, the killer will then call the "GetKilled" function on the target Innocent. Currently, "GetKilled" turns the Dead Innocent into a ghost, changing its color to a see-through version and then removing that Crewmate from being able to be seen by other Crewmates. This Invisibility is achieved by turning off its stimuli, so that the AI Perception Component cannot perceive that Crewmate.
Picture
The Killer Crewmate's behavior tree.
The Innocent Crewmate's tree doesn't use the AI Perception Component yet for its actions, but it now has the ability to check which Tasks that Crewmate has assigned to it and "Perform" them.

To do this, the following behavior nodes were created:
  • Decide to Meander: A decorator that works similarly to the Killer's "Decide to Kill" decorator, but instead is used to determine whether this NPC will decide to meander instead of moving to perform its task.
  • Check If Done With Tasks: A decorator that just checks if the number of completed tasks the Crewmate has is equal to the total number of tasks that Crewmate was assigned. If so, the Crewmate will just wander about The Ship.
  • Pick Random Task: Task node which grabs the next task from the Crewmate's list of randomized tasks as the task to go and perform.
  • Start Crewmate Task: Task node which takes the "Time to Perform" float from the Crewmate Task to determine how long it should take for the Crewmate to complete said task. The Crewmate will wait the given amount of time next to the task.
  • Complete Crewmate Task: Sets that task in its list of tasks to complete by incrementing the "numberOfCompletedTasks" integer.  This makes it so that the next time this Crewmate find a task to perform, it will grab the next task in its list of the ones assigned to it.
Picture
The Innocent Crewmate's behavior tree.

Other Additions

The AI Deduction Gamemode now comes with the ability to distribute random tasks from around the map to all Crewmates on The Ship.

There is now a TaskBase Blueprint that has replaced all of the old task models around the map like the plants in the Greenhouse and the Cabinet in the Medbay; this Blueprint comes with a task description and which room they currently reside in. The Cafeteria table hasn't changed though since it isn't a task.

Materials were made for living and dead Crewmates and there will be more to come as the project moves up to using a full crew for the simulations!

Picture

Better Conveyance

With the newly created Task and Killer systems, I recognize there is a major lack of conveyance and general showmanship that comes with the performance of these two main gameplay elements by the Crewmates. To fix this, I intend to add more visual elements to provide detail as to what is occurring.

The ideas I have are:
  • My original idea for a task progress bar.
  • A mark to indicate the Killer Crewmates on their models.
  • A short animation for when kills occur.
  • A pop-up above the Crewmates to indicate they have completed their tasks.

What's Next?

Once again, I was quite busy with other projects this week, so I will be doing more work this weekend. I will be making a Week 3.1 update on Sunday, and there I will discuss what's to come in Week 4.

This weekend I will:
  • Work to implement the Better Conveyances I discussed in the section above.​

Want to Download the Project?


​Click Here:
Github Repository
0 Comments



Leave a Reply.

    Coleman Levy

    Welcome to my blog! 

    Archives

    August 2021
    July 2021
    June 2021
    May 2021

    Project

    All
    AI Social Deduction

    RSS Feed

  • Home
  • Unreal Engine
  • C++
  • Blog
  • About