Fluid Motion in RTS unit

Started by
3 comments, last by Bobby Fisher 13 years, 2 months ago
Hi, I've been experimenting with C# and XNA, trying to see if I can make a 2D RTS.
After designing a basic class, I've gotten stuck on a design issue.

I want the basic user controllable unit to consist of smaller elements (i.e. player controls platoon, which consists of soldiers).

But how does one create a fluid, random motion of soldiers within the unit formation?

All I can think of so far:

When ordered to move, the relative position (at the destination) of each soldier in the unit is randomly changed by a small amount.

The troops have a somewhat randomly varying speed as they move. (terrain speed-modifiers would also affect this)


I would need to use a basic unit collision detection, not sure where to begin with that,


Any ideas, comments, implementation tips would be greatly appreciated.
This more of an excuse for me to expand on my programming experience, but getting something like this to work would be amazing for me!
Advertisement

Hi, I've been experimenting with C# and XNA, trying to see if I can make a 2D RTS.
After designing a basic class, I've gotten stuck on a design issue.

I want the basic user controllable unit to consist of smaller elements (i.e. player controls platoon, which consists of soldiers).

But how does one create a fluid, random motion of soldiers within the unit formation?

All I can think of so far:

When ordered to move, the relative position (at the destination) of each soldier in the unit is randomly changed by a small amount.

The troops have a somewhat randomly varying speed as they move. (terrain speed-modifiers would also affect this)


I would need to use a basic unit collision detection, not sure where to begin with that,


Any ideas, comments, implementation tips would be greatly appreciated.
This more of an excuse for me to expand on my programming experience, but getting something like this to work would be amazing for me!



Well, you need to decide a few things before proceeding.

Do you want the units (of the platoons) to move individually? Or should they move as a block, like a legion of phalanx?

In the first case, like Strarcraft did, you could, for the group you have selected, set the same target point for each unit in the group. So each unit would try it's best to get to that point. This caused units to keep moving even after the majority of the group stopped in Starcraft. As far as determining how each unit attempts to come to that location, you need to look up path-finding and find suitable algorithm for your terrain/map representation.

In the second case, you can handle the entire group as a single movable unit, but have individual animations for each unit. Each unit's animations could be oriented toward the target point, while the group gradually moved as a coherent block toward that point. This would, for example, result in all of the individual units facing inward if the block of units was centered directly over the target point.

As for collision detection, simple 2d detection schemes are bounding box, and bounding circles. Information easily found by googling "2d collision detection".

Hope that helps.
Thanks for the reply. I guess I was over-thinking the issue ;)
something you might find interesting!

and can you keep me posted on your progress on your project. i don't have really spare time now, but i am very interesting in XNA projects with some cool features.




Best of luck.


something you might find interesting!

and can you keep me posted on your progress on your project. i don't have really spare time now, but i am very interesting in XNA projects with some cool features.




Best of luck.




Thank you, I'll make a post when I have something interesting to show. Sooner than later I hope ;)

This topic is closed to new replies.

Advertisement