Modding for a Smarter AI

Some players have gone to great effort to learn how to mod non-Metaverse games to get extra bonus tiles. Easy victories are hollow victories! As players gain experience with the game, hopefully they will focus on how to make the AI better rather than how to cheat the game.

I've started this thread to discuss modding changes that will make the AI play better. For example, for performance reasons the AI does not value sensors but this places it at a disadvantage. Sensor Level 1 is cheap to research and gives +1 bonus to your sensor range as well as allowing you to build extra survey ships (useful for beating the AI to those anomalies). By modding the XML files your can change the weight the AI places on techs and get it to set better research goals.

I would like to hear back from other veteran players on what mods they think would make the AI more challenging. We are lucky that Brad is always looking for ways to improve an already good AI. Maybe some suggestions will be included in an official future update for Metaverse players.

The AI in DA is much improved over DL!
Thank you Stardock for your hard work in making the best single player turn based space strategy game even better!
9,623 views 18 replies
Reply #1 Top
Some players have gone to great effort to learn how to mod non-Metaverse games to get extra bonus tiles. Easy victories are hollow victories! As players gain experience with the game, hopefully they will focus on how to make the AI better rather than how to cheat the game.


guilty as charged! heh heh. But really this was my first foray into the modding scene. The cosmetic side of GC2 has very limited appeal - changing the tile pictures and designing new ships is all well and good, but you cant do it for long without getting bored . changing the structure of the game, however, is definitely more my thing.

Enhancing the AI is a great idea - where are those files which govern research weighting?
that would be a good start ( and easy I hope)...and the end would be coding the AI so that it will try to win ( which would be rock hard I expect).

The AI in DA is much improved over DL!
Thank you Stardock for your hard work in making the best single player turn based space strategy game even better!


I agree, but a little less fanboyishness please
Reply #2 Top
Enhancing the AI is a great idea - where are those files which govern research weighting?

I've never done any modding myself so I'm not even sure if the weight is stored in an XML file or something that is hard coded. Each AI has its own personality and research goals. If it is not possible to get the AI to research sensors then you might try modding to give all players Sensors Level 1 at game start. Unfortunately, getting the AI to build additional survey ships would likely require coding changes.
GalCiv II Wiki - Modding
Reply #3 Top
Frookie, the file he is talking about is TechTree.xml.
The AIValue tag is what governs how important a tech is to the AI.
For example, the sensor techs all have an AIValue of 1 while PlanetaryInvasion has an AIValue of 18.

Funny thing, and I wonder if it would make the AI never research it, but Terraforming as no AIValue tag at all.
Reply #4 Top
Mascrinthus, it is easy enough to mod it so the AI will research sensors. Just change the AIValue to a much higher number. If you make them all, say, 30, the AI should research them very early in the game.

The file can be edited in Notepad or Wordpad, or any number of XML editors that are available for free. I use XML Marker, which you can find here:
WWW Link
Reply #5 Top
Hi!
the AI does not value sensors but this places it at a disadvantage.

It doesn't NEED to research them, because it has a bonus there. In maso games it sees at least 7 parsecs far with everything.

what mods they think would make the AI more challenging

AI needs significantly more accurate tool to measure real military strenght. That means it has to know combat value of its ships vs. ships other AIs had. I already mentioned that on Google groups: comp.sys.ibm.pc.games.strategic in "Galactic Civilizations II - Summer of 1.3" thread. Having more accurate measure of warfighting potential should IMO have a big impact on the way AI plays. It should also allow them to design better counterdesigns. And Drengin would not be so arrogant with their free corvettes, when they'd know my heavily-armoured fregates can each eat a dozen of them just for apetizer.

BR, Iztok
Reply #6 Top
Cheers moosetek - I'm definitely going to have a play with that particular xml...But is there a way (for us) to give each race its own specific study path.

AI needs significantly more accurate tool to measure real military strength.

I agree with you iztok, the hordes of throwaway fighters that keep getting produced by the AI are nowhere near hard enough to battle it out with most of my mid game fleets. does anyone know where this can be adjusted? Or is this part of the code we aint 'allowed' to access yet.

Also where do the bits of code which cover tactics and war making hide. I want to increase the aggression factor of the AIs. I want to wake up one fine galactic week and find the drengin have launched a sneaky attack on one of my settled worlds and actually sent enough transports to take that planet away from me. Bah! never liked that planet anyway. War! I have fond memories of the darlok empire suddenly appearing out of the void and nuking my home world (MOO2). It would be nice to have something similar.

Reply #7 Top
It doesn't NEED to research them, because it has a bonus there. In maso games it sees at least 7 parsecs far with everything.

With Eyes of the Universe I can see 15 in all directions. Yes, at the top three levels the AI gets lots of bonuses but at tough and below it does not. Even if the AI does not need the increased senor range, it would benefit from building additional survey ships.

AI needs significantly more accurate tool to measure real military strength.

I think the speed of combat fleets should be considered. In my first DA 1.6 game playing on a medium map against 6 suicide/ultimate opponents, using a mixed strategy (factories and labs) I fell far behind. When the Drengin declared war on me my fleets of 3 all attack medium hull ships with 6 X 12 beam attack (evil weapons), with the super warrior (first strike) advantage I could easily take out his fleets. However, at that time I still only had 2 such fleets each with speed 5 (1 + 2 race bonus + 1 impulse bonus + 1 warp bonus) so they each could only take out 5 fleets per turn but the Drengin had dozens of fleets all stacked on top of each other. When my fleets ran out of movement, on the next turn the Drengin counter-attacked and without the first strike advantage my all attack (no defense) fleets fell. If these fleets had speed 28 (like my medium hull fleets would eventually in DL) then these two fleets might have taken out all Drengin combat ships.

In my current game I'm playing all factories to help close the manufactorying gap.
Reply #8 Top
Agreed, the military ratings that the AI uses to tell whether or not it should be going to war aren't helping their cause at all. A simple tally of attack and defense doesn't tell the whole story at all. Aside from the issues of speed and positioning, there are three major factors not being taken into consideration...

1) Tactical effectiveness. This is especially important when super warriors are involved. Basically, if an empire is punching above or below their weight, this needs to be taken into account. When one ship manages to wipe out twice it's worth in firepower and hp, it might be worth your time to give the other side's commander a bit of respect

2) Non-warship capabilities. An empire with better intelligence (scouts, cargo hulls loaded with sensors) will be better able to hit their opponents painfully by prioritizing targets and being able to see threats to vulnerable targets coming from a great distance. The use of transports is also important... even if a civ's military power is a fraction of yours, but they're capable of taking half your territory in a month, that's something you need to take into account

3) How far can this civ project its power? Yeah, so they have massive frigates in fleets that have enough firepower to crush your empire by themselves. That is entirely irrelevant if they don't have the range to reach you, or the speed to get to your empire in a decent timeframe (ie, before you build better ships). This is even MORE important to take into account when military starbases are being utilized. I played a game where massed fleets of cheap tiny hulls stood in the influence of four or more military bases at once, and I consequentially had a massive military rating and was feared for it. It should be patently obvious, however, that I was no credible threat outside my territory... I was nearly invincible within my own borders, but I couldn't project much force outside it.
Reply #9 Top
Hi!
but the Drengin had dozens of fleets all stacked on top of each other.

If I face Drengin, I ALWAYS research armor up to Superior Duranthium. A fregate with just 2 weapons and 6-8 such armors is indestructible by those Super Dominator corvettes. In one game I just parked two of such ships close to that horde of corvettes, and Drengin in their turn promply sent all of them after my ships. Despite I turned off combat viewer it took the game several minutes to process all battles. Drengin lost over 80 ships, I lost none. Until the combat rules in DA change again, I'll be using defenses, as they make combat ridiculously easy. Another AI's weakness that should be addresed.

BR, Iztok

Reply #10 Top
I just have to ask, how much experience did your ships gain from this Iztok? That is interesting and could be used as a "training exercise" for new fleets Have them just attack a group of Super Dominators and just level up like crazy (if they do that).

Oh, a question that just came to mind, how does the game decide how much experience to give to a ship in battle? I am going to try to find that answer on the forum right now, but hopefully someone will still answer here if I do not edit this post...>.>

GalenEvil
Reply #11 Top
Hi!
how much experience did your ships gain from this Iztok?

Not much. I expected significanly more. Probably those corvettes had too low a value to give more experience to my ships.

BR, Iztok
Reply #12 Top
Cheers moosetek - I'm definitely going to have a play with that particular xml...But is there a way (for us) to give each race its own specific study path.


You should check out the Star Trek mod. Study some of those files and you can see how it was done for the different races.
The Federation has one tech tree, the Vulcan's another, etc.

I don't think it would prevent stealing techs from another race, perhaps not even picking up on the other race's tech line once one of their techs were gotten, but it does attempt to do what you have requested.


I grabbed a few hulls (some great hulls in that mod) and a little of the tech tree to add into my own stuff. But a little editing is necessary because the tech requirements are unique for both.
Reply #13 Top
star trek eh? I think you're definitely on to something here...

each race has its own tech tree with different aivalues assigned to the research item.

changes were made to the cost of tech w.r.t. which race the tech tree is designed for: the drengin are more geared towards weapon tech so the stinger would be cheaper to research whereas they find virtual reality centres to be too difficult , or the torians love to research and so on and so forth.

I think I'm definitely having a go on the star trek mod to begin with and see how that plays.

later
Reply #14 Top
Mascrinthus: but the Drengin had dozens of fleets all stacked on top of each other.

Iztok Bitenc: If I face Drengin, I ALWAYS research armor up to Superior Duranthium. A frigate with just 2 weapons and 6-8 such armors is indestructible by those Super Dominator corvettes. In one game I just parked two of such ships close to that horde of corvettes, and Drengin in their turn promply sent all of them after my ships. Despite I turned off combat viewer it took the game several minutes to process all battles. Drengin lost over 80 ships, I lost none. Until the combat rules in DA change again, I'll be using defenses, as they make combat ridiculously easy. Another AI's weakness that should be addresed.

Since I was playing Super Warrior, I was building all only ships; defense if not needed if you take off the enemy before he can fire back. This worked well in DL prior to 1.2 before the first strike advantage was mostly(i.e., 1HP rule) removed and before the nerfing of speed in DA. The fleet you describe would have worked well against the primitive corvettes with light guns but would have failed against their larger ships with advanced missiles! A single fleet of high attack medium hulls with 28 speed (possible in DL) would have handled both. Since speed is nerfed in DA, I needed either more fleets to make up for the limited # of attacks per turn. Or, two types of fleets, one with high attack/no defense(attacking with first strike) against the advanced cruisers with missiles and one with heavy armor that can defend against the corvette fleets.

Iztok Bitenc: Not much. I expected significantly more. Probably those corvettes had too low a value to give more experience to my ships.

Experience gained depends on the attack strength of the enemy destroyed and is not based on HP destroyed.

Getting back to the subject of modding to improve the AI, if I mod the tech tree so the AI values the sensor branch:
(1) Will it research sensors and then build extra survey ships?
(2) Will it research the entire branch and build Eyes of the Universe or high sensor range escorts for his military fleets? This is needed on levels (e.g., tough and below) that don't receive sensor bonuses.
Reply #16 Top
Hi!
The fleet you describe would have worked well against the primitive corvettes with light guns but would have failed against their larger ships with advanced missiles!

I never claimed I'll attack his main warships with these fregates. They're a special counterdesign just for killing those weak gun-armed corvettes, and I usuall build only a few of them: 2-4. For killing his heavy-hitters I have another specialized medium/large hull, full of proper defenses and just a few weapons. So far this combo worked every time, because my wars start a year before the fist shot is actually fired. Would be good if AIs could do the same.

BR, Iztok


Reply #17 Top
Experience gained depends on the attack strength of the enemy destroyed and is not based on HP destroyed.


Is it based on relative strength to the ship that destroys it? Because I have noticed that my Dreadnoughts don't lvl up unless they are fighting hordes of smaller ships or lower and lower numbers of larger ships.

GalenEvil
Reply #18 Top
I never claimed I'll attack his main warships with these frigates.

I understand. I was just explaining that in that game, playing on suicide with mixed factories and labs my production was far behind that of the AIs. I did not have enough manufacturing capacity to quickly build the numbers of warships I needed (to wipe out all the stacked fleets in a single turn using the first strike advantage) or the research capacity to quickly research the defenses I needed for a counter to the corvettes (so I could survive their counter attack). Now I'm playing the all factories strategy which makes it easy to quickly build ships or planetary improvement (as long as you have the money to do so (which is not a problem after completing the Mind Control Center and some stock exchanges).

Is it based on relative strength to the ship that destroys it? Because I have noticed that my Dreadnoughts don't lvl up unless they are fighting hordes of smaller ships or lower and lower numbers of larger ships.

You will gain more experience from destroying a tiny hull ship with doom rays than a huge hull ship with particle beams.

Getting back to the intended focus of this thread. What changes can be made in a mod to make the AI smarter? There have been several suggestions on how to improve the AI in this thread that would require coding changes. Through modding we can direct the research of the AIs. Experienced players know all to well a mass upgrade from Enhanced Factories to Industry Centers can cripple your economy. This would usually happen when you steal a tech from the AI during a war. You can mod the AI to place less value on the last two factory techs but those techs are needed to fully build up your starbases mining galactic resources and your economic starbases. In DA (unlike DL) you can research up to Industrial Sectors (I usually just steal the last two from the AI during war) to gain access to those starbase modules and continue to build enhanced factories (until my economy is producing very large surpluses and my planets have the capacity to quickly upgrade to Industrial Sectors). Is it possible to mod the AI to hold off on building (or upgrading to) the later factories and labs, short off keeping them from researching those necessary techs?