Progress on the new AI System of Unsung Heroes 1898


Normally, every two weeks I post another update for Unsung Heroes 1898, with some major additions. However, I was out of town this past week and was unable to make much progress over the game's development. As such, there is no update that will be posted this week. I hope to make significant progress on the AI in time for a update by the end of the month (fingers crossed I'm able to actually finish in time). That being said, I did make some progress that I thought I should share with everyone.

One of the things that I've already added to the game is a new hitbox detection for the infantry soldiers. In the past, the soldiers had a very large, overly-simplified, and inaccurate hitbox that was a host to many bugs and glitches (such as headshots sometimes not registering). The new hitbox now is mapped to individual limbs of the infantry soldier, allowing for more precise detection. In addition, I've implemented systems to allow soldiers to take extra or less damage depending on where they got shot at (head shots deal double the damage as a body hit, and shots to the arms and legs are half of the damage of a body hit). In the future, I'll implement a point system that rewards players for successfully hitting certain areas of an enemy soldier. 


Of course, the highlight of the next update is the overhaul of the infantry AI. My goal is to try to make the AI much more independent thinking and better adapted to their surrounding environments. This will be done by adding much more behavioral states and granting them the ability to perform complex actions. In most games, including Unsung Heroes, the AI uses a "behavior tree" where the player selectively picks behavior states based on the conditions of their surroundings. In other games, behavior trees can end up being quite large and complex. When I first made the AI for Unsung Heroes about a year ago I did think it would be ideal to have large and complex behavior trees. So I instead made a small behavior tree of only four states and tried to cram in as much AI logic into them as possible. This lead to oversimplified AI behaviors and code that eventually became unreadable. My goal with this update is to correct my mistakes by making a proper behavior tree with 26 different behavioral states. The conditions for these states are much more complex and the states themselves have more specific and advanced actions. Pictured below is the flow charts and complete list of AI states and behaviors. If the below picture is too difficult to read, you can also view this interactive (you can zoom in/out) version of the chart here: https://viewer.diagrams.net/?tags=%7B%7D&highlight=0000ff&edit=_blank&layers=1&n...


There are lots of new behaviors that the AI is capable of performing with this system (such as hiding behind cover, or attacking a soldier while still walking towards their objective). In addition, soldiers are able to go into "survival" mode when they have low health or ammo, allowing them to ignore a commander officer's orders to instead focus on surviving for as long as they can. 

This chart is not the final version of the AI and plenty of states will be added down the line (the two green bubbles under the survival behavior flow chart indicates some of the planned additions). This however should be sufficient in making the AI challenging for most gameplay situations. I hope to have some more information to share with everyone in the coming weeks. In the meantime, feel free to join our community Discord server(https://discord.com/invite/p8CA9qXgCN) and be sure to try out the free versions of the game that have already been posted if you haven't already. 

This post is also available on the Venomic Games website: https://venomicgames.com/?p=665

Get Unsung Heroes 1898

Leave a comment

Log in with itch.io to leave a comment.