Posts: 10,463
Threads: 394
Joined: Aug 2015
When moving one tile at a time, diagonal movement costs 50% more than normal.
However, when moving multiple tiles at a time, it costs same in all directions.
I haven't even started investigating this because I'm not sure what the desired goal is.
I assume (haven't actually tested) that AI units don't pay the extra 50% either.
So the question is, would making the cost the base amount in every direction including diagonals be a good solution? I expect adding the +50% to the multiple tile movement would be far more difficult, if possible, but I don't know yet. It also would make the AI think they are close enough to reach something for attack in a turn when they cannot, probably.
January 7th, 2016, 15:06
(This post was last modified: January 7th, 2016, 15:06 by Anthony.)
Posts: 591
Threads: 30
Joined: Jul 2012
AI units never move 1 tile at a time, so I doubt they're affected at the moment. It seems easiest to just remove the extra cost for diagonal movement.
Posts: 488
Threads: 51
Joined: Apr 2012
It doesn't cost 3 movement to move 2 diagonally? I thought it did.
Posts: 10,463
Threads: 394
Joined: Aug 2015
(January 7th, 2016, 20:18)Tiltowait Wrote: It doesn't cost 3 movement to move 2 diagonally? I thought it did.
It does but you can do it if the unit only has a movement of 2. The amount checked and the amount actually subtracted are different for some reason.
Posts: 488
Threads: 51
Joined: Apr 2012
I think the 1.5 diagonal movement should always apply.
February 28th, 2016, 04:12
Posts: 10,463
Threads: 394
Joined: Aug 2015
I managed to locate the source of the problem.
There are two procedures.
DC12F Calculates the costs of the shortest path to all map cells, and uses the base costs for all directions.
DBC80 Gets the shortest path to the target used when actually moving, and does add +0.5 for diagonals.
Removing the +0.5 is easy, takes a minute.
Adding a check for an extra +0.5 in the other procedure...doable but probably 1-2 hours.
Haven't decided which to do yet, not sure how this decision would affect running around in circles from an enemy, but it will affect it somehow for sure.
February 28th, 2016, 05:26
(This post was last modified: February 28th, 2016, 06:17 by Seravy.)
Posts: 10,463
Threads: 394
Joined: Aug 2015
Fixed but it sure will feel weird playing like this.
If you only have 0.5 movement left, you can't even move or attack diagonally to the cell nearby....but the AI is able to move like that!
Need to find a way to fix this too!
...well basically it subtracts the cost of the last cell's cost when checking if the movement is valid.
Even if I fixed this to consider diagonals, the result would be inconsistent because it just is.
Example :
If you move like this :
->, \, \
Then this is 1+1.5+1.5 = 4 movement points. However, since the last one is 1.5 points you can still do it with a unit that moves 3 as it has 0.5 points left.
But if you do this one :
\ , \, ->
It's the same destination but it is invalid, as all 3 movement points are used up in the first two steps. Both paths have an equal chance to be found first by the pathfinder algorithm so it's a 50-50% chance of whether movement is allowed or not.
Basically a system where you can enter a cell without having enough movement and a system where different directions have different costs will never be compatible.
This is also the reason for why the AI sometimes moves more, other times less, it just keeps going while it can so depending on which direction it is moving first, it might, or might not be able to do the last step.
At this point I think the only logical solution is to make diagonals cost 1.
Posts: 520
Threads: 8
Joined: Jul 2011
I think this entire thread might be missing something.
That's not how combat movement works in any similar game...
It doesn't cost 3 movement to move twice diagonally. It costs 1.5 movement to move diagonally once and then the final 0.5 movement any unit ever has can move any direction.
The same is true on the world map. It only costs 1movement to enter a swamp or forest because the minimum amount of movement always allows you a single move in any direction.
3.5 movement would be enough to move diagonally three times. Working as intended. Always has been, never was a bug?
Posts: 10,463
Threads: 394
Joined: Aug 2015
(June 17th, 2016, 21:21)namad Wrote: 3.5 movement would be enough to move diagonally three times. Working as intended. Always has been, never was a bug?
The bug was that you could move 4 tiles diagonally if you moved all at once, but only 3 if you moved one at a time with 3.5 movement points.
Also, if you had 3 movement, then moving to a tile 2 left and 3 up would be possible if taking "left, diagonal, diagonal" but fail if taking the "diagonal, diagonal, left" path. This causes inconsistency in pathfinding, too since the tile is both marked reachable and too far, it's random which takes priority.
Posts: 591
Threads: 30
Joined: Jul 2012
Note that you can also make use of roads containing friendly units if you move multiple square at a time, but not if you move only one.
|