Sebastian - V0.0.2 Devlog - I Heard That!
One of my major tasks this week was to implement a sound detection feature to the enemy AI. This task raised two questions: does Unreal Engine have sound senses, much like the sight sense, that can be used for AI, and how would I go about making a sound audible to them? Since I knew this may not be an easy task, and that I would need to do some research into Unreal Engine's AI Senses, I decided that this should be my first task for this sprint. Let's go ahead and discuss how I went about implementing this sound detection feature!
As mentioned, I needed to look into Unreal Engine's AI Senses, after some searching, I discovered that they indeed have a sense for hearing. Now that I knew that it was actually something I could add in through their own sense system, I began writing code to add this sense to the already existing perception system.
Now that this sense exists within our enemy's AI Controller, I needed to add code to our perception handler function, that way the AI can depict whether it detected sight stimuli or hearing stimuli, and update the correct blackboard values for each case.
And that is all I needed to do to get the enemy to register sound! The next step is to get an object to make sound that can be heard by their hearing sense. This has a simple solution, as there is a method that can be found inside of "UAISense_Hearing" that allows us to report a noise event that the hearing sense can detect. I also needed to register the object as a source of perception stimuli, that way the perception system can register events sent by the object.
Since I had to create an object to test this sound reporting feature, I made a simple throwable actor with a mesh and a sphere collider.
After making a blueprint out of the throwable and giving it a rock mesh, I needed to create the behavior tree logic for the AI to actually react to a sound. For this, I decided the AI should display a question mark widget above their head, look towards the sound's location, and then move to that location. As of right now, the AI does not look at the sound, this is because we enabled/disabled some rotation options on the enemy's movement component to allow them to smoothly rotate rather than snap to a direction.
All that's left is to add this behavior into our main tree's logic, making sure it is only called when a sound is heard.
Now that this is all set up, we have enemies that can hear sounds and go check out what they heard! Here is the final result:
Echo in the Shadows
Status | In development |
Authors | IDC_DEV6, aesthetical, Mrr_Memez, dgiardino |
Genre | Adventure |
Tags | Action-Adventure, Stealth |
Leave a comment
Log in with itch.io to leave a comment.