#### Archived

This topic is now archived and is closed to further replies.

# Movement system for RTS game?

This topic is 5515 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi! I was thinking of a good movement system to implement for an RTS game (e.g. Starcraft, Warcraft, C&C, etc.) I am new to the industry (obviously), so the best idea I could come up with is as follows: - Separate the map into a grid of tiles - Tiles are only used for pathfinding e.g. (AStar) - Units can be positioned independently from Grid, and use the path generated by AStar to follow grid tiles, however with slight collision detection to make sure they don''t clash with other units. So pretty much, the only use for the grid in an/my RTS is for pathfinding and stationary obstacle avoidance, "fog of war", and stationary obstacle placement. The rest is pretty much simple movement with even simpler collision detection (e.g. distance between two points). The only thing I don''t know how to solve is the problem if variable unit size. Any suggestions? Improvements? Do you know a better way of doing this? Am I on the right path? Thanks for your time, - Cyril.

##### Share on other sites
Hello there!

I´m also developing a RTS game in the way you mentioned.
First of all; I think you should separate the tiles from the collision map/fog etc..

meaning...

_ _
|_|_| for every tile there´s four collision tiles.
|_|_|

And the variable size of units, why not simply check (using a for function or whatever you feel pleasant) if all collision tiles in the area the unit wants to go to is available?
^ this is how I've done it.

bool Collision(float/int sizex, sizey)
{
int Check = int Ok = 0;

for (sizex of unit)
{ for (sizey of unit)
{
if (CollisionMap[x][y].Available == true)
Check++;

Ok++;
}
}

if (Check == Ok)
return false;
else
return true;
}

Hope this helps!

[edited by - Rasmadrak on August 20, 2003 1:01:41 PM]

[edited by - Rasmadrak on August 20, 2003 1:02:27 PM]

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5
JoeJ
13

• 9
• 14
• 10
• 25
• 9
• ### Forum Statistics

• Total Topics
632645
• Total Posts
3007630
• ### Who's Online (See full list)

There are no registered users currently online

×