725aa8a686 introduced a DamageTypes.js global script similar to the
resources one. However, we never actually need to refer to this script
since we can always use the damage types provided by the
template/context/object we are looping over/...
There is one exception to this for AI weighting of damage types.
However, since damage types are not stored in files, this is strictly
equivalent to hardcoding them in the global script and was deemed
acceptable.
Patch By: freagarach
Reviewed By: wraitii
Refs #4801 (by invalidating it for now, though such helper files might
be useful in the future if damage types require more metadata).
Differential Revision: https://code.wildfiregames.com/D1938
This was SVN commit r22527.
As reported by #5521, Ordering units to walk to a point in a forest can
lag terribly, as units will end up computing long short paths in the
forest, which can result in `ComputeShortPath` calls that individually
take upwards of 80ms.
This can be alleviated by allowing units to stop a bit earlier. A23
handled this in UnitMotion directly, but it's better to handle this in
UnitAI to avoid surprises and to make it customisable on a per-state
level.
This diff further speeds up using the short pathfinder by starting with
a smaller search range, limiting the max-range more and moving the range
slightly towards the goal.
This also refactors UM sending messages to UnitAI so that we may in the
future push more information (in particular, the entity_id that a unit
was obstructed by could be interesting for COMBAT).
This doesn't fix the possibility of lag, but it reduces its occurrence
to levels that should be similar to A23 and thus acceptable enough.
Tested By: Freagarach
Fixes#5521
Differential Revision: https://code.wildfiregames.com/D2105
This was SVN commit r22526.
Removes a few non-behavioral workarounds for older versions.
Refs #5502, #2891.
Accepted By: asterix
Comments by: vladislavbelov
Differential Revision: https://code.wildfiregames.com/D2076
This was SVN commit r22508.
Units right now try going to their next long waypoint using the
short-range pathfinder. This works, but it tends to leads to units
clumping together when shuttling for example.
By switching to short paths earlier, and by scrapping the long waypoints
when doing so, we can make movement more natural until we have unit
pushing.
Some cleanup in how the short-path domain range gets handled, and
increase the max-range by one tile to improve rare cases.
Differential Revision: https://code.wildfiregames.com/D2095
This was SVN commit r22507.
This restores A23 formation behaviour, changed by 4ca448a686. Units will
now start attacking nearby enemies when the formation goes idle (such as
when the abort order button is clicked).
This introduces a change that formation units that actually go idle will
try to move back in formation shape, so it looks more like they're still
in formation.
Fixes#5519.
Differential Revision: https://code.wildfiregames.com/D2097
This was SVN commit r22506.
Calls to FaceTowardsTarget were missed in the REPAIRING, GATHERING and
GUARDING unitAI state, leading occasionally to units pointing the wrong
way. This was not an issue prior to 0c20afdfda, which called
MoveToTargetRange, which itself called FaceTowardsTarget when it was
already in range, but it now needs to be explicitly handled in unitAI.
Attacking and Healing already handled this correctly.
Fixes#5518
Differential Revision: https://code.wildfiregames.com/D2096
This was SVN commit r22505.
Port the script to Python 3, fix some bigs in it, and remove whitespace
from the output.
Reviewed By: bb
Differential Revision: https://code.wildfiregames.com/D1810
This was SVN commit r22499.
While at it clean some obstruction and footprint sizes in stables and
workshops
Add a specific name for some workshops
Patch By: Nescio
Differential Revision: https://code.wildfiregames.com/D2049
refs: #4849
This was SVN commit r22497.
Entities may never get to a distance of "0" when trying to reach other
entities, as that would mean they are right next to each other, or even
overlapping, which can fail.
Always give some leeway to distance when trying to move to a target with
no specified max-range.
This fixes WalkToTarget orders which resulted in units being stuck on
mines or on dropsites occasionally.
Reported by: elexis
Fixes#5510
Differential Revision: https://code.wildfiregames.com/D2087
This was SVN commit r22496.
As reported by @bb in #5512, catapults and other big-range units might
not approach targets correctly when trying to get in range.
To be sure that we will be in range of a square obstruction approximated
as a circle, we need to consider the inscribed circle and not the
circumscribed circle.
Reported by: bb
Fixes#5512
Differential Revision: https://code.wildfiregames.com/D2086
This was SVN commit r22495.
For consistency, long argument lists have been broken into multiple
lines after the first argument, with suitable indentation.
This was SVN commit r22492.
5c642611c4 introduces undefined behaviour: for vertices that are part of
non-AA squares, the value of "quadOutward" is undefined. This fixes that
by again setting it to QUADRANT_ALL by default, as it was pre
5c642611c4. This led to OOS.
Reviewed By: elexis
Fixes#5508
Differential Revision: https://code.wildfiregames.com/D2082
This was SVN commit r22483.
945d1ba2e6 broke formation regression tests because there now needs to
be a timer call after the units become idle for behaviour to trigger.
Differential Revision: https://code.wildfiregames.com/D2077
This was SVN commit r22477.
Add two missing error reports.
Move sanity check prior to the first variable use.
Differential Revision: https://code.wildfiregames.com/D1817
Patch By: Angen
This was SVN commit r22476.
The game currently has several infinite loops, and the stack trace is
always a variation on the same pattern that units go through IDLE as a
default state, immediately try another order (possibly entering a new
state), failing, and goes back to IDLE.
IDLE.Timer is a general workaround for this issue. It wastes a turn
every time a unit goes idle, so should a better solution be found for
the general problem of infinite loops in UnitAI, it should be removed.
This revert 8bab09d37c which was intended as a safety net, but couldn't
protect againt infinite loops between two different states.
Fixes#5460
Differential Revision: https://code.wildfiregames.com/D2041
This was SVN commit r22475.
Three changes:
- Assume a certain incertain based on distance to the target, to avoid
recompute paths every turn when the target is far way and moving.
- Handle cases where the target is unreachable to the long-range
pathfinder and we would be recomputing every turn.
- If we went straight, assume we don't need to recompute a path.
These together make moving entities recompute paths far less often,
speeding up the game.
Differential Revision: https://code.wildfiregames.com/D2066
This was SVN commit r22474.
Compute the outward quadrants once and for all instead of setting them
dynamically, because there is no reason why we should always arrive from
the same quadrant as the first time we see a vertex.
Don't consider quadrants for the start-vertex, because of the edge
expansion (which can put us in illegal quadrants)
These result in (much) better paths, the tradeoff being that we now look
at some more vertices.
Fixes#5476
Differential Revision: https://code.wildfiregames.com/D1908
This was SVN commit r22473.
Units move the InitPos of the heard to the last known position when
going through Order.Gather, which they do multiple times when hunting,
thus making them mistakenly move the herd position and unable to find it
back.
Differential Revision: https://code.wildfiregames.com/D2073
This was SVN commit r22471.
Since m_ExpectedPathTicket.m_Type is uninitialised before being used,
serialisation could fail with an out of bouds error. This fixes it by
giving it an (arbitrary) default value.
Reported by: gameboy
Confirmed and debugged by: Angen
Reviewed By: Angen
Differential Revision: https://code.wildfiregames.com/D2074
This was SVN commit r22470.
Contrary to wxWidgets documentation, wxMenuEvent::GetMenu() can return
NULL when the system menu is accessed on wxMSW, see
https://trac.wxwidgets.org/ticket/18443.
This was SVN commit r22467.
This adds back the "domain" edges to the short/vertex pathfinder.
Without these edges, units could use points far away from the path
search that they inaccurately thought were reachable, leading to some
pathing oddities in rare cases.
Reviewed By: temple
Differential Revision: https://code.wildfiregames.com/D443
This was SVN commit r22465.
Reorder code flow, handle long paths and short paths in a more explicit
manner, and only fail after a certain number of failed path computations
to avoid going idle too easily.
Make sure WALKING orders in UnitAI stop when the move fails to avoid
units being stuck.
Differential Revision: https://code.wildfiregames.com/D1907
This was SVN commit r22464.