aliens

Author Topic: [FIXED] Zigzag?  (Read 3868 times)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
Re: Zigzag?
« Reply #15 on: April 13, 2024, 03:10:46 pm »
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.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
Re: Zigzag?
« Reply #16 on: April 20, 2024, 11:57:53 am »
I've added option to configure movement cost calculation rounding.

Code: [Select]
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.

Online Delian

  • Colonel
  • ****
  • Posts: 494
    • View Profile
Re: Zigzag?
« Reply #17 on: April 21, 2024, 02:33:48 pm »
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.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
Re: Zigzag?
« Reply #18 on: April 21, 2024, 02:42:06 pm »
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.

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
Re: Zigzag?
« Reply #19 on: April 21, 2024, 04:18:52 pm »
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.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
Re: Zigzag?
« Reply #20 on: April 21, 2024, 04:29:37 pm »
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.

Online Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: Zigzag?
« Reply #21 on: April 21, 2024, 05:33:46 pm »
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.

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
Re: Zigzag?
« Reply #22 on: April 21, 2024, 06:53:23 pm »
In any case, must first see what happened in the end. The table is certainly good, but... Waiting for update.  :)