Jump to content

  • Log In with Google      Sign In   
  • Create Account

formns

Member Since 07 Mar 2011
Offline Last Active May 05 2013 10:14 PM

Posts I've Made

In Topic: RTS-unit formation

12 March 2011 - 07:23 AM

Yes, so I never make units move without pathfinding.
To be sure, using pathfinding their leader, units can avoid obstacles.
But, it is not necessary to form while units are moving.
All they have to do is to form when they finished their movement.

Pathfinding is quite a few heavy process,
so to match destinations to units is better than to pathfinding to leader incessantly, isn't it ?


And, even if I make units follow their leader,
same problem will happen : I can't match to units best position(offset to leader),
that units don't hit mutually and as close to it as possible.


Yes, when unit do pathfinding, if unit consider moving-obstacles, unit can avoid other units.
But, in commercial RTS game units get best position - not hit other units at all.
How do I calculate it ?


In Topic: RTS-unit formation

10 March 2011 - 05:44 AM

Thank you for kind reply.
I'm sorry if I don't understand your reply well.

OK, there is no "standard" way.
I'll find best way for my RTS game. :-)

Are you able to move a single unit satisfactorily? Pathfinding to any destination, moving obstacle avoidance, fighting along the way? Reliably sending units anywhere you need is a prerequisite for movement in formation.

Yes, map of game is made by Graph, units can pathfind with A*algorithm.
and units can avoid obstacles with "steering behavior".


but it is usual to designate a leader unit that simply moves towards the destination (where the user clicked) and have the other units in the group move towards a specific position close to the current position of the leader.

"Steering Behavior" has way like this behavior, "Leader Following".
I implemeted this one. But, it didn't work well,
for "other units" only follow them leader, don't follow path,
so that if them leader is in the other side of wall, other units follow leader
so other units rush at wall, never reach them leader.
I think that mutual obstructions are better than rushing at wall.

Another typical pattern is having each unit decide
where it wants to be relative to its closest neighbours in the formation,whoever they might be (usually in order to align and/or spread evenly).

Is it like using "Flocking" for units ?
In any event, units which don't know paths will rush at wall.


As you said, If I match destinations to units, units never hit obstacles, walls..
The problem is that :
the position of the formation isn't assigned to "best" unit.
-"best" means closest, for unit and for position.
for example, A is the closest unit for position X, and B is the closest unit for position X, too.
And, A is closer to position X than B.
in this case, position X should be assigned to A,
and B should be assigned to the closest position except position X.
I think that if I use this way, units won't crash another unit and the formation will be assembled fastly.
But I don't have a lot of confidence. Is my idea wrong...?

In addition, I'm sorry I'm shameless, I want to know how I make units go their destination,
I also want to know how I determine the destination for unit as position concretely :-)

PARTNERS