Skip to content

Scenify the credits screen - #1027

Merged
ajhalme merged 4 commits into
C7-Game:Developmentfrom
ozymand1as:scenify-credits-screen
Nov 14, 2026
Merged

ajhalme merged 4 commits into
C7-Game:Developmentfrom
ozymand1as:scenify-credits-screen

Conversation

@ozymand1as

Copy link
Copy Markdown
Contributor

Closes #1020

What changed

The credits screen was an empty Node2D — ShowCredits() built the background,
label, fonts and exit button in code. The layout now lives in
C7/UIElements/Credits/Credits.tscn:

   Credits (Node2D)                                                                                                                                                                       
   ├── Background (TextureRect)                                                                                                                                                           
   ├── CreditsScroll (ScrollContainer, 80,120 → 944,648)                                                                                                                                  
   │   └── CreditsColumn (VBoxContainer)                                                                                                                                                  
   │       └── CreditsLabel (RichTextLabel, bbcode + fit_content)                                                                                                                         
   └── ExitButton (TextureButton, 952,720)                                                                                                                                                

Positions and sizes are unchanged from the previous code, so this should be a
pure layout refactor visually.

Code now only handles what cannot live in the scene:

  • TextureLoader.Load(...) for the background and exit textures, which come
    from the game mode / Lua so the editor cannot resolve them.
  • The credits text.
  • The exit button's Pressed signal.
  • The slow auto-scroll (the bonus from the issue).

The label sits in a VBoxContainer inside a ScrollContainer, so the column
scrolls as one continuous block and further credit sources can be added as
sibling nodes. fit_content is on so the label grows to its content, and its
own scrolling is off so the outer ScrollContainer owns the scroll — the label
also needs horizontal_scroll_mode disabled on the container so the text wraps
to the column width instead of scrolling sideways.

Auto-scroll advances ~24 px/s, accumulating fractional pixels (at 60fps one
frame is 0.4px, which would truncate to zero and never move), and pauses for 3s
whenever the player scrolls up so manual scrolling still works.

Fonts moved from a Theme built in code to theme_override_fonts /
theme_override_font_sizes, the pattern main_menu.tscn already uses. The size
stays 14, which is what the old FixedSize = 14 calls intended.

Also moved the screen into UIElements/Credits/ alongside the other UI screens,
and fixed the credits text path: it was "./Text/credits.txt", relative to the
working directory, which fails in an export (a Finder-launched macOS app has /
as its working directory). It now uses the project directory in the editor and
GamePaths.BaseDir in an export.

Testing

  • Structural check against the scene with a temporary headless Godot script:
    node types and parents, that all five exported node paths resolve, the label
    flags, and that all four theme font slots resolve to Noto Sans at size 14.
    Run both in a working tree and in a fresh worktree with a cold Godot import
    cache, to confirm the committed .uid files are correct after the move.
  • Auto-scroll verified by driving frames: content 9780px in a 528px viewport,
    scroll_vertical advanced over 180 frames.
  • End-to-end in an exported macOS build: running the scene directly from
    OpenCiv3.app logs Credits: Now rolling the credits! with no errors, i.e.
    both textures loaded and credits.txt was found through the export layout.
  • dotnet test — 111 passed, 1 skipped.
  • dotnet format C7/C7.sln whitespace --verify-no-changes passes.

Coordination with #1016

#1016 ("Asset credits") also edits C7/Credits.cs, to read asset_credits.txt
and licences.txt and concatenate all three into a single label:

   creditsLabel.Text = creditsText + assetCreditsText + licencesText;                                                                                                                     

That is the same file, so the two will conflict textually. This change is
compatible with that goal though: instead of concatenating, each text can be its
own RichTextLabel child of CreditsColumn and it will still scroll as one
column. Happy to rebase on #1016, or rework it into sibling labels if that lands
first — whichever is preferred.

The credits screen was an empty Node2D; the background, credits label and
exit button were all built in ShowCredits(). Move the layout into
Credits.tscn so it can be seen and edited in the scene editor, leaving only
the runtime bits in code: the Civ3/standalone artwork, the credits text and
the exit button signal.

The credits label now sits in a VBoxContainer inside a ScrollContainer, so
the column scrolls as one continuous block and further credit sources can be
added as sibling nodes instead of being concatenated into a single label.

The column also scrolls itself slowly, and pauses for a few seconds if the
player scrolls up, so manual scrolling still works.

The fonts are theme overrides on the label rather than a Theme built in
code, preserving the intended size of 14 that the old fixed_size calls
asked for.

Finally, move the screen into UIElements/Credits/ alongside the other UI
screens, and read credits.txt via the project directory / GamePaths rather
than a cwd-relative "./Text/credits.txt", so it loads from an export too.
@WildWeazel

Copy link
Copy Markdown
Member

Thanks! I'll check out the scene later but at a glance this looks good.

As far as coordinating with 1016, we had talked offline about keeping the credit sources in separate labels which is what prompted my request for the vertical container. I think we'll load credits.txt into the default label, my notice.md from #1017 into a MarkdownLabel, and the compiled assets credits into another. This could merge first and we can tweak the script to target the new nodes.

@ajhalme
ajhalme merged commit e443dfb into C7-Game:Development Nov 14, 2026
3 checks passed
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.

Scenify the credits screen

3 participants