Single Player bugs and crashes v37 plus (SVN) - After the 24th of December 2016

While this might be an advice which you already know about, it sounds like you might have missed it- VS default so that if you press f12 while selecting a function (or a variable), it will jump to its definition. This is a bit troublesome with interfaces, but might help you with quickly navigating to the correct function.
I advise you to try it when you are working with AIAndy's coding and you'll see what I mean - it brings up a huge list of functions all called the same thing but differing only by the input of the parameter type and I might be getting better at following that sort of thing now but its still a pain in the ass.

In regards to Noriad's idea- it sounds like the AI should assign two roles to property units. The AI might work like this already, I'm not familiar with it enough, so rather throw this idea out.
Type 1 role: the unit will stay at the city at all time, simply reducing the crime/disease/education.
Type 2 role: the unit will move to cities with high property, and reduce it.
If a city's property is rising, units from the second role will want to reach the city and turn into a type 1 role.
This means that the AI will want to have a few type 2 units to reduce high property, and as backup for new type 1 units. The type 1 units will simply stay in the cities, ignoring the world.
The actual math for priorities should be something along the lines of
A*a+B*b-C*c, where A is the current property, B is the change rate, and C is the number of units enroute. a,b,c are the score modifiers. When the AI decides where to send a unit, he takes the highest number, as resulted from the previous equation.

Is this at all similar to how the AI works?
There's 2 steps to a unit AI. 1) how does it come into play - when and why, and 2) where is it going to be used and how. The AI does keep minimum amounts of particular UnitAI types in its cities usually - depends on the type. Excess to that does go elsewhere where demand exists and it even measures that demand against the time it will take for the unit to get there, how many other units have answered the call already, that sort of thing. There's a lot to it and it's fairly similar to what you said. When the city goes through figuring out what to build, it is also figuring out what it specifically most needs (and considering national needs along the way.) Whether it needs a property control response (building/unit/help from elsewhere etc...) is a checkpoint it makes at multiple junctures on that decision path and it is supposed to start off fairly tolerant and grow more and more demanding as it gets more and more on top of its needs and wants... I just ended up adjusting it to be far more demanding than it should be right up front.
 
To continue a discussion I started a few months ago,

Crime is the most dangerous property, because if it goes out of control, it gets even more out of control over time, due to barbarian criminals spawning.
However, the AI happily builds every +crime producing building there is, even if crime is already out of control. And never sells them even if it never manages to get crime back under control.

So I think the AI should keep itself to thresholds on building +crime buildings, and sell off +crime buildings if crime goes completely out of control.

For example, if current crime level AND Drift_Towards_Value are both above a certain worrisome threshold (e.g. 500), then the AI should start selling off some of his +crime buildings in a desperate attempt to get crime under control. It should take both current crime level AND Drift_Towards_Value into account to not do something drastic just because of a very temporary situation. Yes it may lead to the AI selling off a building and rebuilding it a hundred turns later but it is better than letting crime explode even further. Plus the AI gets bonus production to compensate for inefficiency.

Furthermore, it should wait with building +crime unless crime is low enough to allow it based on a threshold. If for example, current crime is -100, the drift is +5, and the threshold is +100, then the Drift_Towards_Value is +25, which is 75 points below the threshold, so the city can at most accept a 75/25 = +3 crime building before the Drift_Towards_Value goes over the threshold. So every building with more than +3 crime must be blocked until the crime situation improves.

P.S. the threshold for building +crime buildings should be less tight than the threshold for building anti crime stuff. Otherwise the part of the AI that approves +crime buildings and the part of the AI that builds anti-crime stuff will wait for each other to make the first move.

P.S. 2 I think this discussion belongs in the AI thread.
 
To continue a discussion I started a few months ago,

Crime is the most dangerous property, because if it goes out of control, it gets even more out of control over time, due to barbarian criminals spawning.
However, the AI happily builds every +crime producing building there is, even if crime is already out of control. And never sells them even if it never manages to get crime back under control.

So I think the AI should keep itself to thresholds on building +crime buildings, and sell off +crime buildings if crime goes completely out of control.

For example, if current crime level AND Drift_Towards_Value are both above a certain worrisome threshold (e.g. 500), then the AI should start selling off some of his +crime buildings in a desperate attempt to get crime under control. It should take both current crime level AND Drift_Towards_Value into account to not do something drastic just because of a very temporary situation. Yes it may lead to the AI selling off a building and rebuilding it a hundred turns later but it is better than letting crime explode even further. Plus the AI gets bonus production to compensate for inefficiency.

Furthermore, it should wait with building +crime unless crime is low enough to allow it based on a threshold. If for example, current crime is -100, the drift is +5, and the threshold is +100, then the Drift_Towards_Value is +25, which is 75 points below the threshold, so the city can at most accept a 75/25 = +3 crime building before the Drift_Towards_Value goes over the threshold. So every building with more than +3 crime must be blocked until the crime situation improves.

P.S. the threshold for building +crime buildings should be less tight than the threshold for building anti crime stuff. Otherwise the part of the AI that approves +crime buildings and the part of the AI that builds anti-crime stuff will wait for each other to make the first move.

P.S. 2 I think this discussion belongs in the AI thread.
I think we should wait to see how well they do with the current unit AI changes that should keep them from staffing ruffians as homeland defenders. I don't advocate not building crime+ buildings nor do I advocate ever selling them off. You should be able to easily control crime with a few more LE units and get an ROI on the costs vs penalties that way.
 
Lol I updated to the latest svn (9923), started a new game (deity/nightmare) and all the other civs now start with 8 neanderthal warriors instead of wanderers. Don't say that this is WAD? And did this sneak into v38.1 if it isn't?

EDIT: maptype perfectworld2f
 
Last edited:
Yeah, that's strange, not WAD at all. I'm pretty sure it can't stem from my latest commits.
I tested on Deity, no nighmare, and the AI got two wanderers, two Band of sapiens, two gatherers, and a bunch of Neanderthal warrirors... I only got a stone thrower.

The neanders were set to UNITAI_CITY_DEFENSE.
My guess is that it was introduced at rev. 9914.
 
Last edited:
Lol I updated to the latest svn (9923), started a new game (deity/nightmare) and all the other civs now start with 8 neanderthal warriors instead of wanderers. Don't say that this is WAD? And did this sneak into v38.1 if it isn't?

EDIT: maptype perfectworld2f
I haven't seen anything along those lines myself. It may be the fact that I tightened the expectations on some AI types that the Unit in many cases now MUST show that it is for that type of UnitAI or they won't be selected for that role. In this particular case, many of the units that are assigned at the beginning count only a consideration for AI type validity (which is what prompts there to be a change here) and technological access. It does NOT concern itself for resource(bonus) prerequisites and never has. So I guess I'm wondering how neanderthal warriors, with no tech prereq, haven't been the best city defenders all along. I think I need to consider some improvements on how to filter for the selection of 'best free starting units'.
 
Last edited:
Lol I updated to the latest svn (9923), started a new game (deity/nightmare) and all the other civs now start with 8 neanderthal warriors instead of wanderers. Don't say that this is WAD? And did this sneak into v38.1 if it isn't?

EDIT: maptype perfectworld2f

AI got two wanderers, two Band of sapiens, two gatherers, and a bunch of Neanderthal warrirors..

Instead of Neanderthal it used to be plain clubmen after the 2 bands, 2 gatherers and 2 wanderers. Why was neanderthal given to the AI anyway?
 
Why was neanderthal given to the AI anyway?
HOW, rather than why, is what I'm trying to figure out. Thank you for answering the question on my mind about what it used to be though.
 
Welcome. And from the xml files I have no clue as to How.
 
Welcome. And from the xml files I have no clue as to How.
XML didn't change I don't think so it's an odd reaction to a recent change in unitAI requirements. What confuses me is how the warriors haven't been considered the best for that role all along.
 
Why would the Civ IV BtS Deity and our NM Deity consider any Mil units besides the clubmen?

And it used to be Scouts instead of wanderers too. So I guess that answers my question, your (or a former Modder's) coding changes for Deity is where this is coming from.
 
In my game on the Vertical Solar Map all my opponents are just sitting there and are founding no new cities. Most of them produce Lesser Research. I am not at war with anyone and they have plenty of space to expand. I am somewhere in the middle of the Ancient Era.

These are my settings:

No Technology Trading
No Tech. Brokering
No Vassal States
No Revolutions
No Inquisitions
No Tech Diffusion
Usable Mountains
Surround and Destroy
Advanced Diplomacy
Unlimited Wonders
Barbarian Generals
No Zones of Control
Great Commanders
Advanced Economy
United Nations
Advanced Espionage
Advanced Nukes
Infinite XP
No Negative Traits
C2C Combat Mod - Fight or Flight
C2C Combat Mod - Size Matters
Minimum City Border
Assigned Specialists XP
Teleporting Hunting Awards
C2C Combat Mod - Hide and Seek
Peace Among NPCs
Animals Stay Out!
Realistic Siege
Beeline Stings

This was a very very VERY longstanding bug. I figured out why it was happening due to a recent insight when working on the AI elsewhere and I immediately realized the problem as soon as I looked at the portion of code where the bug was. I've tried to fix it before and failed due to not understanding the purpose of this section previously. It has been responsible for paralyzing quite a few AI players for a number of versions here. So apparently the timing to look into it was right this time. We got it on the next commit.
 
And it used to be Scouts instead of wanderers too. So I guess that answers my question, your (or a former Modder's) coding changes for Deity is where this is coming from.
It's always been dependent on the tech level. The units have never been hardcoded but rather are the best for the AI and tech prerequisites. Our approach of not having Unique Units not being replacements have opened up the potential for this - which is why Deer Riders are given to players when they get an Ancient Start - the Deer Riders are the best exploring unit according to the evaluations and they are tech qualified and the game doesn't care about bonus access because if it did it would cut out too many unit types from consideration, particularly for more advanced era gamestarts.

I'm trying to look directly at some of the changes in the AI code that have inadvertently brought this about - but my first theory I proved incorrect already. Sigh. This is a tougher nut.

Sure would be nicer if we could just specifically declare the unit types for particular 'free starting unit' roles in the Era Infos or something. But that SHOULD be a larger project than just trying to patch up whatever the problem is.
 
It's always been dependent on the tech level. The units have never been hardcoded but rather are the best for the AI and tech prerequisites. Our approach of not having Unique Units not being replacements have opened up the potential for this - which is why Deer Riders are given to players when they get an Ancient Start - the Deer Riders are the best exploring unit according to the evaluations and they are tech qualified and the game doesn't care about bonus access because if it did it would cut out too many unit types from consideration, particularly for more advanced era gamestarts.

I'm trying to look directly at some of the changes in the AI code that have inadvertently brought this about - but my first theory I proved incorrect already. Sigh. This is a tougher nut.

Sure would be nicer if we could just specifically declare the unit types for particular 'free starting unit' roles in the Era Infos or something. But that SHOULD be a larger project than just trying to patch up whatever the problem is.
This issue has been solved. A change to the math involved in determining a best city defense AI specifically brought this about. In a lot of ways, the Neanderthal Warrior is a better city defender than the Stone Thrower. And I was wrong that free units aren't discounted by bonuses, in fact it's the opposite - any bonus prereq and they cannot be selected for this role. It would be better if we could make a Neanderthal Bonus and make it a prereq for all Neanderthal units. It would help with this a lot and I note that I should come back to this section and manipulate it some for starting free bonuses for a given civ so that eventually neanderthal types start with these and human types do not.

Anyhow, I think it also comes down to UnitAI type. Stone throwers ARE a city defense unit and I just told the code to halve the value of any unit that doesn't share the AI type it's asking for. This is so that the unit will be used in the manner in which it is intended when given to the AI player (and in some cases even the human player gets free city defense units at gamestart.) 8 is the amount of city defenders the AI gets when you play on Deity so that was just as designed in the era infos.
 
Last edited:
It would be better if we could make a Neanderthal Bonus and make it a prereq for all Neanderthal units. It would help with this a lot and I note that I should come back to this section and manipulate it some for starting free bonuses for a given civ so that eventually neanderthal types start with these and human types do not.
The best would imo be to make it possible to specifically define the starting unit in era xml as you suggested earlier.
A different solution exist though; one could remove all free techs from difficulties.

Edit: There is a free unit at game start defined in CivilizationInfos, not sure what this does on later era starts though. Maybe it simply upgrades the unit to the latest available upgrade by following the upgrade path defined in the unitInfo xml
Code:
            <FreeUnitClasses>
                <FreeUnitClass>
                    <UnitClassType>UNITCLASS_BAND</UnitClassType>
                    <iFreeUnits>1</iFreeUnits>
                </FreeUnitClass>
            </FreeUnitClasses>
I suggest that we should transfer this tag from CivilizationInfo over to EraInfo.
The tag must be changed somewhat for handicapInfo to be able to define the amount of each category:
Code:
<iStartingDefenseUnits>0</iStartingDefenseUnits>
<iStartingWorkerUnits>1</iStartingWorkerUnits>
<iStartingExploreUnits>0</iStartingExploreUnits>
<iAIStartingUnitMultiplier>1</iAIStartingUnitMultiplier>
<iAIStartingDefenseUnits>8</iAIStartingDefenseUnits>
<iAIStartingWorkerUnits>2</iAIStartingWorkerUnits>
<iAIStartingExploreUnits>1</iAIStartingExploreUnits>
 
Last edited:
The best would imo be to make it possible to specifically define the starting unit in era xml as you suggested earlier.
A different solution exist though; one could remove all free techs from difficulties.

Edit: There is a free unit at game start defined in CivilizationInfos, not sure what this does on later era starts though. Maybe it simply upgrades the unit to the latest available upgrade by following the upgrade path defined in the unitInfo xml
Code:
            <FreeUnitClasses>
                <FreeUnitClass>
                    <UnitClassType>UNITCLASS_BAND</UnitClassType>
                    <iFreeUnits>1</iFreeUnits>
                </FreeUnitClass>
            </FreeUnitClasses>
I suggest that we should transfer this tag from CivilizationInfo over to EraInfo.
The tag must be changed somewhat for handicapInfo to be able to define the amount of each category:
Code:
<iStartingDefenseUnits>0</iStartingDefenseUnits>
<iStartingWorkerUnits>1</iStartingWorkerUnits>
<iStartingExploreUnits>0</iStartingExploreUnits>
<iAIStartingUnitMultiplier>1</iAIStartingUnitMultiplier>
<iAIStartingDefenseUnits>8</iAIStartingDefenseUnits>
<iAIStartingWorkerUnits>2</iAIStartingWorkerUnits>
<iAIStartingExploreUnits>1</iAIStartingExploreUnits>
A lot of effort for a small return. I'll work on fixing what's not broken when it becomes problematic enough to warrant the effort. You're not wrong but we're ok on this front for now.
 
couple of errors i see:

1.
Traceback (most recent call last):
File "BugEventManager", line 363, in _handleDefaultEvent
File "PlatyPingWonders", line 312, in onTechAcquired
NameError: global name 'b_nazca' is not defined

2. When i use the "assassinate btn (pic1) it does nothing now, it just goes to "choose ur target (pic2)??
 

Attachments

  • errpr (1).JPG
    errpr (1).JPG
    182.8 KB · Views: 108
  • errpr (2).JPG
    errpr (2).JPG
    180.1 KB · Views: 122
couple of errors i see:

1.
Traceback (most recent call last):
File "BugEventManager", line 363, in _handleDefaultEvent
File "PlatyPingWonders", line 312, in onTechAcquired
NameError: global name 'b_nazca' is not defined

2. When i use the "assassinate btn (pic1) it does nothing now, it just goes to "choose ur target (pic2)??
That mission hasn't been worked on but maybe theres some code confusion. I'll look into it.
 
couple of errors i see:

1.
Traceback (most recent call last):
File "BugEventManager", line 363, in _handleDefaultEvent
File "PlatyPingWonders", line 312, in onTechAcquired
NameError: global name 'b_nazca' is not defined?
Probably happened when the wonder code was moved out of python modules and into the merged file.
 
Back
Top Bottom