New BETA Version - 4.17.8 (December 16, 2024)

Status
Not open for further replies.
What has to be updated then, sql tables or lua code, or both?
yeah some clarification here would be nice -- I used 1's and 0's in an XML update yesterday (UnitPromotions_Terrains/Features), in lieu of true/false... seems to work fine.

Also, doesn't SQLite convert everything into 1's and 0's anyway? how are you guys forcing it to do proper booleans?
 
Still I don't get it. I get no errors of this kind while loading the mods. I fixed other non-related bugs. I don;t know how to find these tables, and there can be tons of them to fix.

Normally I put "1" if table asked for "true" value. But in lua I think I used boolean statments like "if x" or if "x == true".
 
Last edited:
NOTE: The Community Patch Only version of the mod does not work in 4.17 versions.

Version 4.17.3 has been released. Link in OP has been updated.


Changelog:
Code:
- Fixed crashes from failed assertions
     Fixed a crash when a player dies
     Fixed a crash when plundering a trade route leading to your own city
- Fixed a division by zero crash

Online as of 1:52 PM CDT. Savegame compatible with 4.17 versions.
 
Last edited:
First game with the new patch CTD on founding my first city with Morocco. Prince, random map. I'm gonna do a fresh install and try again.
 
Why the Community Patch only option does not work in 4.17 versions? There are many people who do not like some VP changes or who use something different (i. e. JFDDLC or Gaia/Sapiens), so I'd like to have an explicit explanation for the reason(s) for that discriminatory update.
 
Still I don't get it. I get no errors of this kind while loading the mods. I fixed other non-related bugs. I don;t know how to find these tables, and there can be tons of them to fix.

Normally I put "1" if table asked for "true" value. But in lua I think I used boolean statments like "if x" or if "x == true".
It only affects Lua (which seems to base the variable type on the SQLite column type). SQLite itself doesn't have strict types; they're merely hints for table users.

As I said, all potential errors should show up on the log.
 
uh oh brazilios... turn 1 AI blunder
Spoiler :
1733792698463.png
 
Why the Community Patch only option does not work in 4.17 versions? There are many people who do not like some VP changes or who use something different (i. e. JFDDLC or Gaia/Sapiens), so I'd like to have an explicit explanation for the reason(s) for that discriminatory update.
Compatibility will be restored in 4.18. It's not a change in the direction of the project, it's a temporary issue with this version. We're working on addressing an issue with the game database which causes crashes, issues during development, and compatibility issues. Progress on fixing that issue is only partially complete at the moment, which breaks Community Patch Only.
 
NOTE: The Community Patch Only version of the mod does not work in 4.17 versions.

Version 4.17.4 has been released. Link in OP has been updated.


Changelog:
Code:
- Fixed crashes from failed assertions
     Fixed a crash when a City-State liberates a city
     Fixed a crash when liberating a city from Barbarians
     Fixed a crash when liberating a City-State
     Fixed another crash when a player dies
- Exposed CvUnit::IsNoMaintenance() and CvUnit::SetNoMaintenance() to lua

Online as of 8:56 AM CDT. Savegame compatible with 4.17 versions.
 
Last edited:
It only affects Lua (which seems to base the variable type on the SQLite column type). SQLite itself doesn't have strict types; they're merely hints for table users.
i have a mod that had an unbuildable unit, would only generate through other means... its cost was set to -1. Afaik this was the standard way of making a unit unbuildable.

now it is buildable on turn 0 in a single turn. Do i have to flag it differently?
 
Compatibility will be restored in 4.18. It's not a change in the direction of the project, it's a temporary issue with this version. We're working on addressing an issue with the game database which causes crashes, issues during development, and compatibility issues. Progress on fixing that issue is only partially complete at the moment, which breaks Community Patch Only.
Thank you so much.
 
i have a mod that had an unbuildable unit, would only generate through other means... its cost was set to -1. Afaik this was the standard way of making a unit unbuildable.

now it is buildable on turn 0 in a single turn. Do i have to flag it differently?
Nothing was changed. Are you sure the SQL didn't break somewhere before that?
 
I submitted a new issue to Github, but I think there are even more root causes for crashes when other players die.
 
Nothing was changed. Are you sure the SQL didn't break somewhere before that?
The mod hasn't changed in 2-3 years, plus it's XML unit table definition and the unit is otherwise showing up fine in-game, can be built and moved around etc. No errors that I can see outside of the turn 0 production menu. It's pretty simple on the db side, the population/refugee mod over in the modmod sub. I don't recall how a failed xml file is handled; doesn't the whole thing not load?

Idk how but it's similar to what happens loading more wonders mod... There all buildings show up as buildable on turn 0

the only thing i can think of to fix is to do lua override when game checks for whether its buildable -- but this shouldnt be necessary
 
Last edited:
1733906806852.png

It should always hit this line since bIgnoreCost is default false when called from Lua.
 
is this field still called just 'cost'? if it is, i'm stumped

here's the entirety of the non-art, non-text xml from this mod:

Spoiler :

<UnitClasses>
<Row>
<Type>UNITCLASS_POPULATION</Type>
<Description>TXT_KEY_UNIT_POPULATION</Description>
<DefaultUnit>UNIT_POPULATION</DefaultUnit>
</Row>
</UnitClasses>

<Units>
<Row>
<Type>UNIT_POPULATION</Type>
<Class>UNITCLASS_POPULATION</Class>
<Capture>UNITCLASS_POPULATION</Capture>
<Combat>0</Combat>
<Cost>-1</Cost>
<Moves>2</Moves>
<CombatClass>UNITCOMBAT_SETTLER</CombatClass>
<Domain>DOMAIN_LAND</Domain>
<DefaultUnitAI>UNITAI_TREASURE</DefaultUnitAI>
<CaptureWhileEmbarked>true</CaptureWhileEmbarked>
<Description>TXT_KEY_UNIT_POPULATION</Description>
<Civilopedia>TXT_KEY_UNIT_POPULATION_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_POPULATION_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_POPULATION_HELP</Help>
<Pillage>false</Pillage>
<Found>false</Found>
<XPValueAttack>0</XPValueAttack>
<XPValueDefense>0</XPValueDefense>
<UnitArtInfo>ART_DEF_UNIT_POPULATION</UnitArtInfo>
<UnitArtInfoCulturalVariation>true</UnitArtInfoCulturalVariation>
<UnitFlagAtlas>UNITS_POPULATION_FLAG_ATLAS</UnitFlagAtlas>
<UnitFlagIconOffset>0</UnitFlagIconOffset>
<IconAtlas>UNITS_POPULATION_ICON_ATLAS</IconAtlas>
<PortraitIndex>0</PortraitIndex>
</Row>
</Units>

<UnitGameplay2DScripts>
<Row>
<UnitType>UNIT_POPULATION</UnitType>
<SelectionSound>AS2D_SELECT_SETTLER</SelectionSound>
<FirstSelectionSound>AS2D_BIRTH_SETTLER</FirstSelectionSound>
</Row>
</UnitGameplay2DScripts>
 
is this field still called just 'cost'? if it is, i'm stumped

here's the entirety of the non-art, non-text xml from this mod:

Spoiler :

<UnitClasses>
<Row>
<Type>UNITCLASS_POPULATION</Type>
<Description>TXT_KEY_UNIT_POPULATION</Description>
<DefaultUnit>UNIT_POPULATION</DefaultUnit>
</Row>
</UnitClasses>

<Units>
<Row>
<Type>UNIT_POPULATION</Type>
<Class>UNITCLASS_POPULATION</Class>
<Capture>UNITCLASS_POPULATION</Capture>
<Combat>0</Combat>
<Cost>-1</Cost>
<Moves>2</Moves>
<CombatClass>UNITCOMBAT_SETTLER</CombatClass>
<Domain>DOMAIN_LAND</Domain>
<DefaultUnitAI>UNITAI_TREASURE</DefaultUnitAI>
<CaptureWhileEmbarked>true</CaptureWhileEmbarked>
<Description>TXT_KEY_UNIT_POPULATION</Description>
<Civilopedia>TXT_KEY_UNIT_POPULATION_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_POPULATION_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_POPULATION_HELP</Help>
<Pillage>false</Pillage>
<Found>false</Found>
<XPValueAttack>0</XPValueAttack>
<XPValueDefense>0</XPValueDefense>
<UnitArtInfo>ART_DEF_UNIT_POPULATION</UnitArtInfo>
<UnitArtInfoCulturalVariation>true</UnitArtInfoCulturalVariation>
<UnitFlagAtlas>UNITS_POPULATION_FLAG_ATLAS</UnitFlagAtlas>
<UnitFlagIconOffset>0</UnitFlagIconOffset>
<IconAtlas>UNITS_POPULATION_ICON_ATLAS</IconAtlas>
<PortraitIndex>0</PortraitIndex>
</Row>
</Units>

<UnitGameplay2DScripts>
<Row>
<UnitType>UNIT_POPULATION</UnitType>
<SelectionSound>AS2D_SELECT_SETTLER</SelectionSound>
<FirstSelectionSound>AS2D_BIRTH_SETTLER</FirstSelectionSound>
</Row>
</UnitGameplay2DScripts>
That's the refugees mod, right? If so I'm interested in a solution as well as I use it for flavor.

\Skodkim
 
I submitted a new issue to Github, but I think there are even more root causes for crashes when other players die.
We're fixing them as they come!

For clarity, the mod hasn't become dramatically more unstable. Crashes from failed assertions are added by us to essentially stop the game once behavior that isn't supposed to happen takes place. This prevents the bugs from silently persisting for months or years.

This issue here for instance wouldn't have been caught at all if we hadn't added this.
Turns out this is an issue present for several versions (and that was very hard to catch) causing Diplomacy AI approach scores towards human players to become randomly corrupted, often with huge positive or negative numbers, leading to high aggression or passivity for no reason. Happy to have caught and fixed that.

Most of these checks are intended to prevent arrays in the Diplomacy AI from being accessed out of bounds (for example, a memory container is expanded to size MAX_MAJOR_CIVS (22) and it tries to access or set the value for player 35, a City-State). C++ does not crash by default when this happens and instead it causes the dreaded undefined behavior.

Previously there were a lot of checks that would function like this, which were removed and replaced with assertions.
Code:
if (ePlayer < 0 || ePlayer >= MAX_MAJOR_CIVS) return 0;

These would prevent undefined behavior, but it would fail silently, and we wouldn't know that the code wasn't functioning as intended. Some of these assertion trigger crashes are easily fixed by for example, checking to see if ePlayer is a major civ before trying to set a value for them, but others are more difficult. I discovered an issue with the AI's evaluation of their biggest World Congress competitor where it would try to compare if a player had a worse voting score than NO_PLAYER, which necessitated rewriting the entire function to fix because I hadn't accounted for that originally. The new function is a lot tidier now that I'm more experienced at writing code. :)

There are other places in the DLL that lack these assertions. We fixed a lot of these issues during testing and are planning on fixing more of them in the future.
 
Another hotfix inbound later today.
 
NOTE: The Community Patch Only version of the mod does not work in 4.17 versions.

Version 4.17.5 has been released. Link in OP has been updated.


Changelog:
Code:
- Fixed crashes from failed assertions
     Fixed a crash when stealing land from Barbarians
     Fixed various crashes when a player dies (revamped the function which resets memory)
- Fixed unique embassies not being counted as an embassy by City-States

Online as of 10:39 AM CDT. Savegame compatible with 4.17 versions.
 
Status
Not open for further replies.
Top Bottom