Movement cost overlays

Movement cost overlays

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
b1ind
Posts: 48
Joined: 21 Apr 2005, 04:01

Movement cost overlays

Post by b1ind »

Since it seems that the pathfinding works based on A* and cost values related to the map's slope, I propose that we implement a system of overlays for the costs. Suppose I wanted units to avoid a certain valley, I could hilight the valley with some shortcut key and it would create an overlay, increasing the cost of movement in that area. The same tactic could be applied for telling units to seek a particular route by creating an overlay to decrease the cost of movement.

I think that the pathfinding component of this idea would be relatively straightforward. The nice thing is that it only requires subtle changes in the algorithm to accommodate a vast array of strategic possibilities. The overlays could be created in non-cardinally oriented ways by simply rotating the camera before creating them. They could be displayed as some sort of graphic overlay on the terrain like the LOS stuff.

PS: I'm too busy w/ finals atm to get this done, but I'd love if someone could expand on this idea and implement it. I think it would add a new dimension to the gameplay.
User avatar
Ace07
Posts: 348
Joined: 21 Apr 2005, 20:46

Post by Ace07 »

When I have a lot of units, the pathfinding is quite laggy. Sometimes there is a lock for as much as 0.5 seconds when I have a lot of units moving around. I would rather that they improve this myself.

(Although, I run it in Linux, so its possible that the problem lies from using a binary loader to run it. I doubt it though.)
Last edited by Ace07 on 05 May 2005, 22:22, edited 1 time in total.
SJ
Posts: 618
Joined: 13 Aug 2004, 17:13

Post by SJ »

The current spring pathfinding system does a lot of precalculations about the map (which is updated on the fly when the map changes) and letting the user create overlays on the map would force us to branch these calculations for each team which could be expensive.

I have thought about the same sort of thing but I havent found a good/cheap way to do it with how the spring pathfinding currently works.
b1ind
Posts: 48
Joined: 21 Apr 2005, 04:01

Post by b1ind »

I think that the pathfinding efficiency could be dramatically increased if you were to implement per unit 'behaviors'. That way, a group movement command could be implemented as a single path (per unit movement ability). Units would then be given a steering behavior to follow that path. Maybe the pathfinder max iterations should be more dynamic too.
User avatar
Gabba
Posts: 319
Joined: 08 Sep 2004, 22:59

Post by Gabba »

I'm still doing research about that, but the following looks like a nice library we could use or at least get inspiration from:
http://opensteer.sourceforge.net/
renrutal
Posts: 84
Joined: 28 Apr 2005, 16:45

Post by renrutal »

b1ind wrote:I think that the pathfinding efficiency could be dramatically increased if you were to implement per unit 'behaviors'. That way, a group movement command could be implemented as a single path (per unit movement ability). Units would then be given a steering behavior to follow that path. Maybe the pathfinder max iterations should be more dynamic too.
Same opinion here, given a n number of units being moved at the same time to the same place, just calculate one "long range path", let the units be automatically grouped(unless the user states they should not mix). Then calculate several "short range paths" so they units remain in the same formation while going over minor obstacles.

Nice findings b1ind and Gabba :-)


And my favorite reading about pathfinding in games:

http://www.moonpod.com/board/viewtopic.php?p=6958#6958
b1ind
Posts: 48
Joined: 21 Apr 2005, 04:01

Post by b1ind »

I'm currently just refreshing myself on A*. This page seems to be a very good resource. If anyone else is interested in our discussion, please take a look at that page.

edit: fixed the bbcode just for Alantai
Last edited by b1ind on 06 May 2005, 22:31, edited 1 time in total.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

You people need to learn your BBCodes. I type crap btu I alway get my bbcodes right at least
b1ind
Posts: 48
Joined: 21 Apr 2005, 04:01

Post by b1ind »

I just realized a problem with my idea of creating a single path for group movement. The problem is that of determining an origin. If you click CTL-A for example (all units) and tell them to move to point B, they will all start from very different locations. How would you even get units to the path? That I don't know, but maybe some compromise can be made for units that are within a certain radius.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I dunno ought about pathfinding, but does the pathfinding find paths for common areas and then save them for later use in a similair circustance?

Besides I ahve an interesting idea for my skirmish AI to combat this.
renrutal
Posts: 84
Joined: 28 Apr 2005, 16:45

Post by renrutal »

What about pre-definition of paths? Sorta of a waypoints style.

It could come with the map, implemented specially in areas like roads.

Also it could be stored dynamically, as the units go through the map, they leave waypoints stored in the player's computer, so other units going at it would use the data.

Well, or you get CPU heavy, memory heavy(primary or secondary memories) or a mid-term.
Post Reply

Return to “Engine”