Repository navigation
Civilization flags as the original's: unlit cloth, medallions, health bars, the minimap's banner (builds on #56) - #73
Closed
MortenLyhr wants to merge 8 commits into
Closed
MortenLyhr wants to merge 8 commits into
MortenLyhr wants to merge 8 commits into
Conversation
# Conflicts: # apps/oc4core/MapCapture.cpp # apps/oc4core/MapCapture.h
TFlagShader takes no light: the player's colours times the cloth's base map. Lit, the flags came out about a quarter darker and bluer than the original's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A ship's damage atlas moves along U by +0.5 to its lightly damaged left half (unchanged); a flag's medallions move along V by -0.2 a row, up their strip from its empty bottom row, which only works with V flipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Over each flag, a medallion for each unit on the plot (Art/Units/Flag/ Medallions.kfm, up to 7): white, green/yellow/red for selected units by how they can move. The promotion coin in the same model stays hidden. - Health bars as the original's billboards: HEALTH_BAR_WIDTH over the UNIT_HEALTH_BILLBOARD_SCALE fader long, behind the unit and above the ground (..._RADIUS, ..._Z), drawn in the scene so the figures hide part of it. - The flag by the minimap is the player's era flag model, waving, its cloth in the player's two colours, instead of a flat picture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Measured in the original with hurt units (Swordsmen at 100 % to 10 %, units from Strength 2 to 40): the bar's length is what the engine gets from the DLL, the unit's current strength times CvUnit::getHealthBarModifier (HEALTH_BAR_WIDTH over twice the best land unit's strength), so units without strength have none. Green from two thirds of the hit points, yellow from a third, red below; as thick at every length. It is a billboard: the _Z fader moves it up the screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MortenLyhr
added a commit
to MortenLyhr/openciv4
that referenced
this pull request
Nov 19, 2026
The model shader's flag branch (from bssth#56) was not yet in the generated shaders: tools/shaders/gen_msl.py and gen_spirv.py (glslang 16.6.0, SPIRV-Tools v2026.4, as CI's). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CvGame::getBestLandUnitCombat is not exported from the Windows DLL. The exported CvUnit::getHealthBarModifier already divides by it: a modifier that is not finite means there is no best land unit yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 20, 2026
Contributor
Author
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.
Builds on #56 (go140point6's animated civilization flags): this branch merges #56 and adds six commits on top. Please merge #56 first; this PR's own changes are the last six commits (the last two regenerate the Metal/SPIR-V shaders and fix the Windows link).
What it changes
#56 draws the era's flag model with the civilization's emblem, waving, at the original's size. Compared with the original (Beyond the Sword under Wine, the same scenario), four things still differed:
TFlagShader_2TPP(Shaders/FX/Civ4FlagDecal.fx), which takes no light:lerp(decal × PlayerColor01, PlayerColor02, decal.a) × base. Lit, the flags came out about a quarter darker and bluer. Flag cloth is now unlit (Renderer.cpp, CPU side only, no shader change).Art/Units/Flag/Medallions.nif/.kfm: one per unit on the plot (up to 7). Event code 10·n + state picks each medallion's row inMedallions.dds. As in the original, units not selected show white, and a selected unit shows green (not moved), yellow (moved, can go on) or red (cannot move). These replace Render animated civilization unit flags #56's stack-count number. The same NIF's winged promotion coin stays hidden.UvTransform::applynow flips V for method 1. U is unchanged: a ship's damage atlas still moves to the correct (lightly damaged) half, which I checked against the Privateer's KF and texture.CvUnit::getHealthBarModifier()(HEALTH_BAR_WIDTHover twice the best land unit's strength). So it shrinks as the unit is hurt, and units without strength (settlers, workers) have none. Measured with hurt units in the original: green at 75 % and above, yellow from 66 % to 40 %, red at 33 % and below. I used two thirds and one third as the edges (67–74 % and 34–39 % weren't tested). It is the same thickness at every length and shows for every unit, selected or not. It's placed byUNIT_HEALTH_BILLBOARD_RADIUS/_Z/_SCALEand drawn in the scene, so units in front can hide it. The option is the original'sGRAPHICOPTION_HEALTH_BARS(Options → Graphics → Show Health Bars, off by default), which OpenCiv4's profile already kept.addFlagWidgetGFCwas a flat 2D drawing with a white emblem. It now draws the player's era flag model, waving, in both player colours (ModelViewwith the composed decal), as the original does. The 2D drawing stays as the fallback.The OpenCiv4 pictures were taken with #62 (camera tilt) and #63 applied, so the framing matches the original; neither is part of this branch.
Not done:
FLAG_OFFSET2_*).How it was checked
ctestpasses: 14/14 (macOS, Release).--turns 100 --map Fractal --size STANDARD --seed 7gives the same checksum as master on every turn, ending atD7D43800.🤖 Generated with Claude Code