Repository navigation
Great Wall: laid and drawn as the original does - #78
Open
MortenLyhr wants to merge 2 commits into
Open
MortenLyhr wants to merge 2 commits into
MortenLyhr wants to merge 2 commits into
Conversation
The original engine lays the wall once, when the game core asks for it (AddGreatWall), along the borders as they are then, and keeps it: later border changes, another AddGreatWall while it stands, and a save and load leave it as it was (its saves hold the wall's points). Observed in the original game and read from its saves: - Plots: the builder's territory joined to the city plot (plots side by side, the owner's sea plots too), not the owner's other territories. So a city whose land does not touch the builder's gets no wall; the border towards barbarians is walled. - Line: from the city south to the territory's last plot, its south edge heading west, then round with the territory on the right, turning right first. An edge is walled when both its plots are land of the city's landmass (getAreaIdForGreatWall); at the coast the loop opens into pieces. - Points: 15 per plot edge, smoothed by a moving average of 15 then of 5 (pieces repeat their ends): corners rounded, the line on the border. - Pieces: a segment per step at 12/37 scale (it was 1: three times too big), a tower every 11th point and at a piece's end; heights smoothed along the line and segments tilted along it. OpenCiv4 keeps the wall with its saves (a block after the MD5); a save without one (the original's) gets the wall laid along its borders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 20, 2026
The save kept the wall as laid in a 'GWAL' block after the MD5 string, which the original's format doesn't have (the original keeps its wall in its own section of the save). Saves no longer write or read it; after a load the wall is laid again for the city with the wonder, along the borders as they are then, as for the original's saves. Saves that have the block still load (the reader stops at the MD5). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The Great Wall on the map now follows the original engine's rules and look (backlog: the original doesn't wall the border towards the barbarian city in the test map; the wall looked much heavier than the original's).
How the rules were found. Scripted cases in the original game (Wine): the wonder built in different cities, borders grown afterwards, roads, territories joined by owned plots, rivers along the border into the sea, save and load. The original also keeps the wall it laid in its saves (its points and the plot corners they come from), which gave the exact geometry. All of it is observation of the running game and its save files.
Rules
AddGreatWall, along the borders as they are then (at its next update: a World Builder scenario sets the buildings before the borders follow). Later border changes, anotherAddGreatWallwhile a wall stands, and a save + load leave it as it was. (RemoveGreatWallis never reached in practice:CvCitycounts the other border-obstacle buildings.)getAreaIdForGreatWall), so at the coast the loop opens into pieces.Look
ART_GREAT_WALL_SEGMENTper step at 12/37 scale (it was drawn at scale 1: three times too big, five per plot edge, a post at every corner), a tower every 11th point and at a piece's end; heights smoothed along the line, segments tilted along the slope.Saves. OpenCiv4 doesn't keep the wall in its saves. The original keeps its wall in its own section of the save, whose layout isn't fully known, so a block of OpenCiv4's own after the MD5 would make a format the original doesn't have. After a load, the wall is laid again for the city with the Great Wall, along the borders as they are then. The original's saves are handled the same way. So unlike the original, a load can move the wall onto borders that grew after it was first laid. Saves made with this PR's earlier version, which had a
GWALblock after the MD5, still load: the block is ignored. (Changed 2026-11-23, after the review of #154.)Pictures: Wine (original) | OpenCiv4, the OpenCiv4 side with #62's camera.
OpenCiv4 alone, wall built, border grown, saved and loaded:
(These pictures are from the earlier version with the
GWALblock. With this version a load lays the wall again along the borders as they are then; see Saves above.)Before (master), for contrast: the old wall, heavy, with posts at every corner.
Checks: ctest 13/13;
--turns 100 --map Fractal --size STANDARD --seed 7checksums equal master on all 100 turns. No shader changes. After dropping the block: ctest 13/13 andD7D43800at turn 100; a save with the old block loads and the wall is drawn after the load; the wall is also drawn with #154 merged (ctest 16/16). Host code calls onlyDllExportgame-core functions.🤖 Generated with Claude Code