strangeness with Pegasi movement in groups

If you find a bug please report it here

Re: strangeness with Pegasi movement in groups

Postby KGB » Thu Apr 11, 2013 3:19 pm

Chazar,

That sounds good in theory but won't work in practice. Plus it still won't compute the optimal path.

For example consider this

S = stack, X = destination
H = hills
M = mountains

XHH
MMH
SHH

In this case the flyer path will go directly over the mountain. But the land path must move around. The optimal way to move is to separate the units manually and re-join at X.

Also the flyer path is going to consider moving over water/mountains which land units can't (or over land which water units can't). So you can't be guaranteed to use the flyers path which is going to require coding to handle that the flyer path may be invalid and then throwing out that path and then potentially attempting another flyer path etc.

I suspect it will get really messy trying to do all that plus handle multiple paths and figure out which leaves the most moves for everyone (especially on REALLY long paths that take multiple turns to complete where it's going to be VERY rare that the 2 paths are identical). Then debug it all and make sure something hasn't broken someplace.

KGB
KGB
 
Posts: 3030
Joined: Tue Feb 16, 2010 12:06 am

Re: strangeness with Pegasi movement in groups

Postby Chazar » Thu Apr 11, 2013 3:35 pm

That case is handled as well, as an impossible path always leaves the least move point left over. This is what is currently happening: the flyers move around the mountain with the rest of the stack. So my suggestion does not do worse than the current situation.

So at the cost of twice the computation time minus the currently implemented special treatment of roads (for mixed flying/non-flying stacks only), it handles a lot of situation (not just hills) much better, and other situations just the same. My suggestion two posts above would even handle stack of scorpions/lightCav/pegasus correctly in desert terrain. So I'd say it is quite worth it.
Chazar
 
Posts: 670
Joined: Tue Feb 28, 2012 7:51 pm

Re: strangeness with Pegasi movement in groups

Postby KGB » Thu Apr 11, 2013 6:15 pm

Chazar,

The game can't split the stack to move it. That's not legal to do. For example it can't break out scorpions separately to move across the desert to meet up with a Pegasi/Lt Calv further on in a different square. Either you must manually split or they all must move together on the exact same squares.

The reason should be obvious. The game doesn't account for enemy units on squares. So splitting scorpions off to move separately could result in them being blocked by an enemy force and now your stack is separated and can't get back together to fight. Players would be livid if that happened automatically by the movement algorithm. Hence the need to manually do it so that you decide whether or not to do the split / rejoin.

Plus on moves requiring multiple turns (which I plot a lot of) you have to ensure that at the end of each turn your stack is together and not separated. Which is way beyond what the algorithm can do because now you have to solve for a path that handles waypoints at the end of each turn rather than just computing an end point.

Also there won't ever be an impossible path. Flyers over mountains is a legal path. So is ground units walking around. The impossible part is trying to send ground units over mountains. But that path will result in all your movement points being left (you never start the move). This currently happens now if you click on an impossible square (there is no path computed and the script times out after 10-15 seconds of trying).

I know you can code. So you should be able to write up the algorithm you want and test it. Then when it works you can publish and SnotlinG can take and use it.

KGB
KGB
 
Posts: 3030
Joined: Tue Feb 16, 2010 12:06 am

Re: strangeness with Pegasi movement in groups

Postby Chazar » Thu Apr 11, 2013 7:01 pm

KGB wrote:The game can't split the stack to move it.

The game is not supposed to split stacks, that would be ridiculous!

This is all about pathfinding for ONE stack, without changing the existing pathfinding code too much: Just use what is already implemented twice, then use these two determined paths for the entire stack and recalculate left-over move for each unit (ought to be easy), and pick the one path that has more left-over move (minimum over all units in the stack). Done.

So what I meant is that the pathfinding algorithm uses the existing method twice, once ignoring the flyers and once ignoring the non-flyers in the stack for the purpose of pathfinding, and then chooses the best path for the whole stack according to the two if-then-else test that I had outline in that post a bit above.

Little to implement, no special cases for roads needed (works on all terrain with all move bonuses), big improvement for mixed stacks.
Chazar
 
Posts: 670
Joined: Tue Feb 28, 2012 7:51 pm

Re: strangeness with Pegasi movement in groups

Postby Negern » Fri Apr 12, 2013 4:00 pm

Has happened a few times here too, that mixed stacks can travel further using certain paths rather than others, so I move one part at the time and can move a longer distance without the pathfinder. Should these things be reported too?
Negern
 
Posts: 345
Joined: Sat Nov 27, 2010 3:57 pm

Previous

Return to Bug reports

Who is online

Users browsing this forum: No registered users and 30 guests

cron
Not able to open ./cache/data_global.php