Brad Wardell's views about technology, politics, religion, world affairs, and all sorts of politically incorrect topics.
4 days of coding results in a more intelligent opponent
Published on April 18, 2006 By Draginol In GalCiv Journals

Do as I say...not as I do...

I preach, regularly, that you shouldn't rewrite code. Instead, you should try to learn how it works and fix it or extend it. But sometimes, in rare cases, I find the need to rewrite something. Often it's something I did myself.  I've done a lot of rewriting this weekend. A lot.

Friday, Saturday, Sunday and today I pretty much did nothing but work on the AI.  No, it's not work. It's for fun. I mean let's be real, I'm working on a video game.  Any modders out there? You know what I mean.  If you had the source code to your favorite game, you'd probably make changes too.  And that's what I've done.

The list of changes is too long to list tonight.  The big ones I've done that players will likely notice:

  • AI (all players) Tries to do better at researching.
  • AI (all players) focuses much better on their chosen weapons tech.  Essentially, it was factoring in the cost of a technology too much in deciding what it would build. So later on it would think "Sure, I'm focusing on mass drivers but that quantum driver will take me 20 weeks to get while I can get Stinger missiles in only 3 weeks. Let's go for that.  Uh-uh. Not anymore. It's more intelligent now about deciding when to research what.
  • AI (all players) is much better at doing something about threats.  Players know the AI can identify threats but it wasn't doing enough about them. Now, you move those ships into that sneak attack, you'll see the AI pull in ships from nearby into orbit or attack you (and then announce).
  • AI (all players and not just the Drath) have the capability of paying others off to go to war with others and now it will tell you if they've been paid off (before they'd just go to war and you might not know why).
  • AI (all players) is aware of conquerors and will take steps to try to thwart them by acting together.

A lot of the weekend has been testing this, tweaking things, getting the pacing down pat. You don't want any of this to happen too often or not often enough. You also have to do work on the diplomacy screen AI (which I am not as involved in but have started getting involved in more) to make sure that this all flows well.

I need living space...

In my last game I was testing out the issue that hard core strategists have observed -- you can roll up the AI players if you can fight them individually and in isolation. Play on a large galaxy, tight clusters, rare everything and then pick off each player in a single surprise attack. Regardless of difficulty level, this is the "easiest" way.  The computing advantages of an artificial player are at their weakest.

The problem in battling this strategy is that it requires that players go against their own short-term self interest.  If I'm attacking the Altarians, why should the Arceans really care? I mean, they might toss the Altarians some ships and they might take you out IF they are more powerful. But what if they're not? What if you have the military edge? Tough luck basically.

In the real world, this happens regularly unless you have defined alliances.  In GalCiv II, alliances are not something you get easily. You have to get close relations and have alliances and even then it's not 100%.  

So what we want is for players to act against their short-term interests in exchange for their long term interests. Any AI developers lurking know the difficulty in putting together such a long term strategy. 

After all, nation states rarely work towards their long term best interests.  In World War II, Germany took Austria and no one made noises.  Then Germany took part of Czechoslovakia and the world did nothing.  Then they took the rest of it and the world did nothing.  Only after Germany conquered Poland did Britain, its dominions, and France declare war and no much happened except at sea.  Then Germany conquered France and still nothing happened. If anything, other countries joined up with Germany (Italy declared war at that point).  Then Italy invaded Albania and Greece and then Germany got involved there too. Country after country invaded and even though the writing was on the wall, countries didn't band together.  Even the United States stayed out of it until it was directly attacked and even then waited until Germany declared war on the United States.  In the end, what did Germany in wasn't that countries collectively got together (other than Britain and the Dominions who were true heroes of World War II) and said "enough".  It was mostly that Germany underestimated the Soviet Union and combined with Britain, the US, and the dominions, were able to take them out.

As we approach a strategy game, the challenge is how to get computer players to be more like Britain and less like say Belgium (or less like the Soviet Union which aided Germany until it was their turn).  In GalCiv 1.0X, the AI at best acts like the United States -- "Oh, you're being wiped out by the Drengin? Here's some free ships." Clearly that's not enough when you're dealing with a well oiled military machine rampaging across the galaxy.  In 1.1, some (and I won't say which) of the players are now set up to be like Britain where they will organize forces to fight aggression. BTW, I don't want to offend my German friends with any of this.  I'm looking at this purely from a strategic perspective. Regardless of ones feelings about World War II, Germany, up until they attacked the Soviet Union, had an excellent military strategy.

This may not work

Before I go forward with the test game, I want to stress that I have no way of knowing whether this is going to work.  I'm playing the game and recording what happens. So don't get too excited, this whole thing may amount to nothing.  It may take more work to make it band together. There's a lot of variables in places.

What I can guarantee you is that it will be tougher for me to win. It will spend its money better. Research better.  Use its forces better.  4 days of pure AI development is more than some strategy games get total. So we're not talking tweaking around the edges here.

In the beginning...

Each player gets one star, 2 planets. I will attack the Korx first who are the light gray. Then I will take out the Yor. Then the Drengin. And continue until they're all dead. That's my strategy. It worked flawlessly last time.

As one can expect, I always win this setup. But I can't beat the AI on suicidal unless I play in a galaxy where I'm isolated enough to make use of economic and production tricks (the new suicidal is much tougher).  Lower intelligence levels won't be affected much by what has changed except that you are much more likely to get help from other players.

Let's see if they've improved...

I'm the brown line at the top. Since the AI is based on adaption and not scripting, it has to "learn" what is best for it. But as an experienced player, my game play is somewhat scripted. I have a build order. I crank up my initial research to get a jump and you can see the results above in research.

I also know that Trade is very valuable to computer players since well, it's trade.

So I quickly fill in my techs that I don't have in other areas.

Very early I will have planetary invasion. If I'm lucky, I'll have invasion ships before the first victim, the Korx, even have defenders. Speaking of Korx, what are they up to? Are they building well?

vs.

This is the Korx home planet.  Not too bad a setup. Not as good as my home planet though. I got a better home world than they do and I'm out producing them in every way. But it's not really their fault. I just got a better planet and am spending more. The Korx have their abilities wrapped up in their production so if they do live long enough they could be a problem.

Planetary Invasion Tech? Check. Enhanced Transport designed? Check.  Building: 11 weeks.

And off we go..

The Korx home world is mine.  It's going to take me a bit of time to get out of debt though. I will be helpless for a few turns.

One down. 8 more to go. It's still 2225 and I've already got a huge advantage. I was able to take Korx using Informational Warfare so I didn't damage anything (though I did go into debt because of it).

The other players respond to my new power appropriately as I trade them techs for money to get out of debt.

Soon, I am able to get out of debt by selling tech.  So should I conquer the Yor or the Dnreing? The Drengin are slightly closer. But they've already conquered a minor race themselves so the Yor are a bit easier.

But before I do that, I'm going to set up trade routes with my other neighbors so that they like me. I need each one to think they're my buddy until it's their turn.

But first the Yor.  I design a fighter specifically with them in mind.  They, like the Drengin, are focusing on missiles. So this is a two-fer.

At 6 attack and 2 defense against Yor missiles, it should be quite lethal. And I have twice as many planets to produce it from. It's called the F2-Yor Doom. "Yor Doom" Get it? Oh, I'm so clever..

Anyway..

The Drengin aren't impressed with my military might.  This could be an issue. I'm going to ignore them for now. My military build up should make them look for weaker targets.

While we build up, let's take a look at what the different civilizations are researching as we begin 2227 (two game years in):

  • Drengin: Master Trade.
  • Altarians: Enhanced Logistics
  • Arceans: Plasma Weapons
  • Torians: Medium Scale Building
  • Yor: Harpoon
  • Drath: Warp Drive
  • Thalan: Stinger IV
  • Iconians: Impulse Drive Mark III

So quite a variety there.

The Torians are now ones to worry for though, they managed to unearth a Ranger. And are wreaking havoc on the Drengin. That will keep them busy while I eliminate the Yor and can then take on the Drengin right after now properly softened up.

My fleets approach while the Drengin take apart the Torians. The Yor will soon be history.

 The Yor respond to my build up by moving ships to be very close to mine and beefing up their defenses.

And then attacking! But their ships are no match.  Iconia (the Yor home world) is mine.

I guess that Ranger you found wasn't enough eh? The Torians are going down. I do some lend lease with them since I need the money and the Drengin are my next target anyway.

The Drengin, however, are monitoring the situation. Their scout ship sits silently giving the Drengin the FOW viewage they need of what's going on. What will they do? Their fleets are nearly done with the Torian Confederation.

The Yor, meanwhile surrender what's left but turn it over to the neutral Thalan. There's a lot involved in who an AI surrenders to. It's not particularly random. In this case, I attacked the Yor, I was the aggressor. So the Yor simply handed their forces over to a neutral. This is akin to US forces occupying Iceland in World War II to take over for the British.

Two down. The Drengin are next. But it coudl be tough. They have absorbed the Torians and a minor race. They're as powerful as I am.

This is the galaxy at this point.  I'm the bround. The Drengin are the red. The Yor, Torians, and Korx are already dead.

Oh don't worry, we'll take care of the Drengin. You don't worry yourself. Whoahahah! WHOHAAH! (cough cough). I also go around and make sure the war machine is fed with tech trades. It's gotten a lot tougher since the AI is greedier with its hard currency and won't generally trade weapons techs unless it's really desperate.

But every little bit helps.

And I've got a new Frigate class ship designed just for the Drengin.  To deal with the Drengin, I have a new transport type as well.

With 5,000 legions on it, it represents a major investment of manpower for the Dominion. I only need to take out the various homeworlds that the Drengin currently occupy. The rest I can take at my leisure.

Pretty straight forward.  Now, I can already tell you that it's been a lot harder than previously. The AI is building better ships because it's building a better economy. And it's focusing better so I have to build up a lot more. If I can take out the Drengin, that will help a lot.

I send in my forces. I also send a secondary force to what was once the Torian home world. The Drengin have forces up there too.

The Drengin recognize what I'm doing and declare war. I'm not ready yet.

The Drengin are well prepared for me too. Their ships are defended against my weapon type just as mine is against theirs. But they have more ships.  But I do manage to take their home world. The attack on Toria, however is thwarted. The Drengin won't be going down in a single volley.

Nooo. 5,000 legions!  I also discover that the Drengin were also at war with the Altarians and had conquered some of their territory. Now the full force of the Drengin is on me. But I take our their resource starbases.

I send my reserves to defend Haven, my home world.

Here they come..

Harpoon III ships with Warp Drive and Duranthium armor. There is, however, the question of why aren't they using Photonic Torpedoes which they have. So it's not perfect yet.

Ouch time. I don't even destroy a single ship. I send all my fleets after them and wear them down to only 3 ships.  But it's 3 more than I have.  Haven is undefended.

From across the Dominion, I scrape up 6 ships to make into a last ditch defense. If I can cripple the Drengin fleet here, then the war will be mine because I now have a definitive industrial advantage.

Valheru station is open to attack! It helps power all the Dominion core worlds. And it's soon gone.

But my last ditch fleet is there to meet them and it's quite a battle.

I lose two ships but in the end, the Drengin fleet is crippled. But so am I.

Right about then the Arceans, who are last on the list to be wiped out, send me some ships to help!

It'll take 10 weeks for them to arrive.

The Drengin have the upper hand still in the short term.  I need to take out more of their resource starbases and get my economy back in gear.

The Drengin have 43 points in planets.  I have 46 points. But the Drengin have geared up more towards economy for a long haul strategy. My economy is not as well developed.  The one money making planet I do have is the Drengin home world but with only 140 million people on it, it's not making much money-- yet.

The Drengin knows (I can say with confidence) that I have the long term advantage if I rescale up.  So they send in their reserves to make sure that doesn't happen.  The Drengin have better logistics and their ships are better.

The Drengin attack both my main fleet and my Arcean gift fleet.  Both are destroyed. It's time to ask for peace.

I have been given a reprieve.  Clearly, it's tougher this time.

I have to give away much of the store but I have peace in our time.  Now it's time to build a new line of ships.

If I can just crank these out before the Drengin regroup.

I was once a giant, and now I have the weakest military. I have a good economy and my industry is coming back. I need to upgrade my factories.

Over the next year I do. Until the Drengin declare war on me.

This time, I'm a bit better set up.

But I still lose. The Drengin wipe out my starbases. They take Haven. There is nothing I can offer.

Kona is retaken.

Haven 2 is taken.

I max my resources and logistics to build the Liberation fleet.

Once more..

I'm not dead yet.

The Drengin now know of this fleet and begin to move forces in. I need to make up for my losses so I grab a few mor harbringers and put them together. I need to get Haven back.

Meanwhile, the Drath have had a revolution...

Welcome to the party!

Haven is liberated. Now for Haven 2.  Haven 2 is retaken.  The Drengin have figured out the source of my ships -- Iconia.  They have sent ships to "deal" with it.

The Drengin, having been militarily dominant, have focused on lots of other interesting techs such as huge hulls.  My fleet is no match. 

So what does a Drengin Dreadnought have on it?

That comes out to being a movement speed of 12! 33 attack and 21 defense. It's a monster.

Against this ship and its escort is the Liberation fleet. My best ships.  I am victorious. Luckily there was only 1 of it.  The liberation fleet also takes out the Drengin expeditionary force that has been holding down my other sector. The path is now open to retake Kona.  However, the Drengin take out Iconia while I busy elsewhere.

The Drengin now have their own mega fleet. A fleet of those Dreadnoughts. They're looking for my liberation fleet. I do my best to keep them out of their sensor range so I can keep them alive.

Here it is, the liberation fleet vs. the Drengin monster fleet.  They found me and got first shot.

Each side has 34 logistical points into this.  It's a slugging match. This is the kind of battle that the combat viewer was designed for.  I'm watching it as I type this.

I'm going to lose.

I'm going to lose badly.

Not even a single ship.  The Drengin are just too well defended now against my mass drivers. My ships can't penetrate them. I mean they're freaking Dreadnoughts after all.

But I've given them enough of a bloody nose and been at war long enough that I can talk the Drengin into peace.

I have to give up my winnings to get peace.

I'm back roughly to where I started. I have Haven back and I still have the Yor and Korx home worlds.

With upgrades to planets, I have 46 points in planets. The Drengin now have 53.  My research is ahead of theirs right now. My industry is on par with theirs.

Anyway, as you can see, things have gotten tougher. I haven't even gotten to where the players will band together to try to prevent me from conquering everyone.

That's all for tonight..

 

"
Comments (Page 3)
3 Pages1 2 3 
on Apr 18, 2006
I believe, based on previous Journals, that he specifically chose them to give the AI a hard time. If I remember correctly, the AI generally does best on Medium maps with lots of planets. By limiting the planets, extra pressure is placed on the AI, making it a better test of how well the AI is playing.


Actually the AI plays quite well on tiny maps with rare everything (imho).

Just played a suicidal game on such a configuration and got wasted in the second year when the Torians attacked with Huge hulls (42HP), 5 Armor and 21 Beam (Plasma III x 9) and 6 Move Battleships stacked in fleets of five against my crappy Medium Hull, 8 Massdriver, 3 Shield, 4 Move Frigates in Fleets at six. They had five solar systems (out of ten) and were best in everything. I had 3 Solar systems (I've invaded the Altarians and the Drengins). After they declared war on me it took them three turns two invade all but two minor planets of mine and to destroy most of my starbases and fleets.

On larger galaxies with more planets I'm usually the one who wastes them.

Main reason that larger galaxies are easier is that it evens out specials on home planets (one 700% or two 300% manufacturing tiles and you've won on smaller maps) and it makes it possible to bribe all races into war against each other, which is just not possible on smaller maps because you lack the money to do so.

You also almost have no advance warning on tiny maps when they declare war. War declaration and a turn later their ships are right in orbit around your planet..

On larger maps though you have much more time to react and to build up a fleet if nescessary, which doesn't work on smaller maps.

As for the game I've described above, needless to say that the Drath (the only other race left) declared war against me as soon as the Torians had. You know you had bad luck when not even three well upgraded and overlaping military bases help you in combat...
on Apr 18, 2006
Suralle .. theres an implication that the game was on suicidal

As one can expect, I always win this setup. But I can't beat the AI on suicidal unless
on Apr 18, 2006
I can't wait for a new update! Awesome work Brad!

I agree with the Thalans though... just don't hurt me.
on Apr 18, 2006
Can't remember the german word for it but he wanted to populate russia with germanic peoples.


The word you're looking for is "lebensraum". http://en.wikipedia.org/wiki/Lebensraum
on Apr 18, 2006
man i love these dev storys, i read them and just get sucked into the plot line. i wish you could code the game somehow to give us the same sence of epic scope that threads like these do.

"Valheru station is open to attack! It helps power all the Dominion core worlds. And it's soon gone."

my games arent nearly that exciting, generaly mine is starbases 100457 explodes because i lack a battlestation upgrade

on Apr 18, 2006
One thing I'd like to see:

Some of the AI traits, get randomly scripted from game to game: such that in some games, the Torians would act isolationist, and some they aren't...

Would add a bit of spice in every game- the main AI features would stay the same, but the trimmings would change around to fit the game.
on Apr 18, 2006
I believe, based on previous Journals, that he specifically chose them to give the AI a hard time. If I remember correctly, the AI generally does best on Medium maps with lots of planets. By limiting the planets, extra pressure is placed on the AI, making it a better test of how well the AI is playing.


Yes i do realise this, i did read the journal entry in entirety. It's because the galaxy settings were so crappy that i thought the journal entry was so good. If the AI's can perform so well under the new versions under such awful starting conditions for the AI's this is great news for every player that enjoys this game.

Perhaps i could have better worded my previous response...

I am eagerly hoping that the AI's are taking planet after planet from me in future games I would like nothing more than the AI's to give me a good challenge without having to purely rely on huge bonuses on the harder difficulty levels.

Lenius.
on Apr 18, 2006
I love these dev. journals!

Prior to your first peace treaty with the Drengin, you each had defenses against each other's weapons. Why would the Drengin accept your peace treaty in exchange for singularity drivers, unless they planned to:
(1) build fleets of ships with singularity drivers and armor
(2) redeclare war
(3) crush your fleets with singularity drivers and point defense.
on Apr 18, 2006
Wait... a cliffhanger?!???
You give us a cliffhanger...
Dude... you can't do that. There has got to be a law or something against this cruel and unusual treatment.
Now to hit refresh every 30 seconds to see if the journal has been updated.


Seriously though outstanding work. I can't wait to play against the AI that is building fleets that are 100+ in attack and well over 50+ defense. And this is on a really scaled down map. I can only imagine what it will be doing on my fav settings. Please don't make us wait one nanosecond longer then you absolutely must for this upgrade .
on Apr 19, 2006
The changes you're talking about here made it into the latest patch, correct?
on Apr 20, 2006
Thank you for this informative and entertaining look at the AI developement, it is much appreciated.

EZ

AR
on Apr 20, 2006
Me and my brother both request a follow up journal to tell us how the game ended.
on Apr 20, 2006
I say he lost, and doesn't want to admit it
on Apr 20, 2006
If I were brad I would have gone after the Drengin instead of the Yor. The drengin ALWAYS cause problems if you leave them to their own devices long enough. As soon as I'd seen they'd taken a minor world (usually a class 15) I would have been ALL over them, if for no other reason than to have that class 15 in my possession, to say nothing of the fact that they now have a military edge on par with your own, and if you let them develop that they'll make you suffer.

The Yor could wait, it didn't soundl ike they were attacking anyone and they weren't being aggressors until you parked a fleet outside their world. I'm wondering if Brad did that on purpose, giving the drengin a chance to build up that minor world they'd conquered to give him a challenge. If it wasn't intentional then it was just poor strategy. You don't always go after the weakest opponent, particularly when you have an aggressive race right on your doorstep that is building up. After taking on the Drengin the Yor would have been even easier, and once you've got a 3-1 planet advantage on the AI it's pretty much game over, unless, as is being tested here....the AI bands together to womp you.

I hope Brad manages to beat back the Drengin, because then the AI might really start climbing down his throat. He'll be massively more powerful than any of them, unless they've been on conquest wars of their own. From there I think I might just slow-play the AI until someone attacked me, take them out and then hopefuly the other AI will think I was defending myself and not being aggressive.
on Apr 20, 2006
Brad is using the same strategy I would normally use. Take on the civilizations, weakest first, and use the extra planets to catch up to the strongest computer player, who is normally way stronger than you. If you're able to project enough military power to this minor planet to take it from the Drengin, why didn't you take it over yourself?
3 Pages1 2 3