








So I'm a bit late on this post, but here we are. The beginning of the AI is done, with a few bugs. No video right now but will probably be added later.
The Main AI
The EnemyController class will be the main driver of the enemy's AI. It will have all the major logic, state variables, and ranges.
The state variables are the same at the players, and include idle, moving, attacking, and alive (which was added to the player class as well). The same attack variables are used to control when to attack and the attack range boxes as the player. The only difference is what triggers them. The player needs input in order to attack, but the enemy will only attack when the player is at attackRange or less. There is a bug that when the person enters the range it will do the full combo even if the player moves out the range, but will be resolved sometime. Attributes and animation are handled just like the player's character.
Other ranges are used to control when to follow the player and when to stop approach. These are viewDistance and stopMovingDistance respectively. If the player is between these values, the enemy moves to the player.
What determines the direction to move is the Compass class. At this time, it only determines the direction to move. It always watches the player's transform object to determine distance and direction if within range. It will later evolve to check to see if the enemy can truly "see" the player using a "head point" and will determine if they can walk to them via a "foot point". Raycasting is the current idea, but will do some further research to be sure that this is the best way.
What's Up Next
Further revising to the Compass class is up next. When finished, the enemy should be able to "see" a player, and then move to it if possible. If not, it will stand and wait until it can. This shouldn't be needed unless we use gates or other major obstacles.
A smaller update than the previous ones. This is mainly about programming than anything else. No videos on this one, but some explanations and basic coding layout notes.
Character Attributes
There is now a CharacterAttributes class that is attached to the character's model. This has the values for health, attack, defense, speed, block, and parry that are found in the design document. There are also functions in there that does the calculations for determining the maximum damage an attack can do. An ApplyDamage function is in the class that takes in that calculated damage, and then alters it based on the defense of that character. Other functions are in place to calculate the total block time and recharge time based on the block attribute. These are currently not in use. There is also a Die function that takes care of basic death things, but will probably change later on.
Base Attributes
There is also a BaseAttributes class now which has public constant values that store all the base attributes. This way they can be accessed from anywhere in code and are not allowed to be altered at any point.
Character Collision
Some changes have occurred in the CharacterCollision class. This is placed on any colliders that will be used as attack regions. Inside this class is a few important functions:
AttackStarted: Called via a BroadcastMessage call from the PlayerController class (and most likely an EnemyController class later on). This turns on the trigger aspect of the collision field when an attack has started.
AttackEnded: Called via a BroadcastMessage call from the PlayerController class (and most likely an EnemyController class later on). This turns off the triggers when attacking has completed.
QueueAttack: There is a new class called AttackVals, which stores the duration of an attack and it's power. Every time an attack occurs this is queued up. This way, when an attack collision occurs, the duration is used to keep the trigger from applying damage each frame, and the attack power value is passed into the ApplyDamage call of the enemy. This allows for varying damages based on the attack.
Gate Attributes
Though we never talked about this, the current gate that is shown in the last programming post video could actually be a gameplay element. In slight preparation of this possibility, there is a GateAttributes class that has some basic similarities to the CharacterAttributes class. It has health and defense values, which are calculated the same way with the ApplyDamage function.
Fixed Camera
Lastly, there is a FixedCamera class. This has been around since the last post, but thought I'd post it here too. The class uses the LateUpdate call in order to reposition itself back to where it should be, and allows for left-right scrolling like in old games.
Next Up…
The next major thing that will probably be worked on in programming is the beginnings of AI. Not sure when this will be started, but it will hopefully be soon.