AI Squad

Hi,

I have the following requirements to fulfill designing an AI only squad mechanic for an RTS but cant find the best way to do it.

Here are my requirements:

  • a squad which is placeable in the world at design time
  • the squad will be made purely of AI actors which may or may not be a pawn
  • ability to specify all its squad members
  • ability to specify what formation the squad will use (I already have this mechanic working)
  • assume I already have other actors to fill the squad with

What I have tried and thus the issue with my approach. I created an Actor called BP_Squad, as I want it placeable in the world. I have a variable array called Members which is of type Actor Class. I have my logic for generating a desired formation attached to this new actor via an Actor Component. I then have logic which creates Child Actors at each position including the Leader. My problem is this, once created I can move each child actor around following the formation, however I want the parent Actor, the BP_Squad to follow the first Child Actor i.e. the leader, and not remain stationary. Reason being I want my formation positions to be generated around the leader at all times. I appreciate I can spawn the points at World position instead of Relative, but that doesn’t feel like a good design to me. I guess the question is can you move the Parent Actor without moving its Child Actors?

The alternative I thought of would be to add an Actor Component called SquadComponent to a Leader type class which handles the formation and squad member creation, however that doesn’t feel right to me either because I want to set the leader actor via a variable to make the system more flexible.

The last version is how I’ve already seen it approached would be to place the Actors themselves in the world. Have an Object class to represent the squad functionality and place units in a formation. The Actos are assigned to the Object class. However at design time I would be placing individual units on the map, not as a single squad Actor.

Sorry for the long winded question(s), can you help me with a good design to handle an AI only squad mechanic?

M

ps I have the coding skills, in this case its the best practical design for Unreal

So I think I can use my first approach along with Set Absolute node to resolve my issue.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.