Announcement

Collapse
No announcement yet.

AI Factions?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    AI Factions?

    I have a bunch of different AIs in my game that target one another, what would be a good measure to stop them from attacking members of the same class?

    If I've got a way of getting them to at least recognize which classes to leave alone I'm good.


    While we're at it, a way to get a bunch of AIs to move at once in a herd would also be great

    #2
    [MENTION=38249]BioCoder[/MENTION]

    A bunch of AI's are still managable, but I will agree that it is a tricky problem to deal with. Normally I would go with an branch and a boolean, but this would need to be set by every enemy every time they hit each other. That's just a waste of performance.
    Just an idea. Create unique object channels, so your classes will ignore any collision with a certain type. You can find them under Project settings -> Engine -> Collision. Just add different object channels for your different AI and then fine tune it in the AI collision itself (selecting the collision on your AI, choose an object channel and then clicking on "Custom"). You can choose there, what to ignore and what not to ignore. I am assuming you do a collision check to find your targets.

    To your second question: Go with the leader approach. Make some AI in a squad based system the leader and relay information to the other child AI's. The child AI's will get the instructions from just the leader and you get rid of performing a lot of individual detection AI behaviours. And when the leader dies you just promote an alive/remaining AI to be the new leader. One caveat though: Keep in mind that the leader need to have a good detection radius and general good detection. It is the only one checking for enemies, so the system relies on it's detection capabilities .
    Main channel:
    https://www.youtube.com/channel/UCGC...o9s3YcA/videos

    Comment


      #3
      That all depends on how you implement your AI.

      For eg you can make parent AI blueprint. Give it blueprint interface, and inside it implement function that returns some "love\hate" value.

      Then you make 2 dimensional array (yes some coding around that unreal has only 1 dim arrays), and you put values for relations of faction vs faction. When this stuff is working you can place it inside pure function with 2 inputs for 2 factions and output for their relation.

      With all that working and implemented in parent class blueprint, you cna inherit all other AI classes (factions).

      Then when its time for AI to decide if target is enemy or not you just call that blueprint interface inside target.

      Comment

      Working...
      X