Single Player bugs and crashes v38 plus (SVN) - After the 20th of February 2018

So more wonders should use Python for extra benefits?
A while back we had a modder add a bunch of wonders as placeholders for intended effects to be added down the road. The effects were never added. Part of that may be my fault in a way. Regardless, numerous wonders sit in the game with much less than what they were intended to deliver.
 
What do others think, should I remove it, or fix the problem described above in the quote?

If you remove the feature then you should also remove the wonder because that is what makes it a wonder. Last time I tested it was about 2 years ago and it worked then.

We have far too many wonders that are not wonderus because they have not been fleshed out.
Ok, I tweaked the code instead of removing it.
 
@Thunderbrd it appears combined replacement is broken:
If I have Upscaled Production and Upscaled Research on, then research cost isn't upscaled at all.

Code:
<ReplacementCondition>
                <Has>
                    <GOMType>GOM_OPTION</GOMType>
                    <ID>GAMEOPTION_UPSCALED_BUILDING_AND_UNIT_COSTS</ID>
                    <ID>GAMEOPTION_UPSCALED_RESEARCH_COSTS</ID>
                </Has>
            </ReplacementCondition>

I guess I should make separate option for that.

I found this on forums:
Code:
<ReplacementCondition>
                <And>
                    <Has>
                        <GOMType>GOM_OPTION</GOMType>
                        <ID>GAMEOPTION_LS612_TRAITS</ID>
                    </Has>
                    <Not>
                        <Has>
                            <GOMType>GOM_OPTION</GOMType>
                            <ID>GAMEOPTION_LEADERHEAD_LEVELUPS</ID>
                        </Has>
                    </Not>
                </And>
            </ReplacementCondition>
I'll do that for all gamespeed replacements so correct one will be selected:
Has X AND Not Y
Has Not X AND Y
Has X AND Y

And that works.
 
Last edited:
@Thunderbrd it appears combined replacement is broken:
If I have Upscaled Production and Upscaled Research on, then research cost isn't upscaled at all.
<ReplacementCondition>
<Has>
<GOMType>GOM_OPTION</GOMType>
<ID>GAMEOPTION_UPSCALED_BUILDING_AND_UNIT_COSTS</ID>
<ID>GAMEOPTION_UPSCALED_RESEARCH_COSTS</ID>​
</Has>​
</ReplacementCondition>
I think it needs to be like this:
<ReplacementCondition>
<And>
<Has>
<GOMType>GOM_OPTION</GOMType>
<ID>GAMEOPTION_UPSCALED_BUILDING_AND_UNIT_COSTS</ID>​
</Has>
<Has>
<GOMType>GOM_OPTION</GOMType>
<ID>GAMEOPTION_UPSCALED_RESEARCH_COSTS</ID>​
</Has>​
</And>​
</ReplacementCondition>
 
It Needs to be like this:
<ReplacementCondition>
<And>
<Has>
<GOMType>GOM_OPTION</GOMType>
<ID>GAMEOPTION_UPSCALED_BUILDING_AND_UNIT_COSTS</ID>​
</Has>
<Has>
<GOMType>GOM_OPTION</GOMType>
<ID>GAMEOPTION_UPSCALED_RESEARCH_COSTS</ID>​
</Has>​
</And>​
</ReplacementCondition>
Now I figured out that.
@KaTiON_PT didn't knew about it - he added this option :p
 
So.... we're good now? Could something like this be the fault of the problem you had with the animal option you were trying to achieve?
Yes I fixed Upscaled Cost option triggers - there are two such options.
Now different definitions are activated depending on presence of Upscaled Building Cost and Upscaled Research Cost options.

Animal infos and Spawn infos had only one replacement option for each entry (except non-animals), so it was completely unrelated.
Problem with animal option was most likely 400 of alternative unit and spawn definitions.
I guess problem was almost realtime checking for replacements in animal infos (units) and spawn info (spawns) thousands if not ten thousands times per turn on gigantic map.

You could simply override tags if certain condition are met:
If GAMEOPTION_DANGEROUS_WILDLIFE is on then:
All units with UNITCOMBAT_WILD (Does it cover all animals?) gets their iAnimalIgnoresBorders tag set to 2, if it was 0 or 1.
All spawns with PlayerType of 47/48/49 (animal NPCs) gets their bNeutralOnly set to 0.
 
You could simply override tags if certain condition are met:
If GAMEOPTION_DANGEROUS_WILDLIFE is on then:
All units with UNITCOMBAT_WILD (Does it cover all animals?) gets their iAnimalIgnoresBorders tag set to 2, if it was 0 or 1.
All spawns with PlayerType of 47/48/49 (animal NPCs) gets their bNeutralOnly set to 0.
Did you see how I implemented the reckless animal option?
Maybe it will help you figure out a different implementation.
 
Did you see how I implemented the reckless animal option?
Maybe it will help you figure out a different implementation.

Can you override spawning rule with that?
bNeutralOnly is in spawn infos, not in animal infos.

Code:
<UnitCombatInfo>
            <Type>UNITCOMBAT_DANGEROUSFAUNA</Type>
            <Description>TXT_KEY_UNITCOMBAT_DANGEROUSFAUNA</Description>
            <OnGameOptions>
                <GameOptionType>GAMEOPTION_DANGEROUS_WILDLIFE</GameOptionType>
            </OnGameOptions>
            <iAnimalIgnoresBorders>2</iAnimalIgnoresBorders>
            <bNeutralOnly>0</bNeutralOnly>
            <Button>Art/Interface/Buttons/units/sparth/categories/nature_pounce.dds</Button>
        </UnitCombatInfo>
 
Can you override spawning rule with that?
bNeutralOnly is in spawn infos, not in animal infos.

Code:
<UnitCombatInfo>
            <Type>UNITCOMBAT_DANGEROUSFAUNA</Type>
            <Description>TXT_KEY_UNITCOMBAT_DANGEROUSFAUNA</Description>
            <OnGameOptions>
                <GameOptionType>GAMEOPTION_DANGEROUS_WILDLIFE</GameOptionType>
            </OnGameOptions>
            <iAnimalIgnoresBorders>2</iAnimalIgnoresBorders>
            <bNeutralOnly>0</bNeutralOnly>
            <Button>Art/Interface/Buttons/units/sparth/categories/nature_pounce.dds</Button>
        </UnitCombatInfo>
No, but at least you wouldn't have to double the amount of animal unitInfo xml entries like you did when you tried to implement it in rev. 10234.
 
No, but at least you wouldn't have to double the amount of animal xml entries like you did when you tried to implement it in rev. 10234.
Well I wanted to have all animals spawn within borders too.
 
Well I wanted to have all animals spawn within borders too.
Yeah, if you don't want to add a bunch of new spawnInfo xml entries then you would need a dll implementation for the spawn mechanism that is used under the game option.
TB could probably help you with that.
 
Last edited:
Yeah, if you don't want to add a bunch of new spawnInfo xml entries then you would need a dll implementation for the spawn mechanism that is used under the game option.

Well I doubled spawninfo size, when I tried to use GOM replacement method, and that most likely caused memory leak.
 
You added 5 000 lines to spawnInfo, but you also added 25 000 lines to UnitInfo.
My suggestion reduces 25 000 lines of xml. ^^
I think spawns are checked way more frequently than units themselves.
 
I think spawns are checked way more frequently than units themselves.
It shouldn't really matter as the xml should ideally only be read by the dll once during initialization, and the replacement entries should overwrite the regular version of the entry.
I dunno why there was a memory leak, that's a bit beside the point.

The spawn mechanic you want for that option is best to implement in dll (it should pretty much only be one "if else" statement in the code); while the unit stat change you want is best to implement the way I suggested as hardcoding that in the dll is relatively cumbersome to achieve in comparison.
 
Last edited:
It shouldn't really matter as the xml should ideally only be read by the dll once during initialization, and the replacement entries should overwrite the regular version of the entry.
I dunno why there was a memory leak, that's a bit beside the point.

The spawn mechanic you want for that option is best to implement in dll (it should pretty much only be one "if" statement in the code); while the unit stat change you want is best to implement the way I suggested as hardcoding that in the dll is relatively cumbersome to achieve in comparison.
How to make it so iAnimalIgnoresBorders is always set to 2 without pushing exiting animals with iAnimalIgnoresBorders of 2 into higher numbers (that is won't suddenly spawn/go in cities)

I want animals with iAnimalIgnoresBorders of 0 (that is without this tag) and iAnimalIgnoresBorders of 1 to have iAnimalIgnoresBorders 2.
 
How to make it so iAnimalIgnoresBorders is always set to 2 without pushing exiting animals with iAnimalIgnoresBorders of 2 into higher numbers (that is won't suddenly spawn/go in cities)
Ok, I didn't think about that... Haven't really examined what the dangerous wildlife option entail, nor thought much about it really.

It's probably best with a dll implementation for that too.
The dll spawn code could check if the unit has the UNITCOMBAT_DANGEROUSFAUNA and that the GAMEOPTION_DANGEROUS_WILDLIFE is active to then decide that it should treat the unit like iAnimalIgnoresBorders is at the value 2.
So a small "if else" statement in the dll spawn code in this case too.
Another "if else" statement needs to be in the AI code used for animals that let any animals ignore borders when the option is active.

Edit: {
Instead of checking if the unit has UNITCOMBAT_DANGEROUSFAUNA, it could check:
if animal and GAMEOPTION_DANGEROUS_WILDLIFE is active
Spawn in non-neutral is allowed.
if iAnimalIgnoresBorders is less than 2
iAnimalIgnoresBorders = 2.​
else
Use XML info.​
Rest of spawn code...​
}
 
Last edited:
Ok, I didn't think about that... Haven't really examined what the dangerous wildlife option entail, nor thought much about it really.

It's probably best with a dll implementation for that too.
The dll spawn code could check if the unit has the UNITCOMBAT_DANGEROUSFAUNA and that the GAMEOPTION_DANGEROUS_WILDLIFE is active to then decide that it should treat the unit like iAnimalIgnoresBorders is at the value 2.
So a small "if else" statement in the dll spawn code in this case too.
This options means, that any animals can spawn anywhere except in cities themselves, and maybe where civilian units are standing.

Well then UNITCOMBAT_DANGEROUSFAUNA wouldn't be needed and UNITCOMBAT_WILD could be used - this one is used in all wild animals.
 
Back
Top Bottom