We were incorrectly comparing an object to a number.
I don't think this will drastically change the AI behaviour as it's
rather an edge case.
Reviewed By: Freagarach
Differential Revision: https://code.wildfiregames.com/D5030
This was SVN commit r27732.
Since 281bb0b2ec, opening the 'Options' menu in-game will show that
there are pending changes, even if the user has done nothing.
Unfortunately the cinematic logic to hide silhouettes, which comes from
cfd08bbf28, is broken following those changes. We use the configuration
to hide them, which results in us, indeed, changing the configuration.
There isn't really a good short term fix. This change only attemps to
reset the setting if we changed it for a cinematic, which fixes the
issue, but has drawbacks.
Ideally, we would use a superior config level, but we need to be careful
about exposing that to JS.
Reported by: langbart
Fixes#6821
Differential Revision: https://code.wildfiregames.com/D5040
This was SVN commit r27730.
The previous code was constructing un-necessary ScriptRequest objects.
Minor optimisation from not entering/leaving realms.
Differential Revision: https://code.wildfiregames.com/D5026
This was SVN commit r27728.
ScriptFunction::Call_ checks HasProperty, but then JS_CallFunctionName
calls GetProperty. This is redundant and can be simplified.
Reviewed By: phosit
Differential Revision: https://code.wildfiregames.com/D5000
This was SVN commit r27726.
Two changes to the vertex pathfinder that should generally improve
performance:
- Sort unaligned edges by distance like we did aligned edges. This
isn't very scientific, but the idea is generally sound, and empirically
it seems to do OK.
- Relax the optimality by using a weighted heuristic, with weight 4/3
or 5/3 depending on the number of obstacles around. In the worst cases,
A* will return paths that are this many times less optimal, but search
should be faster in general (and sometimes much faster).
Both of these optimisations might increase the constant-cost slightly,
but should decrease the worst-case runtimes.
Differential Revision: https://code.wildfiregames.com/D5034
This was SVN commit r27724.
Who says only players should be able to conduct diplomacy?
Also separation of concerns, more maintainable files.
Differential revision: https://code.wildfiregames.com/D4921
Comments by: @elexis, @Stan
Refs. #5894
This was SVN commit r27722.
- remove `SDL_Delay(100)`
- the progress is now an `std::atomic` (not protected by the mutex
anymore)
Based On Patch By: @vladislavbelov
Accepted By: @wraitii
Differential Revision: https://code.wildfiregames.com/D3676
This was SVN commit r27717.
- Add explicit variables for magic values.
- `let`s to `const`.
- Don't start the regen timer when not needed.
Differential revision: https://code.wildfiregames.com/D4965
Comments by: @Stan
This was SVN commit r27707.
Similar trick to D3446 / c87229aa48 - we can short-circuit if we find
units that match our best possible preference.
This is, in particular, almost a 40% wall time improvement on Combat
Demo Huge, but it should apply in a number of more normal cases.
Differential Revision: https://code.wildfiregames.com/D5020
This was SVN commit r27701.
SPECTRE attacks mitigations were added to SpiderMonkey's JIT output in
version 57. Turning these off is a very large speedup, around 10-20%
wall time (on my computer) depending on the map and the situation.
For the most part, from profiling on my machine, this is from memory
fences after JIT -> C++ calls. 0 A.D. does a lot of these.
The SPECTRE class of attack is a timing attack based on speculative
execution to leak sensitive information, and it seems extraordinarily
unlikely that something like this could be successfully mounted using 0
A.D.
Differential Revision: https://code.wildfiregames.com/D5014
This was SVN commit r27699.
Following the AI unthreading in 4df03ed2d2 / D3769, structured clones
are no longer needed to pass the gamestate around.
This is much faster, about 10-15% wall time on an AI 1v1 profile.
This also potentially reduces memory fragmentation and GC needs, as
writing clones allocated a lot of data.
Differential Revision: https://code.wildfiregames.com/D5019
This was SVN commit r27698.
This is unused and makes the function twice as slow as it needs to be.
Differential Revision: https://code.wildfiregames.com/D5015
This was SVN commit r27697.
This functions is amongst the most called in JS, so it's important to
make it speedy.
- Bugfix: if 'originalValue' is falsy, the result was never cached. This
in particular affected the minRange of archers, which is 0. It's a large
optimisation on combatDemoHuge, but the effect elsewhere is less likely
to be noticeable.
- Don't go through the helper to get the player Entity ID, in this case
it's slower.
- Concat is slower than Flat() in this case according to my profiling.
- Some micro-optimisation by strict equality.
Differential Revision: https://code.wildfiregames.com/D5012
This was SVN commit r27696.
FaceTowardsTarget is called quite often by UnitAI, and we can skip some
un-necessary messages as an optimisation.
Differential Revision: https://code.wildfiregames.com/D5005
This was SVN commit r27695.