1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

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

Discussion in 'Bugs and Crashes' started by Dancing Hoskuld, Dec 26, 2016.

  1. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,123
    Gender:
    Male
    Location:
    Las Vegas
    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.

    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.
     
    Raledon likes this.
  2. Noriad2

    Noriad2 Chieftain

    Joined:
    Oct 23, 2014
    Messages:
    1,153
    Gender:
    Male
    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.
     
  3. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,123
    Gender:
    Male
    Location:
    Las Vegas
    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.
     
  4. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    6,090
    Location:
    Norway
    Nah, that's okay, I'll probably have to play for a couple of hours in several eras to be certain that I didn't introduce any bugs in that commit.
    I'll keep an eye on this thread, I'm atm too busy modding to playtest much anyhow.
     
  5. Noriad2

    Noriad2 Chieftain

    Joined:
    Oct 23, 2014
    Messages:
    1,153
    Gender:
    Male
    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: Feb 21, 2018
  6. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    6,090
    Location:
    Norway
    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: Feb 21, 2018
  7. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,123
    Gender:
    Male
    Location:
    Las Vegas
    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: Feb 21, 2018
  8. JosEPh_II

    JosEPh_II TBS WarLord

    Joined:
    Jun 20, 2007
    Messages:
    15,675
    Gender:
    Male
    Location:
    Western IL. cornfields
    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?
     
  9. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,123
    Gender:
    Male
    Location:
    Las Vegas
    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.
     
  10. JosEPh_II

    JosEPh_II TBS WarLord

    Joined:
    Jun 20, 2007
    Messages:
    15,675
    Gender:
    Male
    Location:
    Western IL. cornfields
    Welcome. And from the xml files I have no clue as to How.
     
  11. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,123
    Gender:
    Male
    Location:
    Las Vegas
    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.
     
  12. JosEPh_II

    JosEPh_II TBS WarLord

    Joined:
    Jun 20, 2007
    Messages:
    15,675
    Gender:
    Male
    Location:
    Western IL. cornfields
    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.
     
  13. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,123
    Gender:
    Male
    Location:
    Las Vegas
    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.
     
    Snofru1 likes this.
  14. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,123
    Gender:
    Male
    Location:
    Las Vegas
    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.
     
  15. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,123
    Gender:
    Male
    Location:
    Las Vegas
    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: Feb 22, 2018
    Toffer90 likes this.
  16. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    6,090
    Location:
    Norway
    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: Feb 22, 2018
  17. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,123
    Gender:
    Male
    Location:
    Las Vegas
    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.
     
    Toffer90 likes this.
  18. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,445
    Gender:
    Male
    Location:
    MN
    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)??
     

    Attached Files:

  19. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,123
    Gender:
    Male
    Location:
    Las Vegas
    That mission hasn't been worked on but maybe theres some code confusion. I'll look into it.
     
  20. Dancing Hoskuld

    Dancing Hoskuld Warlord

    Joined:
    Jul 5, 2004
    Messages:
    23,290
    Gender:
    Male
    Location:
    Canberra, Australia
    Probably happened when the wonder code was moved out of python modules and into the merged file.
     

Share This Page