0 Favourites

RTS move in formation

This forum is currently in read-only mode.
  • 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)

    ___________________________________________________________________________________

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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.

  • Is this what you're looking for?

  • 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.

  • Well, now you have.

    Updated the .cap:

    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.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)