FFH Shadow and GlobalTypes.xml

Bringa

King
Joined
Jan 23, 2006
Messages
678
Hi,

in pre-BTS FFH, when I wanted to define new FLAVORS for the purpose of messing with the AI's tech selection, I had to define that flavor in the GlobalTypes.xml file in Assets/XML. That file no longer exists. What do I do now? Do I copy that file over from BtS's Assets/XML folder?
 
If it's not in FfH2 then it's loading the default BtS file. So yes copy over that one.
 
The reason I'm asking is that I tried that, but the AI ignores the flavors I'm introducing. Just for testing's sakes I introduced a FLAVOR_DANIEL (so I could quickly grep the error/xml logs for it and see if it pops up) and gave it to Sabathiel at an unreasonably high rate and then also applied it to Fishing at a very high rate. So theoretically, post-BtS Sabathiel would have beelined for fishing straight away. He doesn't.

So either this flavor is not accepted as it is, or the team has removed the FLAVOR tags from AI tech selection.
 
In the python file CvGameUtils.py you can force the AI to go for specific techs. This is already used so that for example Ljosalfar always goes for way of the forests immediately.

Here is the current implementation:

Code:
[B][COLOR=RoyalBlue]def[/COLOR] [COLOR=SeaGreen]AI_chooseTech[/COLOR][COLOR=Purple]([/COLOR][/B]self,argsList[B][COLOR=Purple])[/COLOR][/B]:[INDENT] ePlayer = argsList[0]
bFree = argsList[1]
pPlayer = gc.getPlayer(ePlayer)
eTeam = gc.getTeam(pPlayer.getTeam())
iTech = -1

if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LUCHUIRP'):
    iTech = gc.getInfoTypeForString('TECH_CONSTRUCTION')

if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LJOSALFAR'):
    iTech = gc.getInfoTypeForString('TECH_WAY_OF_THE_FORESTS')

if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_KHAZAD'):
    iTech = gc.getInfoTypeForString('TECH_WAY_OF_THE_EARTHMOTHER')

if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LANUN'):
    iTech = gc.getInfoTypeForString('TECH_SAILING')

if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_HIPPUS'):
    iTech = gc.getInfoTypeForString('TECH_HORSEBACK_RIDING')

if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_BALSERAPHS'):
    iTech = gc.getInfoTypeForString('TECH_FESTIVALS')

if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_CALABIM'):
    iTech = gc.getInfoTypeForString('TECH_FEUDALISM')

if eTeam.isHasTech(gc.getInfoTypeForString('TECH_KNOWLEDGE_OF_THE_ETHER')):
    if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_AMURITES'):
        iTech = gc.getInfoTypeForString('TECH_SORCERY')
    if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_SHEAIM'):
        iTech = gc.getInfoTypeForString('TECH_SUMMONING')

if eTeam.isHasTech(gc.getInfoTypeForString('TECH_EXPLORATION')) == False:
    iTech = gc.getInfoTypeForString('TECH_EXPLORATION')

if eTeam.isHasTech(gc.getInfoTypeForString('TECH_PHILOSOPHY')):
    if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
        bValid = true
        for iTeam2 in range(gc.getMAX_PLAYERS()):
            eTeam2 = gc.getTeam(iTeam2)
            if eTeam2.isAlive():
                if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_CORRUPTION_OF_SPIRIT')):
                    bValid = false
        if bValid == true:
            iTech = gc.getInfoTypeForString('TECH_CORRUPTION_OF_SPIRIT')

if eTeam.isHasTech(gc.getInfoTypeForString('TECH_PHILOSOPHY')):
    if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_GOOD'):
        bValid = true
        for iTeam2 in range(gc.getMAX_TEAMS()):
            eTeam2 = gc.getTeam(iTeam2)
            if eTeam2.isAlive():
                if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_ORDERS_FROM_HEAVEN')):
                    bValid = false
        if bValid == true:
            iTech = gc.getInfoTypeForString('TECH_ORDERS_FROM_HEAVEN')

if pPlayer.getStateReligion() == gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL'):
    bValid = true
    for iTeam2 in range(gc.getMAX_TEAMS()):
        eTeam2 = gc.getTeam(iTeam2)
        if eTeam2.isAlive():
            if eTeam2.isHasTech(gc.getInfoTypeForString('TECH_INFERNAL_PACT')):
                bValid = false
    if bValid == true:
        iTech = gc.getInfoTypeForString('TECH_INFERNAL_PACT')

if iTech != -1:
    if eTeam.isHasTech(iTech) == False:
        return iTech
[/INDENT][INDENT] return TechTypes.NO_TECH
[/INDENT]
 
You problably made the values too large. The game can't handle values that are too large. Since the values are multiplied with eachother having them both be large results in a very large number.
 
Fox: yeah, I know of that implementation (and hate it! But that's a longer discussion I won't go into right now ;)) and as you can see I selected Bannor because they have nothing in here overriding their behaviour.


Snarko: aaaah, THAT could be the case. I'd assumed the number would end up as a simple int, which should be save up to 2.4 billion. I'll try lowering the values a little to see what happens. Alternatively I could bite the bullet and dig through the dll source of 025L (hoping that this area wasn't affected by the changeover to Shadow)
 
I personally think that no civ should ever be forced to research a tech like they are now. Civs, religions, alignments, and leader traits should definately make a leader value different techs differently.
 
Well, for some civs, certain techs are better in 99% of the circumstances. It's silly to program advanced weightings if saying "If Luchuirp, get construction" is easier and almost always as good.

Whether or not that is the case above, feel free to comment, though.
 
Well the good thing with using weights is that the AI might go for cottages, or calender so they can hook up happiness resources (that usually got good commerce value) and other basic techs that makes their early game better Before they go for whatever tech they are supposed to go for.

Weights mean they will hopefully vary their early game more depending on map situation, etc. But as it is now is good for now.
 
I really don't think that any of those techs would be best in 99% of circumstances. Other techs would make getting those techs faster and/or much more effective once researched. The map also has a huge effect on what you should research first.

Personally, I prefer to wait to build golems (especially Barnaxus) after I already have Gridlines and a Blasting Workshop in at least one city; hence I rush for the magic branch instead, and defend my cities mostly with adepts who will later be the repairmen for by armies. (I also almost always play a very peaceful, builder style game the first half of the game, as almost any civ. The next half of the game I dominate.) Barnaxus is much stonger if he can fireball all his enemies and clean up their remains to farm for xp.



The weighting should also make civs very unlikely to research certain techs, or even accept them as gifts (ex, Good civs shouldn't want Malevolent Designs or Corruption of Spirit, and evil one shouldn't want Orders from Heaven or Righteousness).
 
Sure, but that isn't a strategy the ai is likely to use well.
I guess I should say instead, give them a strategy that is above average 99% of the time, rather than try to give them the perfect one every time.

Perhaps a better method that I was thinking about before, though, would be to preprogram 3-4 initial strategies for each civ and have them chose one before hand. Not as good as a human adapting, but better than meandering through the tech tree.
 
Actually, you're discussing something that I previously solved rather well already ;) As Grey Fox points out, proper weighting allows for variation. If there's a gold resource next to the AI's starting point, going for mining first can get the AI to, say, construction much faster. This is why I removed that bit of Python in Smarter Orcs (back then it was smaller, too) and let weighting take care of it. Worked a charm. I just can't get weighting to work in Shadow at all right now.
 
Back
Top Bottom