Looking for C# Tutorials On Managing Enemy AI Behavior So I am working on a 2D game in Unity that would probably be best described as a top down game similar to Starbound / Terraria with a much heavier focus on combat and character progress and less on the exploration / building. Up until now my enemy controller has been very basic with just inline code that does basic checking around itself for the player, chasing the player if in a certain range, attacking the player in a certain range, and so on. I am now trying to have more behaviors that the enemy can have and having all this inline in the enemy controller is getting a bit hard to manage and make more modular to make enemies with different behavior easily. For example I would want to have a number of different actions an enemy can do: Roam when a target is not in range (whether the be the player or another NPC) Roam when a target is not in line of sight Chase target when it enters within the enemies range Chase target when it enters the line of sight on the enemy Range attack target when it is in certain range of the enemy Melee attack target when it is in certain range of the enemy Teleport to a random location within a certain range when the target gets close enough to the enemy Perform seal heal when enemy's health gets too low Run away when the enemy's health gets too low Not all enemies will have all these possible actions so I want to be able to as easily as possible add and remove these action for enemies and just as easily add new actions to the pool of available actions. I am trying to figure out the best way to handle this kinda of behavior. Finite State Machines seem to be the most common thing I see suggested but was wondering if there might be something else I should be looking into. Also looking for learning resource for whatever solution I end up going with (ideally something in video form and even better if it is focused on a C# implementation). Any help with this would be awesome, Thanks. https://ift.tt/eA8V8J
So I am working on a 2D game in Unity that would probably be best described as a top down game similar to Starbound / Terraria with a much heavier focus on combat and character progress and less on the exploration / building. Up until now my enemy controller has been very basic with just inline code that does basic checking around itself for the player, chasing the player if in a certain range, attacking the player in a certain range, and so on. I am now trying to have more behaviors that the enemy can have and having all this inline in the enemy controller is getting a bit hard to manage and make more modular to make enemies with different behavior easily. For example I would want to have a number of different actions an enemy can do: Roam when a target is not in range (whether the be the player or another NPC) Roam when a target is not in line of sight Chase target when it enters within the enemies range Chase target when it enters the line of sight on the enemy Range attack target when it is in certain range of the enemy Melee attack target when it is in certain range of the enemy Teleport to a random location within a certain range when the target gets close enough to the enemy Perform seal heal when enemy's health gets too low Run away when the enemy's health gets too low Not all enemies will have all these possible actions so I want to be able to as easily as possible add and remove these action for enemies and just as easily add new actions to the pool of available actions. I am trying to figure out the best way to handle this kinda of behavior. Finite State Machines seem to be the most common thing I see suggested but was wondering if there might be something else I should be looking into. Also looking for learning resource for whatever solution I end up going with (ideally something in video form and even better if it is focused on a C# implementation). Any help with this would be awesome, Thanks.
from GameDev.net http://bit.ly/2LW5Mno
from GameDev.net http://bit.ly/2LW5Mno
ليست هناك تعليقات