Skip to content

Conversation

@zack-the-coding-actuary
Copy link
Contributor

Sorry, deleted my fork instead of my branch. I'm a noob GitHub user but I'm learning.

UI looks a little clunky for the world size buttons + the list of potential civs when you select "Huge", that part will need some extra help.

The linking of loading map size info from original Civ 3 files has NOT been touched.

UI looks a little clunky for the world size buttons + the list of potential civs when you select "Huge", that part will need some extra help.

The linking of loading map size info from original Civ 3 files has NOT been touched.
@stavrosfa
Copy link
Contributor

stavrosfa commented Jan 5, 2026

Regarding UI, I don't know if you saw this comment from Yegor in your previous PR
#847 (review)

Also I can see something weird going on when hovering over the selected labels tiny, small, etc. Some letters seem to dissapear, but that might be out of scope for this one

@stavrosfa stavrosfa linked an issue Jan 5, 2026 that may be closed by this pull request
@zack-the-coding-actuary
Copy link
Contributor Author

I can attempt to look into those items if you want to bundle that into this PR/resolving the issue. I've never used Godot before though and my skills are definitely more suited towards coding logic and features more so than UI and graphics. I know just enough right now to build and playtest.

private readonly List<WorldSize> sizeOptions = new List<WorldSize>
{
// Tiny, index 0
new WorldSize() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are these values for the WorldSize variants coming from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the Civ 3 wiki + hardcoded game values: https://civilization.fandom.com/wiki/Map_(Civ3)

Albeit, they are indeed coded as "magic numbers" right now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if @TomWerner had something specific in mind when he opened the issue, besides making easier for modders to play around with the sizes, etc, and that's why he said that this should be saved in the json save file.
The other thing would be dynamic names for the buttons (Tiny, Small, etc) for all the World Sizes, vanilla & custom.
I would prefer if we wrote that to the json as well, but the current code doesn't break anything I tested so far with .biq, .sav and .json files.
If this were to be accepted, a TODO would have to go in there for a future refactor so that it can go in the json.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can point me to the right JSON file to save the configs in (or the directory where I should make a new config file) I'll happily refactor it. I agree that direction is better modular design.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The json file is actually two files c7-static-map-save.json and c7-static-map-save-standalone.json
These files are used to launch a new game (for now, today Yegor opened a PR that merges them into one actually, but still valid), the first for the original version and the other one for the standalone with seperate graphics. I can't explain the whole thing here, but I would suggest you take some time, and try to understand how the creating/loading works.
There is a class called CreateGame.cs that you can have a look at and start to unravel the whole thing. Most of the code's variables/methods/classes are well named, so if you can't find something through code, you can search the text for what would be the most likely name, and chances are you are going to find it.
I would also suggest to use a debugger when you want to examine things in detail, and also have a look at the existing unit tests and even write your own if you want.
If you have any questions, discord is better for this kind of thing I believe

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we don't want to be hardcoding these.

This information should be present in the WSIZ or WCHR (world size/world characteristic) fields. We grab some data from them in ImportCiv3 right now:

private static void SetMapDimensions(SavData civ3Save, SaveGame save) {
if (civ3Save is not null && civ3Save.Wrld.Height > 0 && civ3Save.Wrld.Width > 0) {
save.Map.tilesTall = civ3Save.Wrld.Height;
save.Map.tilesWide = civ3Save.Wrld.Width;
save.Map.techRate = civ3Save.Bic.Wsiz[civ3Save.Wrld.WsizID].TechRate;
save.Map.optimalNumberOfCities = civ3Save.Bic.Wsiz[civ3Save.Wrld.WsizID].OptimalNumberOfCities;
}
}
private static void SetMapDimensions(BiqData biq, SaveGame save) {
if (biq is not null && biq.Wmap is not null && biq.Wmap.Length > 0) {
save.Map.tilesTall = biq.Wmap[0].Height;
save.Map.tilesWide = biq.Wmap[0].Width;
save.Map.techRate = biq.Wsiz[biq.Wchr[0].WorldSize].TechRate;
save.Map.optimalNumberOfCities = biq.Wsiz[biq.Wchr[0].WorldSize].OptimalNumberOfCities;
}
}

If we pull from there (and save it in the JSON files) then it's available to modders, existing civ3 mods that change the world sizes and such will work correctly, and it'll generally work nicely.

In case you're a printf debugging guy, you can use dotnet test ../EngineTests/EngineTests.csproj -v n to run the tests and see print statements you add, otherwise a debugger works great too. The WSIZ/WCHR classes should map to the civ3 editor pretty closely if you want to inspect the values from vanilla civ3.

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.

Allow creating games with different world sizes

3 participants