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

Projects Blog

AI Social Deduction: Week 4

6/20/2021

0 Comments

 

Victories, Progress Bars, and Clickable Crewmates, Oh My!

In the video above, I go on to show how the Simulation's new features look in the project. Firstly, it is easy to notice that I have upped the number of Crewmates to the full 10 I had planned to reach and will be keeping throughout the project to mimic the original Among Us game. I begin the video by clicking on one of the Crewmates to show the information bar at the bottom displaying their knowledge. Once the Crewmate crosses into the Storage room, you can see their current room changes to be "Storage". You can also see the "Total Tasks Completed" bar at the top left similar to what you would see in the actual Among Us game. Lastly, when all of the Innocent Crewmates complete their tasks, you can see the game cuts to a simple "Innocent Victory" screen. 
Picture
Now, to discuss how the new features work:

The Victories

Picture
Picture
In a similarly simple art style to the Main Menu, I've created Victory screens to indicate if the Innocents won the game through their tasks or the Killers through lowering the number of Innocents.

The Victories are managed through the AIDeductionGameMode. When the tasks are distributed, the GameMode records the total number of tasks distributed to the Innocents (ignores the tasks distributed to the Killers as those tasks will never be performed), and whenever an Innocent completes a task, the total number of completed tasks are compared to the total number of tasks distributed. When the number of completed tasks is equal to the total number of tasks, the GameMode reveals the Victory screen and pauses the simulation in the background. Killer Victories work similarly in that the game checks every time a kill occurs if the number of Killers is equal to or greater than the number of Innocents.  If it is, then reveal the Victory Screen.

The Victory screen's text is used to differentiate between whether the victory was for the Killers or the Innocents. This text is set on Victory so that there is only need for one victory screen.

Picture
The "Total Tasks Completed" progress bar uses an Unreal Progress bar similar to how the Innocent Crewmates' task progress bars. This task bar's percentage is calculated as NumberOfCompletedTasks/TotalNumberOfTasks.

The Clickable Crewmates

Picture
The clicking of the Crewmates comes in two parts: hovering the cursor over a Crewmate and actually clicking on the crewmate. 

Hovering: To accomplish the glowing effect for whenever the Spectator hovers their mouse over the Crewmate, I added a white fresnel to the Crewmate's shared material parent. Then, I added a parameter that jumps between 0 and 1 to turn the fresnel on and off based on whether or not the Spectator's cursor is on the Crewmate.

Clicking: When a crewmate is clicked on, the Crewmate sets itself as the Crewmate being observed in the AIDeductionGameMode. The observed Crewmate is the one used for displaying "Knowledge Data" on the "Knowledge Bar" at the bottom of the screen.
Picture
The "Knowledge Bar", displayed at the bottom showing Gray's name and Current Room.
The text of the "Knowledge Bar" is bound to whatever Crewmate is currently being observed. So far, the only data to be gleaned from the Crewmates is their name and what room they are currently residing in. I hope in future to make it so that the bar and Crewmate information hides itself if no Crewmate is selected.

Knowledge of Current Room

The Crewmate's ability to recognize what room they were in was an exciting bonus to be able to accomplish. This is a big step towards the observation system of the Crewmates as this will be used to determine what room each Crewmate sees each other in and what rooms they see each other entering.
Picture
The current system of the Crewmates recognizing which room comes in two simple parts: The Crewmates having a String variable indicating the name of the room they currently preside in, and a new class called "Room".

Room class: This class is a scalable collision box that holds a string that is the name of the room it is presenting. Whenever a Crewmate collides with this box, the Room class then gives the Crewmate its room name. Since the entire map is laid out in a Grid-like format, I will be able to use simple boxes like this to cover each room for indicating when a Crewmate has entered said room.

​I intend to upgrade this system to not use strings for representing the room that the Crewmate currently resides. Instead, I wish to use an Enum as this will give similar levels of conveyance to the Spectator what the room's name is while also being much faster to process when the AI will be comparing this information to what they know about Crewmate placement further down the line. I also wish to make it so that when a Crewmate enters a new room, the other Crewmates will be able to tell what room the entered and where from.

What's Next?

Next week marks the start of the main focus of this entire project: observational learning for the crewmates. As mentioned previously, I've gotten the chance to dip into this subject a little bit, but this next week will consist of more in-depth implementations into having the AI see and remember where and when they saw the other Crewmates. To accomplish this, I will be working on:
  • ​Adding more Room collision boxes so that each room has one that the Crewmates can use to understand where they are and where they are entering.
  • Making it so that when a Crewmate sees another, they record the time and Room they saw the other Crewmate in to a data structure of "Knowledge" that they gain over the course of the simulation.
  • Also adding the functionality for Crewmates to know which room they saw the other Crewmate entering and which room they came from to enter that room.
  • Adding dead bodies, which will spawn on kills. These dead bodies will be seen and recorded on the place and time where they were found.

Bonus:
  • Have the Crewmates recognize that if they see another Crewmate in the room where the body is, then that crewmate is the likely Killer.
  • Adding a short kill animation for Killers so Crewmates can walk in on Murders and easily identify that Crewmate is a Killer.

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