A New Project
|
So I am renewing my blogging with some post these coming eight weeks on my experience as a AI programmer on Giraffic Art. This lovely bunch are my co-workers for a course named Big Game Project. We are developing a game named Naar, an adventure plat former with a unique spell casting system and is set in a genie world. My primary objectives during this project will be to design behavior trees for the two enemies in the game and the main boss. My goal is to create a base tree for both enemies then alter their attack and movement speeds to make them feel different when Mokhtar, Naar’s protagonist approach them. The engine I am using is Unreal 4.7.1, a heavy engine with powerful and remarkably easy tools to achieve my goals. My first step was to create two characters, one a player can control and an AI. This AI or pawn as unreal like to call them, will be interested to you when you come within a distance to it and follow you until it reaches the designated attack range. Easy enough, there was already a tutorial with a 3rd person view that spawns a character, making me jump start my work without any hassle. As I had my sky box, level and character, I only needed to write the behavior tree for the enemy. There is a tutorial on Epic’s website that teaches you how to use behavior trees and the results is a pawn that follows you as soon as you come close. Unreal has the notion to always use nav mesh’s nowadays so the first step was to create one. Nav mesh bounds volume is a feature that you place unto platforms like a collider, explaining where the pawn is allowed to walk/run. Following the tutorial, you start by creating an AI character, notifying the developer that the parent class needs to be a character rather than a pawn (I am still not sure why). You then create a blackboard, a blueprint and finally a behavior tree. A blackboard is, well, I am not really sure but it seems to be able to create global variables to use for the behavior trees. Blueprints is a new, effective tool used in the unreal engine to program without having to write one line of code. It’s an effective way to actually show code and learn the inner workings of code in general but I personally prefer writing code though I am starting to enjoy their capabilities. By following the tutorial you start writing a blueprint for the movement, making the pawn move without any controller input. For movement there is a need to start the blueprint with a event begin play to indicate that when the print is called, this is where it starts. From there it remembers it’s home location and start running to the player. After enabling the pawn to move, there is a need to create a task as to why it runs and the rules. In this case it was to have the enemy follow the player until it’s within range then start attacking. For this reason you create a task inside the behavior tree with the pawn’s location and the players. There you connect it to a tick, counting each frame and make it follow it when it’s within the pawn’s aggro range. The aggro range is the pawn’s reaction radius to run towards the character. There is a lot here that I do not understand such as the break hit result instance and the line trace by channel, making sure that I wont be able to tell you in detail how it works. My best guess is that it creates a path within the nav mesh to find the fasted path to the player and follows in with ticks counting when the pawn can move and stops itself within attack range. When all of these massive blueprints and tasks are done, you are transported to the behavior tree to create the sequences and selectors, making sure the AI follows a predicted train of thought you create. For this instance I followed the tutorial and made one by checking aggro every 0.5 seconds and if the pawn sees the player it creates the fastest path available and moves towards until it is close enough. If the pawn is not available to follow it waits 2.5 seconds before going back to it’s home location. And that’s it! I haven’t been able to implement the attack state of our AI nor will I include tidbits of that exploration in this blog post because I need something to write next week! Stay true, Ladbon |

