Commit Graph
17240 Commits
Author SHA1 Message Date
Fabio Pedretti f08832b60d Search the closest water point among boundary points only
Area.getClosestPointTo scans every point of the water search area, and
it was called up to count * retryFactor times in placeDocks.

The nearest point of a set to a point outside of it is always a
boundary point, so compute the boundary once and scan only that. The
logic lives in two small helpers, getBoundaryPoints (Uint8Array mask
based) and getClosestPointInList, so it can be reused and read apart
from placeDocks. getBoundaryPoints returns the original point objects,
while getClosestPointInList returns a clone of the point it finds, so
callers cannot mutate the points stored in the list.
2026-10-15 16:55:16 +02:00
Fabio Pedretti a8ba4945e9 Bail out early and guard against an empty start area
Create the water search area first and return before computing the land
search area if there is no water at all, so that work is not wasted.

Also return if the land search area is empty. Previously pickRandom
would have been called on an empty array and returned undefined, making
getClosestPointTo fail on an undefined position.

Cache the start points instead of calling getPoints() on every try.
2026-10-15 16:55:16 +02:00
Fabio Pedretti 79c0a48ce3 Remove unused areaLand and areaWater areas
areaLand and areaWater were created with a MapBoundsPlacer, which
evaluates the tileclass constraint on every tile of the map. However,
createArea only has an effect if either a painter is specified or the
returned Area is used. Here no painter was passed and the returned
values were never read, so these calls did nothing except waste time.
2026-10-15 16:55:16 +02:00
Fabio Pedretti 36eb25de3a Return early on an exact match in getClosestPointTo()
If a point at squared distance 0 is found, no closer point can exist, so
return it immediately instead of scanning the rest of the points. The
returned point is the same as before, since the first point with the
smallest distance was already the one kept.
2026-10-12 16:24:13 +02:00
Fabio Pedretti dda1e6c1a3 Use an indexed loop in getClosestPointTo()
Iterate with an indexed loop over a local reference to the points array
instead of for...of over this.points, which avoids iterator and property
lookup overhead in a loop that can run over thousands of points.
2026-10-12 16:24:13 +02:00
Fabio Pedretti 25592e9f5d Avoid Vector2D allocations in the inner loops
Every neighbor sample created a new Vector2D and went through
validHeight() and getHeight(). Use plain integer coordinates, an inline
bounds check and direct access to the height array instead, which also
removes the per-vertex allocation and the setHeight() call.
2026-10-10 16:42:53 +02:00
Fabio Pedretti 2ebb6d5a12 Precompute the neighbor offsets and distances
The distance of each brush point and the check for the center vertex
were recomputed for every vertex. Compute them once per paint() call
into typed arrays instead.
2026-10-10 16:42:53 +02:00
Fabio Pedretti d6d83c00e8 Use a single flat array for the visited vertices
Replace the array of Uint8Arrays, which was rebuilt with fill().map()
on every iteration, by one flat Uint8Array that is allocated once and
cleared at the start of each iteration.
2026-10-10 16:42:53 +02:00
Fabio Pedretti c8cf658d46 Remove unused heightmap clone
The clone of g_Map.height was only used to read its length, while all
neighbor heights are read from g_Map itself. Cloning the whole heightmap
on every iteration was therefore pure overhead.
2026-10-10 16:42:53 +02:00
phosit 581503fb82 Fix generating Mediterranean
Removing this `printDuration` was forgotten in a80446eb59.
2026-10-07 16:53:06 +02:00
phosit b2496aa9ca Improve translated strings
Remove too much white space; fix "a" vs "an" mistakes...
2026-10-05 17:45:32 +02:00
phosit abf9d5ce00 Fix typos and word doubling in translation strings
Fix strings affecting translations: actually translated strings and
translation context.
2026-10-03 09:39:07 +02:00
Fabio Pedretti 5877ed59bf rms: remove misleading "Placing docks" log calls inside maps
The same "Placing docks" log call is already used inside placeDocks
function, which is called just after these log calls.
Remove as it is useless and confusing.
2026-10-02 21:55:04 +02:00
Dunedan fe8f7e4de0 Consolidate ToS and ToU into a single document
Since they got introduced, there were separate documents for the Terms
of Service and Terms of Use for the multiplayer lobby. However, these
documents were rather short and it wasn't immediately clear, what the
difference between them is.

To simplify the process of reading and acknowledging the terms of the
multiplayer lobby, this consolidates the former Terms of Service and
Terms of Use in a single document. This results in players having to
read two documents (Terms of Service and Privacy Policy) instead of
three when registering for the multiplayer lobby. This makes the
registration process smoother and will in the best case result in more
players actively reading the documents.
2026-10-02 19:25:11 +02:00
phosit 5715f5b63d Open the page returned from the join dialog
Fixes: #9243
2026-09-30 10:42:37 +02:00
eZamus 767a676685 Rename teamslocked to teamlocked in Petra AI
Refs: #9180
2026-09-29 09:50:58 +02:00
Vantha 159d3390b2 Fix CinemaOverlay hiding too late
This patch fixes the issue that the CinemaOverlay was hiding one turn
after the cinema paths stopped playing.
That was happening because `CinemaOverlay.OnSimulationUpdate` was called
before `OnSimulationUpdate` in session.js, so it read last turn's sim
state. Making it a simulation update handler ensures the sim state is
up-to-date once it's called.
2026-09-28 15:19:33 +02:00
Vantha a55ffa8ba8 Complete the cinema path timescale implementation
This patch fixes the previously broken implementation of the timescale
property of cinema paths, now cinema paths with timescale 0.5, for
example, play twice as fast.
Unlike the comment stated, negative timescales weren't actually
supported, which is now enforced.
For demonstration, the timescale of the demo map's path is changed to
0.85.
2026-09-28 15:19:33 +02:00
Aaron Muir Hamilton e2eb02fa59 Refresh the replay list after deleting replays.
Before this, starting a replay after a deletion loaded and ran the
replay in the background without dismissing the replay list, and
starting another one crashed on an assertion.

Fixes #9246
2026-09-27 19:37:01 +02:00
eZamux 08194a1d56 Show packing/unpacking time in tooltip
Fixes #8929
2026-09-25 14:49:46 +02:00
trompetin17 0ed48b3a1f Add viewer entity template and update entity naming in ActorViewer
After #7164, entities in the ActorViewer are loaded through the
preview filter, which disables shadows by design. As a result, the
shadow toggle no longer has any visible effect.

Adds a dedicated viewer.xml template so the ActorViewer no longer
inherits the preview filter's shadow behaviour, keeping preview.xml
untouched for the entities that legitimately need shadows off.

Refs #7164
Reported by: Vladislav
2026-09-24 09:10:47 -05:00
Dunedan ab7d3b8c00 Non-breakable space between icons and values
Make the space between resource icons and values in tooltips
non-breakable, to avoid them getting split across two lines of text.

Fixes #9164
2026-09-24 12:24:38 +02:00
Atrik 0adb53e30b Add notifications when a player capture a relic
Fixes #8683
2026-09-24 12:20:01 +02:00
Linkid ddbdee53be Use homogeneous name for maps
To follow other maps name syntax (`<name> (<number of players>)`), "players" is
removed from the name on the following maps to keep only the number:
- Cycladic Archipelago (2p, 3p)
- Libyan Oasis
- North African Savanna.
2026-09-20 11:22:16 +02:00
Atrik fa7a75b951 Add a test for auras in preview 2026-09-16 10:39:26 +02:00
Atrik 810d92bf8b Fix auras taking effect in building previews
Auras.CanApply called Visibility's GetPreview(), which doesn't exist,
so auras were applying in preview. Introduced in eb2ff98883.

Add GetPreview() to Visibility.

Fixes #9225
2026-09-16 10:39:26 +02:00
Atrik 0322d039f6 Fix player data not updating on diplomacy change
f39e71cca0 moved the player data refresh after a diplomacy change
into a diplomacy colors change handler, which only runs when
diplomacy colors are enabled. With them disabled, the diplomacy
dialog's stance buttons didn't reflect the new stances.

Refresh the player data directly in the diplomacy notification
handler, before the diplomacy colors are recomputed, and remove
the now redundant diplomacy colors handler registration.
2026-09-14 11:35:19 +02:00
Linkid fe144f1dc6 Use homogeneous name for Watering Holes
To follow other maps name syntax (`<name> (<number of players>)`), "players" is
removed from the name on the Watering Holes map to keep only the number.
2026-09-13 21:58:34 +02:00
Atrik 950d86336e Fix sortEntitiesAlongLine mutating its lineEnd 2026-09-13 12:15:38 +02:00
Atrik 191549e51c Fix crossed unit-to-target pairing
sortEntitiesForEngagement projects both attackers and targets from
the same origin (avgAttackers) onto the same vector,
so reversing the target array was incorrect.
2026-09-13 12:15:38 +02:00
obelix c3ace13b54 Rename delian_league.json to athen_delian_league.json
Fixes #9217
2026-09-11 23:09:33 +02:00
obelix e407363e13 Fix a reference in the in-game Manual
Reported by forum user Thalatta.

Fixes #9208
2026-09-11 10:23:05 +02:00
Vantha 1cc3020049 Call buildFirstBase correctly
`this.buildFirstBase` doesn't exist so this caused errors since 8b1e78ae1e
2026-09-10 11:27:27 +02:00
eZamus e5e22c1deb Spectate Mode: Display Gaia's emblem
Fixes #7592
2026-09-02 10:41:56 +02:00
ShadowOfHassen aa86258751 Added ruins 2026-08-27 11:07:53 +02:00
ShadowOfHassen 14f9c9aaff Add treasure history entries 2026-08-27 11:07:53 +02:00
ShadowOfHassen a6b1318164 Add generic text attribute to credit json parser 2026-08-27 11:07:53 +02:00
Lancelot de Ferrière 2cc0cf457a Fix the callers of GetEffectiveAttackRange's out-of-reach range
Follows db23584fc3 - the caller of GetEffectiveAttackRange's didn't
really use the NEVER_IN_RANGE result properly.
The C++ engine does not handle Infinity (treated as 0).
This also changes MoveToTargetAttackRange to explicitly try to get
closer if the parabolic range is not in range, but it seems like a flat
range could - on the assumption that once we get closer, the terrain
height difference is lower.
2026-08-26 10:55:27 +02:00
Lancelot de Ferrière ce119cd461 Fix towers firing at targets they cannot reach
Since 38b33b0484, the range check happened in CanAttack, however the
check there is too permissive.
This meant it was possible for towers to attack certain targets outside
their actual range, depending on the query results and unit AI focus
fire.
2026-08-26 10:55:27 +02:00
Lancelot de Ferrière d60e36c74a Remove unused BuildingAI.CheckTargetVisible
FireArrows now checks range/visibility via CanAttack directly (see next
commit), leaving this method unused.
2026-08-26 10:55:27 +02:00
Lancelot de Ferrière 63b0f05b43 UnitAI: keep chasing on forced orders.
Following 38b33b0484, units on aggressive stance no longer chase beyond
their own vision, including on player-forced orders. This fixes that
regression.
(Note that approaching and chasing are a bit inconsistent).
2026-08-26 10:55:27 +02:00
Lancelot de Ferrière cb6f46db71 UnitAI: Simplify GetQueryRange and fix issues
38b33b0484 partly rewrote GetQueryRange but ended up with two
bugs/regressions:
- in standGround, melee units used an effective max-range of 0 instead
  of their melee attack max range
- units that have a min-range did not see units within their min-range
  (even though they can move).

This fixes these issues and rewrite the function in a simpler fashion
for readability.
2026-08-26 10:55:27 +02:00
obelix e4b72711e6 Add proper SpecificNames to germ heroes
Proposed by @Vantha, elaborated by @Genava55:
https://wildfiregames.com/forum/topic/140675-more-ai-names-for-the-germans/?do=findComment&comment=618302

Refs: #8755
2026-08-23 02:22:15 +02:00
obelix 95ca5cebb6 Fix grammar for GenericName of germ Catafalque
Reported by @Vantha

Refs: #8755
2026-08-23 02:22:15 +02:00
joeybadz 74e1f088a0 Reduce serialization footprint in ResourceGatherer
Avoids serializing fields that can be derived at deserialization time to save serialization space

Fixes: #7263
2026-08-22 18:18:38 +02:00
phosit 7892a4f40f Fix "I will return" button
When temporarly leaving a multiplayer game the "I will return" button
didn't work. This was because there was no valid `closeSession`.
Since it requires accessing `this` the function can't be an arrow
function anymore.

Introduced in 2520c45220

Fixes: #9086
2026-08-20 21:35:18 +02:00
joeybadz 478acbdf5c Reconcile Teutobod's speed bonus and tooltip values
Updates the tooltip to match the actual speed bonus

Fixes #8864
2026-08-19 19:49:42 -04:00
Lancelot de Ferrière 4e04ccca4d UnitAI: properly follow queued return resources orders
GATHER.FINDINGNEWTARGET inserts a ReturnResource order ahead of the
next queued order when the unit is still carrying resources, but
skips doing so if the next order already returns those resources.
Unfortunately, the check was incorrectly written, missing a `.type`.
This meant we always added a fresh order.

Units could then sometimes return resources to the closest dropsites,
then move to the actually queued dropsite, which could lead to
unexpected pathing.

Introduced in 0dda3b579c where the feature was added.
2026-08-19 11:15:27 +02:00
joeybadz 2add365a4f Add camera view config options
Adds a variety of settings for the camera: scroll speed, zoom speed, smoothness, etc.

Fixes #4638
2026-08-19 04:19:45 +02:00
Lancelot de Ferrière 8acec374be Fix a ModifiersManager bug when changing player entities
The cache invalidation was incorrectly using forEach, which failed to invalidate the cache.
This never actually caused a bug because the game currently does not silently swap active player entities.
2026-08-16 17:37:51 +02:00