Zombie Targeting in Multiplayer Co-op
Problem:
One problem that I dealt with this week was getting the Zombie AI behavior to be more intuitive and work as intended in a multiplayer co-op game. The zombies behavior is simple, they chase after the closest player to them until they are close enough to attack. I approached this task with the tools I already knew and quickly implemented a custom AI Controller class that ran the following behavior tree sequence, find closest player, move to closest player, attack. This does in fact work fairly well for what we want, but only when there is a single player in the game. The issue that happens with this when playing in multiplayer is that the zombies do not update which is the closest player to them until they have finished getting to their current target within the Move To behavior tree node. What we want is for the zombies to be able to switch to a new target under certain circumstances, which stops bad things from happening like a zombie ignoring a player they are running into because they are still following their initial "closest player" even though they are not the closest player anymore.
Solution
The solution that I went with for this problem was to add a sight perception to the Zombies AI controller. I first setup the Generic Team Agent Interface of unreal for the player character and the Zombie, so that the AI could be set to only detect players not other AI. I then added a boolean blackboard key that is set to true when we sense a player with our sight perception.
Then, I added a decorator to the behavior tree, to abort the Move To task when that key is set. Once its set the behavior trees sequence restarts and also skips getting the closest player at the beginning because they instead will chase the player that went into their sight.
The reason for skipping finding the actual closest player when we sense a player is to have the ability to purposefully take zombies attention away from your team mates by running in front of their vision at a close range. Here is a video showing that the intended behavior is in fact working.
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.
Having this for finishing the mini boss was integral great job on making the foundation of the base zombie.
Impressive stuff lad! We love to see it...
This was awesome. Was exciting to see the process of you solving this issue.