Page MenuHomeWildfire Games

[WIP] Remove the "held position" logic from Defensive stance and move it to Patrol/Guard
Changes PlannedPublic

Authored by wraitii on Jun 7 2020, 10:01 PM.



As discussed today on IRC.

The 'defensive' stance is problematic because it combines attributes of a stance and an order.

it would be simpler to not have a notion of "held ground" depend on the defensive stance, but rather to rely on existing orders, such as Guard or Patrol, for this. This makes Defensive less weird as a stance, while still keeping all of the functionality.

Note that this is a bug fix. Currently, the held position is only reset when Order.Walk & friends are processed, which is usually on player order but sometimes self-given by the AI, making the behaviour unpredictable and broken. Units can end up far from the held position, which ends with them no longer correctly responding to entities in sight.

Introduces a custom cleanup for orders, which doesn't really exist right now, but we should probably move most of the "order-temporaries", such as the "hunting", "secondTry" and such variables here.

This is still WIP, it works but there are unaccounted for edge cases and i don't believe formations behave properly.

Test Plan

Try defensive before and after.

Event Timeline

wraitii created this revision.Jun 7 2020, 10:01 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build:

Freagarach added a subscriber: Freagarach.EditedJun 8 2020, 7:03 PM

I use Defensive stance quite often, and I think it should keep a notion of held position. Why have many units needing to patrol some bottleneck instead of just having them stand idle (reduced pathfinder strain) until the enemy comes? Maybe we should be able to guard a position?

wraitii added a comment.EditedJun 9 2020, 6:42 PM

Maybe we should be able to guard a position?

Patrol essentially is guarding a position. I agree that it would be convenient to let them not move, but the behaviour of both are very similar. Perhaps they should be merged.

wraitii planned changes to this revision.Jun 9 2020, 6:47 PM

Mh, I've been thinking about what happens when the unit is Idle. Right now, this lets units attack visible entities and they will follow them until the end of time. Which is probably not what was desired.

If I remove the distinction, defensive essentially becomes like Aggressive but the units gives up after a while when patrolling, which is also rather counter-intuitive.

I do think we should do something about this, as it would seem somewhat redundant with these orders and it does not play very well with regular work orders, but perhaps not this.