Version 20 Preview 1 is ready. It's on GitHub like the preview versions usually are, here:
https://github.com/maxpetul/C3X/releases/tag/Release_20_Preview_1. The big addition is the removal of the 256 city improvement limit. That turned out to be relatively easy to implement, assuming it works right and I haven't missed anything. Actually it took me longer to create a test scenario than it did to remove the limit. To make the test scenario, which I've attached below in case any of you want to try it out, I filled the scenario's improv list with placeholder buildings until there were 300 total and then I copied all the game's improvs after that and made the original ones unbuildable. So the game rules are the same as the standard game only, under the hood, all the game's city improvements are in slots 300-382 instead of 0-82 like normal. If the improv limit removal is working correctly, the test scenario should play exactly like the standard game. All the original improvs and placeholders are still visible cluttering up the Civilopedia, just ignore them.
As for how the limit removal works, it's actually quite straight forward. Basically, the problem with having more than 256 city improvements is that each city only stores whether each improv type has been built or not for up to 256 different types. If you go beyond that, the game will start accessing beyond the end of its lists of 256 entries and you'll get phantom buildings, crashes, etc. Fortunately those lists are accessed through functions which I can modify to safely handle entries beyond the first 256. Those extra entries are recorded elsewhere in memory allocated by the mod, and the mod will allocate as much as it needs for however many improv types are in the scenario data. Other than that, I don't know of any technical limits on how many improv types you can have. The only other issue is that the entries for the additional improvs need to be kept in the save game but that's an issue I've finally solved.
Packing additional data into save games turns out to be easy, in fact if I'd known how easy it was I would have done it earlier. It's just a matter of tacking some additional data onto the game's save data before it writes it to a file and, on the other side, inserting some code that runs after the game has loaded save data to read back in the additional mod data from the end of the file. I was concerned there would be problems with save compression or the game getting confused by the extra data while loading, but as it turns out it just works. The game just does generic compression over whatever save data it has, so that can include the mod's save data too for free, and, when loading, it ignores any extra data at the end of the file, so again it works just fine with the mod's additional data, no modifications necessary. The fact that the game ignores extra data at the end means that saves created with C3X, with extra data packed in, are still loadable by the unmodded game. BTW, I've seen some people assume that C3X saves are not compatible with the base game but that's not true. As of R19, C3X is fully save compatible with the base game, as in it doesn't even modify the save games at all so there's no difference between the two. Even now, when saves contain extra mod data, they'll still work with the base game, with the caveat that loading the game and saving it back out with the base game will lose any extra mod data.
Here's the full list of changes in R20P1:
- Remove city improvement limit
- Controlled by config option remove_city_improvement_limit
- Option to show unit hitpoints on the stealth attack target selection popup (named show_hp_of_stealth_attack_options in config)
- Option to have a warning when the building you've selected to build would replace another already built in the city
- Named warn_when_chosen_building_would_replace_another in config, off by default
- Option to prevent stealth attacks from targeting units that are invisible and unrevealed (named exclude_invisible_units_from_stealth_attack)
- Stop barbarian spawns from bankrupting the barbarian player (matters only if barbs are allowed to capture cities)
- Option stopping pollution of impassable tiles also covers volcanic eruptions
- Make barbarians defend cities they've captured as if they were camps
- Load a third config file, custom.c3x_config.ini, if present
- Fix describe_states_of_units_on_menu setting being ignored
- Stop units from airdropping multiple times in one turn
- This only matters when dont_end_units_turn_after_airdrop has been activated
- Do not group together units with different names on right-click menu
- Record which units have used extra defensive bombards in save files
- Touch up action descriptions for auto precision striking and fortified exhausted units
- Correct description of lethal zone of control setting in default config
FYI - sometimes the alternative unit option on the pop-up is the same as the one you were trying to build, pretty sure it was in this case (perhaps this bugette triggers the creation of unbuildable ones?).
Thanks for the info. I don't know what's going on here, I'll have to look into it. It might be related to unit type duplication, but I thought I addressed that when I programmed this in the first place. Anyway, thanks for reporting this.
For the Perfume specs, checking AI cities, I only get feedback for unit builds. I don't have any clue what buildings are. I should add there are numerous buildings and units available for build at all times (more or less). Any suggestions on how to determine Building build values by the AI?
The AI production ranking is definitely supposed to include buildings. I have no idea why it wouldn't. This is another thing I'll have to look into.