Player hunting NPC

Made a cool NPC character that hunts players, like a tracking/lookout AI. When a player comes in range and is visible, the NPC will begin to chase them, and when it is in range it will damage them. It also (tries to be) smart - when it looses sight, if the player was moving it will use their movement to predict where to look for them next. For realism, once it gets a certain distance away from its starting location, it will disengage enemies and return to its start - for a short period of time during this disengagement, it can instantly target new players, this timing can be easily changed. During disengagement, if it spots a player it will use their movement to predict their next position to determine if it is worth going after them or not (also if a player is out of targeting range during disengagement it will still ignore them). If it looses a player, after searching for new targets for a short period of time it will also disengage and return to its starting position. While chasing a player, if it looses sight after attacking them it will instantly target them again if it finds them again next time it looks for a target. It has some other cool functionalities as well.


I also made it so all the settings can easily be tinkered with by others who use this:


The settings script documents the default values for each setting, as well as a description of what they do. I implemented this for if/when I give this asset to others, it is easily modifiable to match their games.


Here are some clips:


Update: Improved functionality - I made this bot also able to hunt other bots that could be designed to run from it. I also improved targeting, tracking (after loosing LOS), and disengagement behaviors and gave the bot a small time window during these actions that it can instantly target and track the player it was looking for. I also moved the sound to the head of the bot, so players far away cant hear it (RolloffMaxDistance).

Edits: added the thing about settings, and made the document easier to read

6 Likes