Skip to content

Custom Soldier Names via soldier_names.txt - #137

Merged
segrax merged 7 commits into
OpenFodder:masterfrom
Forgen:feat/custom-soldier-names-clean
Nov 27, 2026
Merged

segrax merged 7 commits into
OpenFodder:masterfrom
Forgen:feat/custom-soldier-names-clean

Conversation

@Forgen

@Forgen Forgen commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Ref feature request #65 - All 360 original soldier names can be overridden by placing a soldier_names.txt in each game resources folder or globally in the /Data/ folder. See soldier_names.txt.example. One name per line, letters A-Z only, up to six letters long. Currently if fewer than 360 names are provided, the list will recycle at the top.

If a soldier_names.txt file is present in the current version's game
resources folder, its names replace the original 360 recruit names
(JOOLS, JOPS, STOO, ...). One name per line, A-Z only, up to 6 letters;
blank lines and '#' comments are ignored, names are upper-cased, and a
short list cycles through all recruits. Without the file the original
names are used unchanged.

Names are looked up through a new Recruit_Get() accessor used by every
name display (squad list, hero list, sidebar, service screen). Loading
is lazy on first lookup and repeats on version switch, so each version
can have its own list. The file is read via the resource manager
(FileReadStr), not fileGet(), as the CD resource's fileGet() exits the
process for a missing file.
First and last names split across entries (JEAN / LUC / PICARD, LUKE /
SKY / WALKER), each cut to the 6 characters the name displays show.
Comment thread soldier_names.txt.example Resolved
@segrax

segrax commented Nov 25, 2026

Copy link
Copy Markdown
Member

No real issues here, the only thing that i am wondering, would this be better to just live in Data/ rather than a specific version

@Forgen

Forgen commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

I was thinking to have different names per game (CF1 vs CF2 etc.) with this approach, which also aligns with my approach for loading custom sprite tile sets. If we were to support both per game and global mods, where in the file structure would the global data files live? Is there a function already in place to discover / query that folder?

@segrax

segrax commented Nov 26, 2026

Copy link
Copy Markdown
Member

yeah im not sure actually, its probably a rare problem, but also given there is an open request about it, feel like it will be complained about if not done in a way that works across the board 😄

Keep the per-version list as the primary lookup; when a version has
no soldier_names.txt of its own, fall back to a single list in
Data/soldier_names.txt shared by all versions. A per-version file
always wins, even if it is empty. New ResourceMan::GetGlobalDataFilePath()
resolves the shared file against the install roots, reusing the
existing Data/ path generation and case-insensitive resolution.
@Forgen

Forgen commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

@segrax the latest update now allows the soldier_names in the Data/ folder. Can you test it on Linux? I'm always nervous about the file handling on different file systems.

@segrax
segrax merged commit 99cf929 into OpenFodder:master Nov 27, 2026
4 checks passed
@segrax

segrax commented Nov 27, 2026

Copy link
Copy Markdown
Member

Thanks!

@segrax segrax mentioned this pull request Nov 27, 2026
@Forgen
Forgen deleted the feat/custom-soldier-names-clean branch November 29, 2026 01:20
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.

2 participants