Repository navigation
Bundle 1/6: camera and map view - #145
Merged
Merged
Conversation
Measured in BtS 3.19 (Wine) with CyCamera at 19 zoom levels and the plot grid at two window sizes: - Tilt: about CAMERA_LOWER_PITCH + 1.8 (29.8 degrees) up to 1.3 x CAMERA_MIN_DISTANCE, then quadratic with the distance to straight down at 0.86 x CAMERA_SMALLEST_MAX_DISTANCE (within 0.15 degrees). At the start distance that is 33.6 degrees, where the straight line gave 42.8. - FIELD_OF_VIEW is across the screen's diagonal: plots 206 px apart at 1600x900 and 170 at 1200x900 at the same camera; it was taken as the horizontal angle (168 px). - What the camera looks at is drawn 56.9% of the way up the window (CyCamera().GetDefaultViewPortCenter() = (0.5, 0.569)), not in the middle. Camera::projection shifts the perspective so the renderer and picking agree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The city bar is drawn from the game's CityBar.nif layout and textures: the banner (CityBar_Base) with the growth and production bars in its halves, the capital's star or the circle in the population's colour, the production symbol (what the city builds, else the cancel button, cut round by ProductionIconMask under ProductionIconBevel) for the active team's cities, the name and what it builds in the banner's halves, and buildCityBillboardIconString's icons above it. It is placed and sized as the original's CITYBILLBOARD faders (CIV4DetailManager) place it, measured in the original at camera distances of 12 to 102 plots: out from the city towards the bottom of the screen and raised, its size levelling off at 0.67. It is no longer hidden beyond 45 plots, and a click on it is a click on its city (the city screen opens), over any unit figure under it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…LLBOARD_RADIUS The size came from a fit to zooms from the start view out, which grew without end closer in. It is now the star's width as measured in the original at 5 to 102 plots (1.39 points a model unit up close to 0.69 far out). The bar's top sits on the ground south of the city by CITYBILLBOARD_RADIUS (90 units up close, no closer than 70), as the original's plot grid shows, not twice that and raised. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…onIcon The host may call only the game core's exports on Windows: the order queue and GC's info getters are not, so the Windows build did not link. getCityBillboardProductionIcon is the engine's own call for the symbol: the player's button for a unit, and INTERFACE_BUTTONS_NOPRODUCTION when nothing is built (as the original shows), not the cancel button. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the resource layer on, each resource is shown as the original's plot picker draws it: the resource's button cut to a circle in a black disc with a light bevelled rim, on a pale pin whose tip is the plot. The bubble keeps its size at every zoom and stands up and away from the middle of the screen (left of its plot on the left half, right of it on the right half), so it moves to the other side as the view passes over it. Farther bubbles are drawn first, and the layer shows at every camera height, as in the original; the yield and unit icon layers keep their distance limit. Measured against Beyond the Sword under Wine at 1600x900: disc 51 px, pin tip 29 px across and 31 px down from the disc's centre. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The original turns its camera a little east of south, more the closer it is: 4.17 degrees x s^2, s the share of the way from 0.86 x CAMERA_SMALLEST_MAX_DISTANCE in to 1.3 x CAMERA_MIN_DISTANCE (2.3 degrees at the start distance), measured with CyCamera().GetCurrentPosition at 13 zooms and a fit of the camera to the plot grid in its picture (turned towards the target, not moved aside). Ctrl+Left/Right (CONTROL_ISOMETRIC_CAMERA_LEFT/RIGHT -> MoveBaseTurnLeft/Right) turn the view 45 degrees each way, no further than CAMERA_MIN/MAX_YAW, on top of the zoom's turn; Alt+F (CONTROL_TOP_DOWN_CAMERA -> SetSatelliteMode) looks straight down, north up, with the original's message. The camera glides there as the original's (the rest left shrinks by e^-5.2 a second). CyCamera's Get/SetBaseTurn, MoveBaseTurnLeft/Right and Get/SetBasePitch (tilts the view up) work. Ctrl+arrows no longer pan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eft turns the camera) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The original draws the resource bubbles in the plots' order, south to north and west to east, so where bubbles crowd (seen from far away) the farther and the more easterly one covers its neighbour, its pin included. It doesn't push them aside: they overlap at every zoom. bssth#69's first commit drew nearer bubbles over farther ones; now the order is the original's. Checked against Beyond the Sword under Wine at seven zooms (0.25 to 0.85) on a row, a column, a 3x3 block, a 2x2 and pairs of wheat. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Whenever a plot's improvement, road or resource changed (a worker's farm done, an AI worker's road, a mine becoming worked), the map was rebuilt in a way that held the window for most of a second (850 ms on a small map): the trees were cut again for every river, each tree point tested against every triangle of the river pieces, and the culture borders were drawn again because the river mask was always marked changed. During the other civilizations' turns that happened after almost every tenth of a second of their play, so zoom, scroll, the minimap and clicks did not answer until their turns were over. Each river piece now has a grid of its placed triangles, and a point is tested only against those in its cell, in the same order: the same answer (checked on every test on a play-test save and the test map), 13 ms instead of 760. The river mask is marked changed only when it changed. A rebuild now takes about 35 ms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The next unit, a city chosen and a left click on the map moved the camera there at once. The original glides: the rest of the way shrinks by about e^-6 a second (no easing in, most of it in the first half second), and from farther than CAMERA_MAX_TRAVEL_DISTANCE (3000, 16.7 plots) it jumps. Measured in Wine (a film of the window at 120 fps): 1-14 plots glide, 17 and more jump; a click on the map, on a unit or on bare ground, glides to that plot; a click on the minimap jumps (unchanged here). A drag, the keys or the minimap meanwhile leave the camera where it is; a scripted --look keeps its view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
windows-x64 failed with C2513 on 'const float far': windef.h defines far (and near) as nothing. Renamed to jumpDistance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
While a city's screen is up the original shows no units on the map (own, foreign or barbarian), so no flags and health bars either, no city bars (the selected city's and the others'), and no resources' bubbles even with the resource layer on. The cities, signs, worked plots and yields stay. Checked in Wine with a test city that had all of these in its radius. MapView::Options::cityScreen (set from MapWindow's city view each frame) skips the units' figures, promotion glows, selection rings, flags and health bars, and the overlay of flags and city bars; MapWindow::drawLayers skips the resources' bubbles and the units' icons in the city view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The map view draws what the camera looks at 0.569 up the window (the original's default viewport centre). The original's city screen draws its city lower, 0.534 up (measured in Wine: 419 px from the top at 1600x900, 467 at 1280x1000; the camera straight above the city at CAMERA_CITY_ZOOM_IN_DISTANCE). At 0.569 the fat cross's top row went under the city screen's top panel. The view centre now glides along with the camera into the city screen and out again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 21, 2026
This was referenced Nov 21, 2026
A resource's bubble stands left of its plot on the left half of the screen and right of it on the right half. A plot at the very middle of the screen (the camera centred on it, as when it glides into or out of a city's screen on that city) is within a thousandth of a pixel of the middle in every frame, on either side by rounding: its bubble jumped from side to side with each frame of the glide (84 times in one test run: Roma with stone, its screen opened and closed). Each plot's bubble now keeps the side it stands on from frame to frame and goes over only when its plot is clearly past the middle: 2% of the screen's width (32 px at 1600). Elsewhere the bubbles stand as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two lines and where and how long they show were checked in the original under Wine (2026-11-22): Alt+F pressed on and off, filmed; the line is an event message at the top for about 10 s (EVENT_MESSAGE_TIME). No TXT_KEY in the game's text has it. The code was right; its comment named the wrong source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Also please move the history out of the comments at |
Contributor
Author
|
Thanks, fixed in #166: 🤖 Generated with Claude Code |
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.
This PR replaces 8 open PRs, merged here one by one with their own commits (each description stays on its PR, which links here once closed); the conflicts between them are resolved as on the branch we play daily. Merging it closes nothing automatically: each replaced PR will be closed with a link here.
Commits of this bundle's own (on top of the merges):
View{…, kCityCentre}with Camera: the original's slight turn, Ctrl+Left/Right and Alt+F #83's newturnfield before the centre).Checks: macOS build (Release), ctest 13/13 passed; sync checksums
--turns 100 --map Fractal --size STANDARD --seed 7at turn 100 equal master's (D7D43800). Windows: this PR's CI.A resource bubble keeps its side near the screen's middle (2026-11-22,
02f6067f)A bubble stands left of its plot on the screen's left half and right of it on the right half. A plot at the very middle (the camera centred on it, as when the camera glides out of a city's screen) sat within a thousandth of a pixel of the middle, and its bubble jumped sides with every frame's rounding (84 times in one test run). Now each bubble keeps its side until its plot is 2% of the screen's width past the middle. Bundles 2–4 re-merged on top (fast-forward); ctest 13/13, checksum
D7D43800.Alt+F's message: source re-checked in the running game (2026-11-22,
2546ca2c)#83 had taken Alt+F's two message lines from
stringson the original's exe, against CONTRIBUTING. They were checked in the running game under Wine instead (pressed and filmed; see #83's added section): the same two lines, as an event message for about 10 s, and noTXT_KEYholds them. No code change; the comment names the new source. Bundles 2–6 restacked on top by merges. ctest 13/13 on #145 (14/19/21/22 on the bundles above), sync checksum at turn 100D7D43800on all six, as before.🤖 Generated with Claude Code