[Oxyd] [0.16.51] Cease-fire unit groups attack on move order

This subforum contains all the issues which we already resolved.
mk-fg
Long Handed Inserter
Long Handed Inserter
Posts: 69
Joined: Wed May 30, 2018 11:01 am
Contact:

[Oxyd] [0.16.51] Cease-fire unit groups attack on move order

Post by mk-fg »

I'm working on a mod which adds mostly non-aggressive units (which will retaliate though) and wanted to order groups of them to move around player's base.
But that does not work as units bump into infrastructure and randomly start attacking it, even though both their and player's force are on cease fire.
Same happens with rocks if they happen to be in the way, which is already reported, but not a concern here (unlike random impossible-to-disable aggression), just a side-note.

Specific command that mod runs for a group:

Code: Select all

group.set_command{
  type=defines.command.compound,
  structure_type=defines.compound_command.return_last,
  commands={
    {type=defines.command.go_to_location, destination=pos},
    {type=defines.command.wander} } }
Force of the group and all units belonging to it have cease-fire with the player and vice-versa.

Expected result:
Group units move to specified position without attacking any of player's infrastructure.

Actual result:
Group units always start attacking player's stuff as soon as they bump into them.
This includes entities which don't seem to hinder movement, like belts.

Why is it unexpected:
As far as I understand the meaning of "cease fire", and as it is documented - "Stop attacking members of a given force." - random aggression is not what is supposed to happen during "move" command.


How to reproduce:

- Install/add Will-o-the-Wisps updated version 0.0.41+ to any existing game with plenty of buildings and pollution, as well as trees on the map.
- Wait until it is dark or set darkness value via mods/console.
- Run following console commands in sequence: "/wisp zone update", "/wisp congregate".
- Open map, newly created group and their move destination should be marked there, see how it's impossible to have this group not attack stuff on the way.
- Run "/wisp stats" command, note how it enumerates all attacking units as belonging to "peaceful" force, which has cease-fire with player (that never changes).

Will attach log and a savegame (where these commands produce such result, 14M).
Latter is rather heavily modded, but pretty sure there should be no mods which come anywhere close to touching that kind of behavior.


What sounds like a good fix:
Make units never attack forces they encounter that they have cease-fire with.

What sounds like a second-best fix:
Add e.g. distraction=no-pathing-attacks option/flag (or a separate move-only command) that'd tell units to not attack non-hostile stuff they bump into.
And document "cease fire" option as "more of a guideline than a rule", saying explicitly there that units can and will still attack everything in their way, disregarding cease-fire, unless ordered not to via command.


Attempted workaround:
Setting distraction= for commands above to all documented values, including "none" - no effect.

Possible workaround:
Replace all entities in group with ones without attack capability for the duration of command.
This seems very suboptimal wrt how it'd work and requires a bunch of special-case lua code to handle.


Thanks!
Attachments
test5.zip
(13.42 MiB) Downloaded 79 times
factorio.log
(10.44 KiB) Downloaded 81 times
Rseding91
Factorio Staff
Factorio Staff
Posts: 14393
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.16.51] Cease-fire unit groups attack on move order

Post by Rseding91 »

I don't see this as a bug. They attack anything that gets in their way when they're trying to path somewhere unless its something on their force. It's not that they're aggressive towards it or not - it's just in the way and it's how they get around the thing in the way.

If they didn't do that they would never be able to path through walls/trees.

But, I'll leave this up to Oxyd to decide if he wants to change it.
If you want to get ahold of me I'm almost always on Discord.
mk-fg
Long Handed Inserter
Long Handed Inserter
Posts: 69
Joined: Wed May 30, 2018 11:01 am
Contact:

Re: [Oxyd] [0.16.51] Cease-fire unit groups attack on move order

Post by mk-fg »

I think inability to path to destination would be easier to work around in lua than attacking things at random.
I.e. when command fails for some units, handle it in lua by either giving move command in a different direction, attack command, or whatever else.
Instead of doing a different thing - attacking - automatically and implicitly, that is.

Hence the second fix suggestion - a flag or distraction-option to disable this implicit destructive behavior.

Also, maybe it's worth at least documenting this behavior in go_to_location and/or set_cease_fire?
It looks like a bug there at least, since neither mentions that a) units do not actually stop attacking anything, and b) go_to_location is actually an attack-move command which disregards ceasefire, not just move as one might think.
mk-fg
Long Handed Inserter
Long Handed Inserter
Posts: 69
Joined: Wed May 30, 2018 11:01 am
Contact:

Re: [0.16.51] Cease-fire unit groups attack on move order

Post by mk-fg »

Rseding91 wrote:I don't see this as a bug. They attack anything that gets in their way when they're trying to path somewhere unless its something on their force. It's not that they're aggressive towards it or not - it's just in the way and it's how they get around the thing in the way.
If they didn't do that they would never be able to path through walls/trees.
Another two things that came to mind:

While I can see how this might be necessary for "move to destination at all costs" in some pathological cases like wall circles, units are doing this in cases that are nowhere close to that - e.g. destroying slow belts that cross their path and not an obstacle - where it doesn't seem to be necessary at all.

And since same-force units are already avoided or treated as blockers, and not just attacked, would be really useful to have an option to treat cease-fire forces in the same way.
Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [Oxyd] [0.16.51] Cease-fire unit groups attack on move order

Post by Oxyd »

I'll look into it, damaging belts certainly sounds like something that shouldn't happen. No promise that it'll be for 0.16, though.
mk-fg
Long Handed Inserter
Long Handed Inserter
Posts: 69
Joined: Wed May 30, 2018 11:01 am
Contact:

Re: [Oxyd] [0.16.51] Cease-fire unit groups attack on move order

Post by mk-fg »

Thank you both for such quick responses and support.

As I'll probably end up adding hacks like swapping entities depending on desired cease-fire state for now anyway, 0.17.0+ might be good place to get rid of them in the mod as well, along with other necessary updates.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5290
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [Oxyd] [0.16.51] Cease-fire unit groups attack on move order

Post by Klonan »

This should be solved now in 0.17
Post Reply

Return to “Resolved Problems and Bugs”