Hi
Im doing a tilebased (A* pathfind) rts (think warcraft 2) with large tiles (one unit per tile). When i issue an attack order on a specific enemy i want to get close to it and then attack.
When i click an enemy i find a free, walkable adjacent tile (preferably the tile closest to where the attacker is, so the unit doesnt walk all the way around the target and hit it from behind) and set the attacker to move there. When close enough for attack (melee or ranged attack) i stop moving and attack the target.
But the target may move at any time, so i need to recalc the "move to this tile to be able to attack" and redo pathfinding. This may get slow right? And ranged units dont need to find an adjacent tile, just any tile close enough to the target to be able to attack it.
Any good way of doing such things? My method seems crude to me. What if there are many units involved? (selecting 30 of your guys to attack someone).
Thanks
Erik