# RTS move in formation

For questions about using Classic.

### » Tue Oct 20, 2009 12:05 am

I figured i'd ask before having a mild aneurysm trying to figure it out.

how would you make a selected grope of units move to the mouse but in there original configuration relative to each other, but not necessarily maintaining there formation while moving.
i think its pretty commonplace in most modern Rts's ,i know total annihilation had it.

i don't know if i did a good job explaining my dilemma, so i made this little diagram to confuse you even more.
__________________________________________________________________________________

`````````````` ----------------------------------------> X

```````` ---------------------------------------->X (click)

``````````` ---------------------------------------->X

___________________________________________________________________________________
( = selected units original position) ( X = destination)
___________________________________________________________________________________
B
6
S
2
G
5
Posts: 249
Reputation: 2,323

### » Tue Oct 20, 2009 12:33 am

This is a decently complex problem that even some commercial games fail to solve.

One quick answer is to grab the average of the selected units original position and then offset the destination for each from the clicked point according to the offset of the unit from the original center.
But that is ignoring the angle. You could rotate the destination position around the calculated center according to the angle from the origin towards the destination.
But that is ignoring the formation along the trajectory.

You can see how this gets more complex as you want it to be better. I'd say you can safely ignore trajectory and angle, and if you go for angle you'd be matching some of the AAA titles out there.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

### » Tue Oct 20, 2009 1:27 am

Is this what you're looking for?

viewtopic.php?f=16&t=4839
Moderator
B
95
S
34
G
33
Posts: 3,006
Reputation: 27,874

### » Tue Oct 20, 2009 3:44 am

I wasn't even worried about the angle, just the relative position but, wow.

thanks so much

yeah, with out rotating angles the units tend to keep there formation. then when you need to rotate a direction you do it before they move. as far as moving in formation in angles with custom formations, i don't think I've ever seen it done.
B
6
S
2
G
5
Posts: 249
Reputation: 2,323

### » Tue Oct 20, 2009 2:26 pm

Well, now you have.

Updated the .cap: viewtopic.php?f=16&t=4839

It's not exact, but the only way I can think of to make it exact is to make units have a varying speed, and that would affect the game mechanics. As you mentioned, not worrying about the angle helps a lot though.
Moderator
B
95
S
34
G
33
Posts: 3,006
Reputation: 27,874

### » Tue Oct 20, 2009 7:03 pm

sweet

as for applying it to a rts i imagine you'd create the group point and placer for the group after selecting them then issuing an move order, than assign a value of to the group and group point of what group they are so you could have multiple squads moving to deferent places.
also seems with some tweaking you could use the same idea for having pre-selectable formations like box and wedge ect.
B
6
S
2
G
5
Posts: 249
Reputation: 2,323

Return to Help & Support using Construct Classic

### Who is online

Users browsing this forum: No registered users and 3 guests