Repository navigation
Route marching armies around lakes; show thieves on the map - #94
Merged
Merged
Conversation
Dolumar_Map_LandRoute walks the straight line and, only where it crosses water, searches a way around that lake (grid A* in a box around the crossing), then smooths the result to straight legs. Open land stays the exact straight line; no way around falls back to the straight line. Results are cached in memcache without expiry (water never changes). Dolumar_Map_Distance uses it for every walking edge (to the destination and to portals), so travel time, the Battle window, market transfers and thieves all follow the land route. Routes are now stored as legs (a list of point lists, a portal jump between legs); the map still reads the old flat routes of armies already on the move. Ranking and profile distance lists keep the cheap straight line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WpWbf9LAeFevtaMRw9drZH
A thief sent to another village now stores where it left from and its route around lakes (villages_specialunits.vsu_from / vsu_route, new upgrade file). The map draws it with a dark pennant with a silver crescent. Thieves are secret: only the owner and their clan get them, not the target and not unrelated viewers. Thieves sent before this change have no vsu_from and are not drawn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WpWbf9LAeFevtaMRw9drZH
|
Preview: removed, this pull request is closed. |
From review: walk (b, a) could pick a different equal-cost detour than walk (a, b), so a regiment's or thief's trip home took a few seconds longer or shorter than the trip out. Search one canonical direction and reverse it. Also make sure the map seed is loaded before building the cache key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WpWbf9LAeFevtaMRw9drZH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Thijs · project thread
What
Armies, regiments, market transfers and thieves now walk around lakes instead of straight through them. Travel time uses the longer route, and the map flags and dashed lines follow the shore. Moving thieves now also show on the map, with their own flag.
How
Dolumar_Map_LandRoute(new): walks the straight line and only searches where that line is under water. The search is a grid A* inside a box around that one crossing, and the box grows if no way is found. The result is smoothed back to straight legs. Over open land the distance is still exactly the straight line. If there is no way around, it falls back to the straight line, so no village becomes unreachable. Results are cached in memcache with no expiry, because water never changes.Dolumar_Map_Distance: every walking edge, to the destination and to portals, gets its cost fromLandRoute. Routes are now stored as legs (a list of point lists, with a portal jump between legs). The new$overLandparameter (default true) is passed as false by Ranking and PlayerProfile, so their long distance lists stay a cheap straight-line estimate.ArmyFactory::routeSegments()reads both the new leg format and the old flat format, so armies already on the move keep their stored route.MovingRows::pointsOfRow()reads both formats too.SpecialUnits::moveUnit()now storesvsu_fromandvsu_route(new idempotent upgradedump/upgrades/20261105-thief-routes.sql, mirrored indump.sql).MovingRows::thieves()andArmyFactory::fromThiefRow()build athiefmap object with a new sprite (a dark pennant with a silver crescent). Thieves are secret: only the owner and their clan receive them. The target and strangers get nothing, not even a neutral sprite. Thieves sent before deploy have novsu_fromand are not drawn. The kind text is added in en/fr/de.Numbers (real map generator, default seed)
Testing
vendor/bin/phpunit --testsuite unit: 170 tests pass. New tests cover synthetic lakes (going around, two lakes, no way around, the cache), portal legs, the leg and flat route formats, thief rows, and keeping thieves secret. Two real-map routes are tested to stay on land, with a 2 s time guard.phpcs: no new findings.Balance note
This is a small rules change: about 1 route in 5 gets a little longer. Thijs approved it in the project thread.
Generated by Claude Code