Knowledge and Sliders In the video above, I show the Crewmates' new ability to be able to see each other and what other rooms the crewmates all traverse to. This is all visible along with timestamps on the Knowledge Bar at the bottom right. On top of this, I have added slides to the main menu for allowing the altering of the Crewmates' behaviors on the fly. AI Observed KnowledgeThe Crewmates have finally gained ability to record observations! Being able to accomplish this in the first of the two weeks is an exciting amount of progress, because it means we're past the barebones implementation of observation learning for the Crewmates and can soon move onto deeper memory management implementations. I will discuss my future plans for this in the "What's Next?" section below. For now, the observational learning system works as such:
The SlidersI wanted to be able to change the Meander and Attempted Murder chances of the Crewmates on the fly before each simulation. Originally, I had to go into the Behavior Trees and change the chance values for the two types of Behavior Tree. However, I've decided to move the chance variables to the AIDeductionGameMode, and I've added these two sliders which are attached the the GameMode's variables. The UI sliders and buttons are provided by Unreal's widget system. Bugs/ImprovementsNow that we've hit the halfway point of the project, I'd like to make mention of some bugs that have arisen from the latest implementation and some much wished for improvements to the project. First, the new Observation has a noticeable bug if I intend for this project to fully replicate the original Among Us: The Crewmates can't see through each other. In the picture below, you can see that, while the scenery is able to block a player's vision, other crewmates do not hinder the player's vision. In the AI Deduction project, the AI Perception Component's vision is still being blocked by other Crewmates. This causes issues mostly for the Killer in the fact that two Crewmates can enter a room one after another, and the Killer would only see the front one. If the Killer only sees the first one, then the Killer will think there's only one Crewmate in sight and will kill that Crewmate even though a potential witness is right behind them. Another problem is that, since the Crewmates are set to pass through each other, they can lose vision while phased into one-another. This means that Crewmate will lose vision of all others in sight and then re-log all nearby crewmates. I intend to test different types of collision on the Crewmates to see if it gives the Crewmate's Perception Component the ability to see through each other. The second problem I've run across is that the Crewmates' mouse collision for the ability to click on them doesn't work terribly well unless the player's camera is fairly close to the Crewmate of choice. I will work on playing around the the collision capsule used for the clicking on Crewmates to see if a certain size will allow me to perform mouse events on them from any distance. Lastly, an improvement I'd like to add is the ability to have a button to freeze the Crewmates in the tracks and pause their task progress. I've made a first pass on this, but the current version doesn't stop them if they're in the middle of performing a task or moving to a location. It only freezes them once those actions are complete. I will try to update it so that their movements and task performance also freeze. What's Next?Since the basics of the Observation has been implemented, I want to try and implement a suggested "Memory System". Along with this, I would also like to address the Bugs/Improvements previously mentioned. The plan for next week goes as such:
Want to Download the Project?
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. Now, to discuss how the new features work: The VictoriesIn 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. 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 CrewmatesThe 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. 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 RoomThe 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. 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:
Bonus:
Want to Download the Project?
Another week has passed where I haven't been able to work as much as I would have liked on "Among AI" before this Friday came due to other projects. Since this is becoming a bit of a reoccurring theme, I've decided to move my updates to Sundays instead until my other projects slow down enough to where I'm better able to make progress on the days leading up to Fridays. This is so I'm not having to post Friday and Sunday of every week and postpone my description of my plans for the next week every time. Thank you for your patience on this matter, and I hope to be able to continue making good progress on what has honestly been a fun programming project with this new update schedule. We'll See You on Sunday!Who's the killer?As previously mention in the Week 3 update, I wanted it to be easier to identify who is the Killer in the simulation. To accomplish this, I've made it so that any Crewmate designated to be a Killer will have this Axe attached to their back. With a little free time, I'd like to have this weapon socketed to the mesh, but this will definitely work for now. Task Progress BarOn top of giving the Killers weapons for their murder sprees, I've added progress bars to the Crewmates to indicate how long their task takes for them to complete. This task bar will be cancelled and reset if they are killed in the middle of their task, similar to how a task is cancelled by a kill in the real Among Us. What's Next?Next week is focused around the simulation being able to complete through the ending of the simulated game. To accomplish this, I will be creating Task Victory for Innocents and the Killer Victory for the Killers. To accomplish this I will be working on:
Want to Download the Project?
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:
Behavior TreesThis 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:
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:
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! Better ConveyanceWith 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:
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:
Want to Download the Project?
Crewmate and Player MovementPlayer Spectator PawnSo far for the Player Pawn, I was able to get it to fly around and have no collision similar to how the Unreal Editor camera works. I also gave it the function where the camera will only turn when the player holds the right mouse button. The cursor will hide and lock in place when this button is pressed. If the right mouse button isn't held, the player is free to use the mouse for clicking in the scene which will be used later in the project. I intend for the player to be able to hover the mouse over a crewmate and have them glow to indicate which crewmate they are going to "Select" if they click the left mouse button. Upon clicking on a crewmate being hovered over, the player will be able to see all of the information that crewmate remembers at that moment and which task they are about to attempt next. I initially planned for the player's camera to attach to that crewmate, but I feel that functionality would just take away from the player's ability to easily swap between "Selected" crewmates. "Camera" BugDuring the creation of the Player Spectator pawn, I ran into a nasty engine bug which took 1.5 hours to resolve. Basically, the pawn's initial name was Player Camera, but Unreal apparently does not like the use of the word "Camera" in any created C++ class, because when I made a child Blueprint class from the Player Camera C++ class, the engine would instantly unload the class whenever the engine restarted. Turns out putting "Camera" anywhere in the name of a class causes the class to not stay valid in Blueprint form. I'm making note of this as a warning to any who read this about this issue and to indicate an extra detail I've learned in the creation of the Player Spectator class. Waypoint Location NameI was able to add the location name to the Waypoint class as an FString. I plan to use this name for helping an NPC to know which room on the ship they are headed towards. However, I'm also thinking of just having the tasks themselves be usable as the indicators to the Crewmate on where they should go to perform said tasks and just use the waypoints for the Crewmates' meandering around the map. Main MenuAs shown in the video about, I am able to reset the game to the main menu at any point by pressing my new debug key: the "M" button. This is done by making a call to the ResetGame function in the AIDeductionGameMode. In said function, the positions of the crewmates are reset along with the player spectator, the player spectator's ability to move and turn is shut off, and the crewmates' behavior trees are stopped. I was, however, unable to make an updated design for the main menu in the allotted time due to trying to correct the "Camera" bug. What's Next?This next week, I will begin the implementation of the core elements of the gameplay: the goals for the crewmates to win the game. This will mean that I will be splitting up the crewmates' behaviors between the killers and the innocents. Specifically, I will be working on:
If I have extra time, I will also implement:
Want to Download the Project?
Character Movement In the past week, I was able to create waypoints and the beginnings of a crewmate. To do this, this, I hade to create the following classes:
The current behavior tree of the AI. I created and added the "PickRandomWaypoint" node to have the CrewMateController choose at random from the AIDeductionGameMode's list of waypoints for moving the crewmate to. It's quite small now, but I intend to add more soon to provide goal-based movement so that the crewmate can move to a desired task. The classes created to begin working on the crewmate implementation and their movements. Player CameraI've decided the best way for the user to be able to spectate the simulation is to create a floating camera class. I intend to use this video as inspiration and converting it from Blueprints to C++ code. The user will be able to float around the map and keep an eye on all the crewmates as they roam the ship. I will also be adding a function where the player can click on an crewmate/press a button while looking directly at a crewmate. This function will then attach the player camera as shown in the YouTube video to the crewmate, and the information of what the crewmate knows and is doing will be displayed. Main MenuI also created a very basic main menu on the first pass. The main goal of this early main menu iteration is to be able to reset the crewmates and the player camera back to their initial positions like they will do when a simulation ends. I have also set it up so that the crewmates do not begin performing their actions until the start button has been pressed. To continue iterating on this menu, I will be working on:
What's Next?This week has been busy for me when it comes to other school projects, thus I fully intend to make more headway on this project over the weekend. I will be doing a "Week 2.1" update post on Sunday to show the progress I've made and then I will discuss Week 3 on that post. This weekend I intend to:
Want to Download the Project?
|
Coleman LevyWelcome to my blog! Archives
August 2021
Project |
RSS Feed