Blog Entry: Base Zombie AI
2/23/2024
Author: William DeMayo
Problem 1: The Problem
The base zombie that I had created initially worked with just running to the player. This is a great start for a zombie given that there are two things that really zombies do; running at the player and attacking the player. My zombie would run at the player and initially get up in his face, but I realized in the move to function in unreal you can choose a certain acceptance distance. Realizing this I gave it an acceptable distance so that they can hit the player without looking too far away from the player. The next thing I had to do to the base zombie AI was set up an attack function.
This is where the problem comes in, I had set up the move to in tick because I did it in blueprint, the attacking logic was also called on tick. This ruined the animations, it did not attack the player, and lastly it was damaging itself instead of damaging the players. This gives me three problems with three solutions to technically solve one problem which was the base zombie not functioning as intended. The base zombie had 3 bugs stemming from the system that was set up incorrectly. The animations were ruined from it trying to attack every frame even without even being near a player. The attack was hitting the zombie instead of the player, as well as it not being in range of the player to call correctly to make sure that it will actually hit the player.
Problem 2: Problem Solution
There was three problems stemming from one major problem the Base Zombie not being written correctly in blueprint. The attack not being in range and breaking the animation blueprint was calling it on tick, it was calling every single frame. The ABP was getting overwritten by the play animation montage every frame, that is why the zombie isn't running. The second problem where it attacks the player when it is not in range, first I created a boolean to set a toggle for if it can attack, however I did not set if the player was in range. I realized I thought this would work by attacking the player after the zombie have moved to the player. This is not the case I need to check a radius around the player and to see if they are close enough to attack. This will fix the problems of not attacking unless the zombie is in range, as well as not calling the montage every frame.
I realized that instead I can use an AI controller, blackboards, and a behavior tree to solve these problems. I can convert what I did in the blueprint to a behavior tree and set up an AI controller to allow for more fluid and rapid change of AI state. As well as converting the AI controller to code will speed up the efficiency of the AI. This will allow for me to use a sequence to ensure that the zombie will run up to the player and when they are within range to attack by also calling it off the move to function. This will also allow for me to see the zombie states a lot easier so I can debug easier than using blueprints alone. I also should not be calling it on tick but because a behavior tree uses delta time instead of tick it will allow for a more fluent experience. The zombie will attack the player by applying damage to the player after it is within range after the sequence has been run.
Get Deadlands Duel: Time Rift Rumble
Deadlands Duel: Time Rift Rumble
A hot-blooded, feel good, zombie wave defense shooter.
Status | Prototype |
Authors | Willy Games, Ghost Of Reddus1, Mystic, LGUAPOJR, StevenCodes, Bjornoid, Johncarlos Lillo |
Genre | Shooter |
Tags | Arcade, Atmospheric, FPS, Horror, Multiplayer, rogue, Sci-fi, Unreal Engine, Zombies |
Languages | English |
More posts
- Perk System SetupMar 31, 2024
- Blog Entry Title: Morale and B featuresMar 29, 2024
- Class Ability ImplementationMar 29, 2024
- Blog Entry: RPG Explosive Projectile: Network Replication and Destruction bugMar 29, 2024
- Blog Entry: Powerup UIMar 29, 2024
- Spectating SystemMar 27, 2024
- Blog Entry Title: User Interface and Under hood with Unreal AudioMar 23, 2024
- Blog Post: The Miniboss ProjectileMar 23, 2024
- Unique but modular class abilitiesMar 23, 2024
- Blog Entry: Instant Kill PowerupMar 23, 2024
Comments
Log in with itch.io to leave a comment.
Deadlands Duel is the smoked salmon