Randomized pathfinding

Randomized pathfinding

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
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Randomized pathfinding

Post by Caydr »

Would minor randomization to the pathfinding be possible? Maybe so that one out of every 20 pathfinding decisions would be slightly different from another unit on the same path?

Not really important, I just thought it could help to eliminate the problem where every unit in an entire train will get held up by a single unit that's slower than all the others. Since they're all determined to follow the same route, they just keep bumping into each other.

With fewer collisions to gum up the works, pathfinding calculations might in my ignorant view possibly be sped up a little bit even.
User avatar
LOrDo
Posts: 1154
Joined: 27 Feb 2006, 00:21

Post by LOrDo »

This would be quite cool. And though I'm no coder, I think it may be quite complicated.
ironized
Posts: 172
Joined: 25 Jun 2007, 06:33

Post by ironized »

im not a coder either but i foresee it to be easy,
all you need to do is instead of it deciding on the quickest route, it decides on the 3 quickest routes then each unit picks one of the 3 randomly
User avatar
SwiftSpear
Classic Community Lead
Posts: 7287
Joined: 12 Aug 2005, 09:29

Post by SwiftSpear »

ironized wrote:im not a coder either but i foresee it to be easy,
all you need to do is instead of it deciding on the quickest route, it decides on the 3 quickest routes then each unit picks one of the 3 randomly
The 3 quickest routes are likely to be a segment of 1-2 total pixles off of each other... There are potentially infinite possible routes and the routes at the top of the bell curve in the weighted function will be virtually identical to the naked eye.
ironized
Posts: 172
Joined: 25 Jun 2007, 06:33

Post by ironized »

well then the easiest the 100th easiest and the 200th easiest ;)
User avatar
Zpock
Posts: 1218
Joined: 16 Sep 2004, 23:20

Post by Zpock »

I get annoyed that units moving close together constantly try to get around each other doing a lot of awkward turns. I'm thinking about trying some random small unit speed variations in the units script and see what that does.

For random pathing just make the unit go in the wrong direction by some varying random number from the planned path. Might just look like it's drunk tough.
User avatar
SwiftSpear
Classic Community Lead
Posts: 7287
Joined: 12 Aug 2005, 09:29

Post by SwiftSpear »

ironized wrote:well then the easiest the 100th easiest and the 200th easiest ;)
It doesn't list out every failed combination, it just finds the most efficient path at the top of the bell curve and ignores everything else. In order to find another path you need to prioritize something besides efficiency in the algorithm. It's impossible to find the 100th least efficient path. There will be two, one tied with the other at the opposite side of the bell curve, if not more.

You have a very very poor understanding of the mechanics of path finding AI. Spring's pathfinder is not a simulated trial and error navigation system.
User avatar
hunterw
Posts: 1838
Joined: 14 May 2006, 12:22

Post by hunterw »

does spring use anything randomly generated?

i think it might be the only game that does not use a random number generator. if it does where does it use it?
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

Wind Power and Direction? (That's about the only thing I can think of)
User avatar
Zpock
Posts: 1218
Joined: 16 Sep 2004, 23:20

Post by Zpock »

You can use random numbers in the cob script.

It would be awesome if effects could be affected by wind, like TA. Smoke moving in the winds direction and stuff.
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

Zpock wrote:It would be awesome if effects could be affected by wind, like TA. Smoke moving in the winds direction and stuff.
It does...look at a map with ludicrous wind.
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Post by Neddie »

Peet wrote:
Zpock wrote:It would be awesome if effects could be affected by wind, like TA. Smoke moving in the winds direction and stuff.
It does...look at a map with ludicrous wind.
Of course, the actual windmills are merely scripted animation.
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Post by Caydr »

All I notice is, when I push "B", there's this tree-like structure branching out in front of units as they pathfind. Can a unit not be told to just, rarely, pick a branch and go with it, then resume as normal when it reaches the next segment?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

I actually talked to K-man about this, and proposed a crazy scheme involving using a pixel-map to tell steering AI about the probable outcomes of their decision-trees, to solve a lot of this mess, but I'm too stupid to go beyond a theory and actually make it work :P
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

You could insert a midgoal on some non-optimal branch. There are problems, though - when you absolutely, positively need the unit to follow the exact path.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Sometimes I wished spring could be gridbased, i.e. 2x2 elmos (or what ever it was called) = one square. Units would always move to the center of a square.

And this is totally off-topic.

Yeah good idea.
Post Reply

Return to “Engine”