Skip to content

Conversation

@Moonnooo
Copy link
Owner

@Moonnooo Moonnooo commented Jan 7, 2026

Currently, when sending a transport ship to a target territory, the game selects the spawn tile that is closest to the target in straight-line distance from the player's territory. This can result in transport ships taking longer water routes, causing troops to arrive later than necessary.

This PR refactors the transport ship spawning logic to select the source tile that allows the ship to reach the target in the shortest estimated travel time over water, using the pathfinder to estimate routes.

Key points:

Evaluates all eligible shore tiles controlled by the player.

Estimates the path length or travel time from each tile to the destination.

Chooses the tile that minimizes the expected arrival time of the transport ship.

This ensures transport ships are sent efficiently and troops arrive at the target faster, even if the chosen tile is not the geographically closest territory.

Checklist:

I have added screenshots for all UI updates (not applicable here)

I process any text displayed to the user through translateText() and I've added it to the en.json file (not applicable)

I have added relevant tests to the test directory (No but I have tested seems to work still working on it)

I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced

Discord contact: exudiz

Refactor transport ship spawning to select the source tile that results in the fastest route to the destination.

Uses pathfinder to estimate travel time from candidate tiles.

Falls back to bestTransportShipSpawn() if no valid candidates.

Improves transport ship deployment without changing gameplay rules.

Adds defensive checks to prevent crashes if no boat can be spawned.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants