EQS for Coordinated Unit Movement

Hey Guys!

I don’t post often so I hope this is a good place. I am still learning EQS and was wondering if anyone knows of some good examples out there I can use to learn it better? I’d like to see some cool implementations of it. I’ve watched the twitch live streams on AI and EQS and ran through the quick start already.

I am trying to figure out how to handle multi-unit movement in a game by selecting a group of characters with AI player controllers and move them to a location (like an RTS game). The problem I face is determining the best way to handle them getting to that location without the other constantly bumping into the unit thats there trying to get to the same spot.

I see three potential solutions for this problem, determine a group leader and calculate relative positions from that leader and set the positions that way, use the EQS system to determine the best location relative to the one that was selected, or maybe some combination of the two.

I am not sure what the performance of either option is but I’d like if it were able to easily handle a large number of units without killing performance.

What you seek may be more complicated than EQS could provide. Surely it is a good step, though there are many things you need to arrange before that.

If you look at other RTS games, most notably Tiberian Sun series, they use grid system to move around. You only see those grids if you are placing a building, but the same system is used for movement aswell. 95% of the units are in size of one grid, and I am sure that there is a system to check if a specific grid is taken or not. Whenever you give the command, you can even see the pointer dot that is landed on the grids for each unit. So when they arrive, there is no fighting for where to go. This is actually a good way to do a RTS game, because the spots are taken from the very beginning, and even letting your group easily move from narrow paths as units respect the order. And you don’t need to determine a group leader for this as ForEachLoop for available grids will solve the problem.

Some games do not use this method, like Total War games. Because the fights are tend to be rather chaotic and more realistic. Though if you ever check the videos related to movement bugs, you will see hilarous stuff. EQS system could be used for this system though you better prepare yourself for unforseen consequences.

In my opinion, the AI movement system is still not in that stage to make 15000 vs 15000 units play and fight with each other. Maybe thats the way it supposed to be as even in real life, it is chaotic. :stuck_out_tongue:

Long story short, some RTS games uses “early rezervation of a grid at the time of the command given (Red Alert, Tiberian Sun)” while other systems hopes for the best every second due to insane amount of units (Total War). Choice is yours. :slight_smile:

1 Like

Thanks for the reply!

I think for my purposes I would imagine players to only be potentially controlling at most 200 units, maybe a bit more. However, like in some RTS games I could make the max size of a control group much smaller allowing the player to control maybe 40 units at a time. I am just concerned about scalability and choosing an good/accepted approach. This particular issue doesn’t seemed covered in a lot of detail as far as my research has shown me.

I have been studying how some RTS games work and have noticed that they seem to be adhering to some kind of grid in a lot of cases and that’s why EQS seemed to appealing to me because it lets me kind of query a grid around the querier. EQS seems more like a “pseudo grid” because the grid positions seem to be relative to the querier and not the world. I am not sure what a good approach would be for “gridding” the map in UE4. I felt like EQS could take care of having a grid but I am not sure how I could “claim” a spot on that grid relative to the world which is why choosing a leader with relative positions when moving a group seemed important.

No problem!

What you are planning will be quite chaotic nonetheless. And the more you try to make it look better, the more you will increase the amount it works to take. Because if you are going to use a grid-like system, all units have to check if the said grid is available, or the grid it want so to use to reach that certain grid. There are ofcourse ways to optimize this. From what I remember, in Tiberian Sun, you can give two units the same spot as a command to go, then the grid is claimed by the one that arrived earlier and the other guy stands at another grid that is closeby. Though even this will require more work. Because what if you had 9 units going to one stop and they take all the grids (3 to 3) and you told another unit to reach out the middle one?

As you see, grid system demands you to do alot of work, maybe tons, but the result will be amazing in the end.

About EQS, I think you can increase the “grid” amount it checks? You can maybe fit it to your maps, but I don’t know really. I never worked on EQS as it’s still experimental and I believe you are right about EQS’s grid alighment. It takes account of the pawn rather than the world. Though I know it works best when you want to find the closest point or the best/shortest route, which is essential to RTS games.

Personally, If I needed to make a RTS Game, I would create a blueprint system to spawn the grids according to a layer system, layers being the height levels of the map. Also having specific objects preventing the grid spawn and have them stored as variables. It is a long run, but I believe it’s the best option if you want the fight to be organized rather than the Yolo mode of Total Wars. :slight_smile:

Thanks for the insight. I am not sure what needs to be on a grid and what doesn’t. It seems like the units in some games don’t follow a grid but the buildings always do. Spawning a grid across the entire map seems like it could hurt performance a lot but could be something for me to think about.

That is something you spawn at the beginning, before the game is actually playable so performance shouldn’t be a problem. Without grid system you would also have to build Navigation almost every tick so units do not collide with each other or try get inside. Not sure about the performance hit would be then though.