OpenXcom Forum
OpenXcom Forks => OXCE Bugs => OpenXcom Extended (OXCE) => OXCE Bugs FIXED => Topic started by: Ethereal on April 10, 2024, 09:23:30 am
-
Meridian, What did you do that caused the units to zigzag as they run? How to get rid of this?
-
Meridian, What did you do that caused the units to zigzag as they run? How to get rid of this?
You really believe I can do anything based on this description?
I don't see units zigzagging...
...if you want me to have a look at this, provide some actual evidence please:
- OXCE version number
- mod version number
- save game
- which unit should I look at (or a short video?)
- etc.
-
OXCE 7.11.
I can’t provide a save because the current version of TFTU is very different from the public one and there is no English translation for it. Translation is in progress... a very slow progress.
I mean running with the "control" key. Sometimes units will begin to zigzag, especially when the movement is not strictly in a straight line, or the tiles between the start and end point of the route have different movement costs.
-
Extracted into a separate thread.
If somebody can provide a video, or a save or any kind of evidence, I'd appreciate it.
(Otherwise I have no idea what this is about.)
-
Pure OXCE 7.12, without any modifications.
During normal movement, everything is fine. When running, with the "control" key pressed, the soldier therefore moves to a line lower, instead of walking in a straight line.
-
It seems to me that the pathing is trying to use the least TU cost of tiles to decide which is the best running path based on the first two images I'm attaching (000,001) which results in some cases using a zig-zag pattern. Oddly enough if I choose a closer destination within the same path it won't zig-zag (002,003). The last two images are similar to the two first ones but with the destination changed to one tile over to denote the zig-zag pathing. As far as I can tell, the final cost of running to the destination in this particular case is the same for both TUs and energy regarless if you run in zig-zag or if you run in a straight line via shorter 'dashes' so the code decides to always move to a tile with least TU requirements (?), just guessing here.
My only suggestion at this point is, in the cases where more than one path cost exactly the same TU / Energy, pick the path with the least number of diagonal moves.
-
My only suggestion at this point is, in the cases where more than one path cost exactly the same TU / Energy, pick the path with the least number of diagonal moves.
In my opinion this is unnecessary. I don't need additional automation and calculations. I need the return of the original route search and that it be the same along the trajectory for both running and walking.
-
Short paths do not use complex pathfinding, if there is direct move then game use linear path even if is not optimal.
Long paths try find best move that have minimal cost to reach destination. As we see on screenshot there are objects (grass) on paths that
unit try move. If this grass affect move cost then pathfinding try avoid it as max as possible.
-
Long paths try find best move that have minimal cost to reach destination. As we see on screenshot there are objects (grass) on paths that
unit try move. If this grass affect move cost then pathfinding try avoid it as max as possible.
Is it possible to disable this optimization, or put it into a separate option that could be activated/disabled at will?
-
This algorithm is implemented since the beginning of OpenXcom.
I will try your save over the weekend to see if there are any unexpected effects/bugs.
But if the behavior in OXCE 7.12 is the same as in the older OXCE versions and in OXC, then it will not be changed (and it will also not be configurable).
(If there is a bug compared to earlier versions, it will of course be fixed.)
-
I'm not sure if the player should care all that much if the path taken differs slightly from the most direct path.
The issue mostly comes up if you have intentionally or unintentionally (e.g. a knocked out soldier) deployed proxy or other mines and you want to make sure that no-one will be moving next to them. Then the precise path to be taken is of vital importance. Then as a player you'll use path preview and other tools at your disposal to make sure the soldiers won't run into the mines.
In that case as a player I'd be most interested to ensure that path preview and the actual path taken would be the same. If I recall correctly, there have been some cases where the path preview and the actual path have been different, leading to nasty mine explosions.
-
But if the behavior in OXCE 7.12 is the same as in the older OXCE versions and in OXC, then it will not be changed (and it will also not be configurable).
(If there is a bug compared to earlier versions, it will of course be fixed.)
This bug starts with OXCE version 7.6-087f5ca19-2022-07-15. Earlier versions do not have this bug.
-
This is only bug if cost moving in straight line is smaller, if cost is bigger then this is feature as allows unit do more after reaching destination (more TU left to shoot or kneel).
-
The tall grass affects movement cost. It is an object-type MCD on top of the floor MCD: the movement cost of the two MCDs stacks (I dare to say that's how it works), meaning higher movement cost on those tiles.
I think the pathfinding is zigzaging to avoid the tall grass to optimize movement cost.
So the pathfinding should be tested on a map with a "pure" floor made of one single MCD (floor-type tiles can have different costs too).
-
So the pathfinding should be tested on a map with a "pure" floor made of one single MCD (floor-type tiles can have different costs too).
This is completely unnecessary. I have had cases more than once when, as a result of such zigzags, a soldier came out from behind cover and came under enemy fire. So the formula: where you were sent, you came there along the shortest path, looks preferable to stupid calculations of the cost of movement.
It's like with mountain infantry. Why climb mountains if it’s easier and faster to get around them? But no, they climb and gain a tactical advantage over the enemy, instead of “unexpectedly” bumping their horns into a strong point on the road and unsuccessfully storming it for months.
-
I can confirm the behavior is different than in previous OXCE versions.
(happened between v7.5 and v7.6 two years ago)
Culprits:
https://github.com/MeridianOXC/OpenXcom/commit/c9a922fbc41e13c8103a896220ecdec07e67ae21
and
https://github.com/MeridianOXC/OpenXcom/commit/c08325b26b54f87d0c4a026b3e9b252ee7419c61
They can't be just reverted, because other things would break.
Yankes and I will try to find a good solution soon-ish.
-
I've added option to configure movement cost calculation rounding.
constants:
extendedMovementCostRounding: 2 # 0 = OXCE Floor (default), 1 = OXCE Round (0.5 up), 2 = OXCE Round (0.5 down)
Since oxce 7.6 option 2 was the default (and indirectly caused the zigzag), since oxce 7.12.6 option 0 will be the default.
Option 0 is closer to OpenXcom rounding (but not perfect), you can see the difference in the attached picture.
For modders who plan to use custom movement costs (global or per armor or scripted), I don't recommend using option 0... I recommend switching to option 1 or 2.
-
I don't see any bugs here. Pathfinding is pathfinding and it's designed to find the shortest path, that is, the path that consumes the least amount of TU. I like the current behavior and, in fact, I would consider it a bug if a unit didn't take the shortest path. The zig-zag situation that Ethereal experienced, I also experience all the time, except I WANT the unit to take the zig-zag route because it saves TU. When I see grass or other slow terrain on the floor, I know that walking on it consumes more TU, so I expect the pathfinding to find a wavy path through it. If the path bothers me, I can always move the unit 1 by 1 tile, but 99% of the time I prefer the shortest path.
-
I did not change anything in the pathfinding.
The unit found the shortest path before and will find the shortest path also today and in the future.
-
I did not change anything in the pathfinding.
The unit found the shortest path before and will find the shortest path also today and in the future.
Apparently, what was meant was that it would be a good idea to completely disable the calculations of spent TUs and use only the minimum number of tiles from start to goal to calculate the optimal route, ignoring the cost of movement completely. That would be nice, but is it worth the time?
It’s important to me that the soldiers stop running out from behind cover. In my modification, the armor is, of course, overly strong, but still have to live to see it.
-
That would be nice, but is it worth the time?
I cannot think of anyone (except for you of course) who has ever asked for such a feature.
For me personally it makes no sense (same as for Delian), but if there are enough votes from other players, it can be considered.
-
I too do not see point in crippling pathfidning, beside as I previously said for short paths game try keep straight paths.
If you want have more control move units in short steps.
-
In any case, must first see what happened in the end. The table is certainly good, but... Waiting for update. :)