AI
The AI is made up of multiple objects that make it function as its own independence intelligence. The AI blackboard called "AI beginner blackboard" this is an object that holds variables and works in tandem with the behavioral tree. the blackboard holds the variables needed for the AI while the behavioral tree takes these variables and use them in functions such as "move to" or even custom events made by the developer.
The AI controller called " conqueror AI controller beginner" this is where most of the information sent to it by the behavior train is then executed this controls the pawn that is connected to a such as the mesh but this is the brain of the AI linking all the other components together
The AI pawn called "Conqueror AI character beginner" this is controlled by the AI controller and holds components of the mesh and is well deals with collisions. in this AI this is where the receiving damage components of blueprints are held and dealt with.
The AI controller called " conqueror AI controller beginner" this is where most of the information sent to it by the behavior train is then executed this controls the pawn that is connected to a such as the mesh but this is the brain of the AI linking all the other components together
The AI pawn called "Conqueror AI character beginner" this is controlled by the AI controller and holds components of the mesh and is well deals with collisions. in this AI this is where the receiving damage components of blueprints are held and dealt with.
This is the AI blackboard called "AI beginner blackboard" its is away of holding variables for multiple AI. The variables in this blackboard are:
Node(Object): This is the node the AI will move to like points on a map it gets the first points from the spawn points then when it moves to that points it has another node stalled with minutes to move to bats and so on and so forth.
Self actor(Object): This is the one instance of the AI is attached to survey can be referred to back later easily.
Is tower visable(Bool):This variable is so when and AI sees a tower it then sets this variable which can be used in the behavior tree the different effects for the AI.
Tower in sight(Object): this variable holds the tower inside objects which can be use in instances such as a move to command or even attack this tower
spawn point(Object):the spawn points is the object that spawns this unit and is saved instantly to the blackboard of future use
Time wait at tower(Object):this time to wait Tower is the amount time the AI should attack the players tower before returning back to base.
This is the AI behavior treefor the conventional AI. It starts off with the root command which is a command that pulses every frame. it next goes to a selector which moves from left to right of the commands every time it receives an pulse from the roots.
we next go to the first sequence sequences are very similar to selectors but they have the difference of they can have variables that allow pulses to go through. the variable but stops this sequence from going through is the " is Tower visible" it allows the pulse to go through if this variable is set to False. this means that the AI has no tower bows its target and should move through the past nodes in the map in order to find a target. It starts off with a simple " move to" node that tells the towers to move to the node variable. once this is complete it then finds a variable located on the nodes which tells its to go to the next pass node creating a pathway for the AI.
The second sequence in the list checks to see if the " is tower visible" it's true meaning the AI has found a tower it then moves to the tower and sites wait one second for the behavioral tree to catch up then uses a custom command I created called "Conqueror attacked our" what this does is takes the damage the AI does and takes it away from the Towers health. the AI then moved back to the spawn points and waits their five seconds and repeats Until the variable on the sequence are exchanged.
The final event of the sequence is a custom event is called "contrary check if Tower is normal" what this event dollars is checked to see if of the variable for Tower insight is still valid and if not will allow the tower to research for a new tower to targets it is a redundancy to make sure the AI does not become stock at the spawn points.
This is the AI controller Blueprint where most of the tower detection and running the behavioral tree is taken place. First off we start off with the events begin play events and straight away we use the run behavioral tree node and select the specialist behavioral tree for this controller. We then use a delay the half a second to allow the behavioral tree to adjust from its construction. We then use a cast to the AI pawn an set this variable to the AI character so can be used later very easily. then we begin to set the values to the blackboard so that it can be used within the behavioural treat. we've first set the mood variable on the blackboard as well as the spawn points both from the AI character variable that was just created.we then finally sets final mode with two variables from the AI characterand this will be the total wait at Tower time.
the on perception events is an event is triggered when the perception component on the AI detects a object this is the main way that the AI can detect the players towers. first off we break down the actors with foreachloop then check with an actor has tag node to see if the actor has a type of Tower then it can pass through the branch is true. we then check the Tower target variable and if it is false then goes through the next branch. We then use a custom function call set Tower this which then sets a tower as a target.
the set power function takes the tower variable then checks to see if the tower variable on tower is not equal to the tower called in by the function. If true it then goes through the branch and sets the variable called in from the function as the tower variable.we then set this variable to the blackboards as well as the other variable on the blackboard tower insights is then set to true.
finally set the tower targeted variable to true
the events destroy events is used to clean all issues surrounding the AI. First off we checked to see if the AI character is attacking and if true it then passes through the branch. We then use a custom events that are sent to the Tower to stop the tower from being attacked as not to cause damage to a tower when a unit has been destroyed.
This blueprint is from the AI character object and deals mostly with the damage dealt with from towers. first to begin with the event began play which then sets the unit health template with the unit health as a sort of copy of the unit health to be used in the display health widgets. we then set the a I widgets with the health of the units to display visually for the player.
Carrying on from the events begin event we use again or actor of class to get the only RTS camera in the game with an break this down with Foreachloop and save the value to an RTS camera value that I can be used later easily. We then delved into the RTS camera variable to retrieve the user user interface and save this to a variable so it can be used later easily.
Carrying on from the events begin event we start off with the delay 0.3 this is so we can set variables of the unit without interfering with the construction of AI. we now set the improved unit number times this is where the AI becomes more more strong as their construction goes on. we first offset the improved unit number times one every time the AI's spawn this is so it starts off with one times its default properties keeping them at a normal level. we then set the unit health and unit damage times by this improve unit times number which at the start start off by one times whenever the phone number is meaning that it is normal. than also said the unit to number two whatever the improve unit number times as showing how many times this unit has been upgraded with this number.
We start off with the vents destroyed to this will only occur once this unit has been issued a destroyed command. We start off by getting the RTS camera from the world by using the gap all of class node then breaking it down the for each loop. we then send an event to the RTS camera called enemy die count this then calculates the improved unit number times variable it then adds a fine one and then times that number by the original improved unit number times then sends this to food water and sunflower variables on the artist camera this is where the player receives a set of resources when an AI dies. we then split the event line into two with a sequenceI'm going through stray away with changing the variable unit died true began on the second line check to see if the unit is selected with the branch and if true with and send events to the RTS can return to hide this information on the user interface.
this section of code is to deal with the damage the unit is taken from multiple sources and then to work out whether or not the unit has died and where to send information it takes in damage and then sets this to the unit's health bar taking health away where applicable and then checks to see if the health has passed below zero and if true it then sent a trigger to all towers that can shoot telling them this unit has died at to remove it from the special of arrey list of enemy units.
This event is called when the unit dies due to being shot by a poison tower then spawns a poison cloud at the same place the unit is.
This event sets the poison variables for when poison cloud is spawn off this unit this information is sent from the point are saved to this unit so that when is it by that tower it can then spawn poison cloud and import these variables streets to that cloud object.
this is where the unit receives damage from poison cloud when it has entered its collision it quickly works out how much the units health must be minus by and then affects the changes quickly in order to keep up with the overlapping events the AI is going through then also updates the health bar of the unit so that the player can see that the unit is taking damage when it moves through a poison cloud.
This section of code is used to change the rotation of the health widget so that it stays in the view of the players camera.
These events are used to show when the unit is selected by the camera then sets variables such as the units lacked the and then allows the unit selection cage to be spawned to show that the units that.
this line of code is so that once the unit is selected then sends this information straight back to the user interface to be displayed allowing this to be dynamic so that one is a player selects a unit and then switches to another it can be different variables shown on screen depending on the condition of the AI.
this simple event is used to improve the unit goes off the wave count from the obvious camera upon the spawn of an AI. this is the way that the units become progressively stronger as waves go on.
No comments:
Post a Comment