A Better AI.

cymru_man said:
Guys, you got to remember that Blake isn't releasing this as the be all and end all of AI improvements, nor as a "finished product". Each new build is just that, a new build. Of course it's rough around the edges, just feed back and make constructive comments, or if you want to wait for a finished product, do that instead.

Being a software developer I can appreciate the stability or lack thereof in a beta build. I am very surprised that if it wasn't in a solid, stable state that Firaxis incorporated it into an "official" patch. It sounds like they should have given Blake a bit more time to get a build that was more polished. Sorry Blake, I didn't realize.

As far as my knowledge goes, the changes blake made to worker improvement do not scale on difficulty level. Accordingly, your observation about prince (if true) should apply to noble too. The workers should cottage everything and outtech the player.

The couple of games I played on Noble I was outteching the AI - not by allot though. On prince I was quite a bit behind. I balanced my production, culture, and science in all the games.

I will pull Blake's updates and try a peaceful game again.

I don't mind being knocked back a skill level. I just don't want to have to play a peaceful game at Noble and a warlike game at Monarch.

The workers did seem to cottage just as much on Noble as they did on Prince.
 
It's the early game and some AI cities are defended only with 1 archer.
Ragnar has a border city of size 5 with 1 archer defending.
I think they should prioritize much on early defense (build units)
 
Craterus22 said:
I think paradox had a good idea - badboy ratings. Allow you to accumulate badboy points for doing "bad" things and allow time and "good" actions to reduce it over time...

Can't you just use the diplo modifiers to decide whether an AI is "cautious" to the player? A "pleased" AI will send his worker to chat to your warrior any day, while a "cautious" AI will have his workers treat your military units as a potential threat.

I don't like the idea that a lot of players advocate on Monarch and above that it's best to declare war and kidnap AI workers whenever the opportunity arise. That is not right. It's immoral. It's unethical. It's bad! We must stand up straight and be a gentleman! This is *civilization*, after all. :p

Of course, when someone elects to _choose unwisely_... :crazyeye:

I'm not experienced enough to see what's different. Would the AI start to make use of proven tactics and strategies? Things like a GPF, or choking the player, or sealing off borders to settle more...etc.

In short, making the AI aware of different "strategies" and actually apply one consistently.
 
Iustus said:
I suspect that there might be a problem with the easy difficulty levels in that the AIs now prioritize workers and some buildings enough that without the huge production bonuses they get on the higher difficulty levels, they are not building enough troops. This could be part of the reason why the AI seems to be attacking with smaller stacks. Some recent changes (which are not in a built download yet) should address some of this.

What this means is that once again, if you are upset that the AI is teching too fast, you need to reduce the difficulty level. The AI will not get stupider. It will just have less production and teching freebies. Those are defined in the XML, and are unchanged from 1.61 to Warlords to BetterAI.

I'm sorry to be commenting on this subject again, but this is terrible. That means on the lower difficulty levels you should conquer the AIs because it's so easy to do, while on the higher difficulty levels you also do that because you won't be able to keep up otherwise :eek:

I think Firaxis really shouldn't have released the patch with AI changes before the whole process is complete.
 
aelf said:
I'm sorry to be commenting on this subject again, but this is terrible. That means on the lower difficulty levels you should conquer the AIs because it's so easy to do, while on the higher difficulty levels you also do that because you won't be able to keep up otherwise :eek:

I think Firaxis really shouldn't have released the patch with AI changes before the whole process is complete.

AI unit priority must be increased that's sure.
Now they are too easy to conquer on Noble early.
 
Iustus said:
[...]
The difficulty setting has zero effect on the decisions the AI makes. It is just as 'smart' at settler level as deity level. The only thing that is different are the bonuses the AI gets at various levels.
[...]
Now, that isnt to say that there might be a larger difference in actual difficulty between various levels, but this is in an interaction to the bonuses and freebies.
[...]
What this means is that once again, if you are upset that the AI is teching too fast, you need to reduce the difficulty level. The AI will not get stupider. It will just have less production and teching freebies. Those are defined in the XML, and are unchanged from 1.61 to Warlords to BetterAI.
[...]

The problem is, is that these boni get exponentionally bigger / more important as time goes by. That makes each difficulty setting disproportionate from each other.

The low levels are just too easy. I consider Noble the 'normal' difficulty setting (don't know if the AI still gets any bonus here). Prince is however, much more difficult than Noble especially if you're not a war mongerer and are on a standard to large map. This also partly accounts for the situation where you are often quickly overtaken technologically at around 1600 - 1700 AD while they were far far behind you a couple of decades before.

The trouble isn't that people don't want to play below their level, but the trouble is mainly that the next step is too big. When playing on Noble you can get away with anything, if you want a peaceful win you can. But on Prince you must start war asap and knock out your main rivals before they knock you out.

A possible solution is to give the AI a bonus that either grows with time (at the easy levels) or shrinks with time (at the levels Prince and up), but only on standard maps or bigger. On small maps the bonus should not be affected by time.
 
SLM said:
Prince is however, much more difficult than Noble especially if you're not a war mongerer and are on a standard to large map. When playing on Noble you can get away with anything, if you want a peaceful win you can. But on Prince you must start war asap and knock out your main rivals before they knock you out.
This doesn't correspond with my experience. On Noble I don't think you can get away with not maintaining a good defensive force. Conversely, on Monarch (let alone Prince) you can skip war altogether (let alone doing it asap), as long as you maintain a good defensive force.

I think players (not talking about you) decide they want to have a peaceful game, or a research game, or whatever. That does not give them permission to skimp on military. The AI will come knocking, and if you don't have the military to protect yourself, then you're done. This is true on Prince as well as Noble.

I guess I build military as a matter of course, so I don't have the experience in trying to "get away with it". Someone who does that routinely will have to report on how often it works and how often they get wiped off the map.

Wodan
 
Wodan said:
[...]
I think players (not talking about you) decide they want to have a peaceful game, or a research game, or whatever. That does not give them permission to skimp on military. The AI will come knocking, and if you don't have the military to protect yourself, then you're done. This is true on Prince as well as Noble.
[...]

True, but there's a difference between a defensive force of longbowmen and a defensive force of rifleman/grenadiers. If you can't keep up with the techrace because of the exponentially big boni, your defensive force will automatically weaken.

EDIT
And besides: offense is the best defense. When you see large stacks of troops heading for your city you'd better take them down before they're at you're cityborders.
 
So... let me see where we're at.

A player can't keep up with the tech race, so the current solutions are to go for an early war to get more territory/cities (= more long term research potential), to drop skill level, or to build better infrastructure (than the AI is capable of) in the hopes of catching up.

Wodan
 
Blake said:

Excellent news! Thanks again, Blake.

It's too bad that Firaxis didn't have the time or desire or whatever to rebalance the game after including Blake's AI improvements. I can understand their reluctance to do so, given military AI improvements are in the pipeline. All in all, I'm glad they elected to include the AI improvements in the patch. It probably unbalances the game even more in favor of warmongering, but hopefully it's a temporary situation. I certainly wouldn't want to do anything to discourage or delay any AI improvements. Maybe I'll change my mind after playing a few more games with the patch.

If you can't compete now on a particular level, the only real options are to drop a level or try mucking about with the XML in an attempt to rebalance the game yourself. I would be interested in hearing about any ideas for rebalancing that could be done via XML.
 
I have just completed a win on Monach after the 2.08 patch. I was successful by essentially knocking out the other 3 civs on my continent and making vassals of them. I left them with 1 or 2 cities each. I had roughly 20 cities. In order to win I had most of the cities in the last 30 turns solely devoted to research or wealth. even with this sort of gearing I was still behind on research right up until the last 10 turns where I finally broke even with the guy in front (Saladin of course). I was able to complete my Spaceship engine and launch 2 turns before he did - roughly 1960.

Mansa (Vassaled early) had only 4 cities but essentially stayed level pegging with me on tech - so I kept asking him to research stuff I didn't have and then traded with him. This was the only way I was able to keep up.

Liberalism was discovered in 980AD and Mil tradition in 1280AD - super fast.

Taking on board other comments about speeding up the AI tech - that this has helped the latter stages of the game a little by providing more use for techs like biology. After playing this game I agree that the latter stages are improved/more intersting than previously. However the end game is still rather dull. Why would anyone want to build a supermarket/hospitals etc when most of the time health and happiness are mastered by mid 1800s.

To improve the AI is one thing, but on the other side you can also make it more difficult forthe human player. More expensive for techs. I think the whole end game needs to be looked at - it just comes down to a race at the moment. I would like to see a win possible with something like 8 cities, make them large using later techs. Gear them etc. Make some of the Spaceship Techs very expensive so that a Spaceship win is not the only way, that sometimes time just runs out. I have never been lucky enough to get a Dip win. I seems that no matter how many vassals I have ( I don't have enough with them alone), how freindly I am with other civs I can never get the one civ I need to vote for me across the line.

I'm rambling a bit - hope you all can follow.
 
Everyone seems to forget that the AI bonusses ( in the original Civ4 and Warlords) as you go up a level, are to compensate for the poor AI play style - compared to a human. Which is to be expected.

Therefore when Blake has finished his improvements to the AI. It seem natural that some of the AI bonuses should be changed.

Simply saying - go down a level is not the correct or right thing to say.

For instance I do not want to go down from Noble to Warlords (or what ever it is called) - not because of vanity (as many seem to be implying) but because I do not want the extra advantages that lower level gives me.

I do not want extra advantages for me , I want the AI advantages to be slightly reduced - to compensate for the improved AI gameplay.

So to me, the ideal would be to keep the existing play levels, but add an additional one between each existing one that slightly modified downwards the AI bonuses.

Now what is wrong with that.

Of course this balancing should only be considered, when and only when The AI tweaking has finished.

In the meantime lets all thank Blake for his work.
 
Blake said:
I have done so.

Btw I seem to recall I forgot to answer a question from you amoungst all the spam on difficulty levels...

If you wish to offer ideas on how to improve the AI, on what they should do to utilize certain game features and so on, then you are welcome to. Even if something is "obvious", I may not have thought of it.

For example two of my more recent improvements were a result of posts by a player in my original thread at poly:

Hi, Blake.

I had noticed that you used the basic idea to improve something that was first suggested by kniteowl (I'm also following your thread on Apolyton and just noticed that you started another one. Still have to read that one.). I just didn't know in how far you would like suggestions. Before the above post, there weren't many suggestions for improvement of the AI. After the above post, you seem to have gotten a lot of them. I hope that you can handle the speed of this thread. It has already grown bigger than your thread(s) on Apolyton.

When I read that you are thinking about improving the combat AI, I thought I would like to present to you my vision on the subject. I hope that it can be of use. It's going to be a lengthy post and it might be too hard to implement. It's only a vision. It's not a perfect strategy because I try to consider the 'thinking' limits of the AI.


First of all, I would like to distinguish combat tactics and combat strategy. The first is about questions like, should I attack or not (unit A vs unit B), and principles like using hills and forests when approaching an enemy city and using catapults to weaken a large enemy stack. The second is about questions like, how many units do you need need to defend your territory and how should you distribute those units over your territory, how many units should attack the enemy and how many should be left for defence, should you attack civilization A or wait for more units. The first is connected with short term problems on a small scale, the second with long term problems on a large scale. The AI at present is bad at both. My post is about combat strategy.


One of the problems with the AI combat strategy is that it keeps a lot of units in cities that don't need defence and aren't threathened. It thinks these cities need garrisons of 8 or so units (especially the capital) while the enemy is conquering a border city defended by 2 units. The AI also sends all of its non-garrison troops to attack and leaves nothing for defence (or so it seems). If you defeat the attacking AI stack(s), then you only have to deal with the few units that are being produced while you attack the AI cities. The rest of the units stay in their cities while you walk from one city to the next. I even see the AI gathering units in a city for another assault on one of my cities while I am conquering cities (you can see that if there is a fleet present to transport the assault group).

My idea is that the AI should distribute its units in three groups. City garrison units, general defence units and attack units.


-City garrison

The AI starts by calculating how many units are needed to defend a certain city, its city garrison. This should depend on elements like
-close to the border (does there exist a land tile on the same continent not of the AI's culture within 3 or 4 tiles)
-does it border on the ocean (cities bordering on the ocean are threatened by an amphibious attack)
-city size/importance

For instance:
base garrison: 1
Foreign culture within 1 tile (border directly next to the city): +5
Foreign culture within 2 tiles (only 1 tile between the city and the foreign culture): +3
Foreign culture within 3 tiles: +2
Foreign culture within 4 tiles: +1
(maybe other values for no culture tiles at the start of the game or when conquest is occuring)
City bordering on ocean: +1
(If the city is bordering on ocean and close to foreign culture, then pick largest of both values)
City size 10+ and bordering on ocean or close to foreign culture: +1
City size 15+: and bordering on ocean or close to foreign culture: +2
small wonder present and bordering on ocean or close to foreign culture: +1
great wonder that is not obsolete present and bordering on ocean or close to foreign culture: +2

These values are just a starting idea. Maybe they're a little high. At least they will not result in garrisons of 8 units in a city that is nowhere close to the enemy.

Garrison troops are just that. They should remain in the city indefinately until the borders change and less garrison troops are needed. They should only attack when chance of victory is very high (80-90%?) and the troops can return to the city (when an enemy unit is on a road, then you can attack and retreat to the city). Garrison troops should consist of typical defence units (archers, longbowmen, infantry, etc) with suitable promotions (city defence, drill)


-Defence group

Because a static defence is doomed to fail, the AI should also build a defence group. This group is not limited to a certain city, but should defend a continent (one defence group per continent). It's size should depend on the number of AI cities on the continent or maybe on the total AI population size on the continent. The units in it should be chosen so that it can be an effective counterattack force. It's promotions should vary so that it isn't a predictable force that can be exploited by the human, some combat promotions and promotions versus certain types of units and collateral damage promotions. Units should consist of cavalry type units and footsoldiers but certainly also some artillery type units to defeat attacking stacks.

A formula for the size could be something like:
1 + [pop/20] artillery type units, 2 + [pop/10] soldier type units, 1 + [pop/20] cavalry type units (pop is the sum of all of the population sizes of the AI cities on the continent). These values are again only a starting idea.

When at war, the defence group should move to a city that is being threatened and try to relieve the city of its attackers. How it performs these actions is a part of the combat tactics AI and that is another topic. Being threatened could be defined as enemy units within 2 turns of movement. If multiple cities are threatened, then the defence group should split based on proximity to the threatened cities. We don't want a defence group that keeps moving from one threatened city to the next and back again. Too easy to exploit. Also, there should be priority for a city that has enemy units within 1 turn of movement above a city that has enemy units within 2 turns of movement.

When at peace, the defence group should be distributed randomly over all of the cities that are close to the border or bordering the ocean as defined in the part about the garrisons.


-Attack Group

An AI that wants to be succesful at war should not wait until war comes to it. It cannot win when it only defends. So next to the garrison troops and the defence group, an attack group should be created that can be split in multiple attack stacks.

To surprise the defender, these attack stacks should not be fixed in size. If the human knows that the AI always attacks in groups of 10 unts, then the human can adapt too easily. If the stacks vary in size beteen 6 and 20, then it would work fairly ok, I guess. A succesful attack stack should contain a number of artillery type units, some city attackers and some generally promoted units for stack defence duty.

The AI should create units for the city attack group according to a certain distribution so that it can create good city attack stacks out of them. For instance, it should strive to get equally many artillery type units for city bombardment to city attack units for city capture and 1.5 times as many units for stack defence. For instance 4 catapults with precision upgrade (city bombardment group 4 units), 2 catapults with city attack, 2 swordsman with city attack (city attackgroup 4 units) and 3 axeman, 1 chariot, 2 spearmen with various promotions (stack defence group 6 units).

As long as the cities don't have enough garrison troops, the AI priority for units should be high and it should produce the unit types with promotions needed for that goal. As long as the defence group is incomplete, the AI priority for units should be moderate and it should produce units for the defence group with the suitable promotions. When the defence group is complete, the AI priority for troops should be light and the units should be produced that can be used in the attack group in the distribution as provided above.

When the AI gets involved in a war, then the AI priority for units should of course become high immediately. Each turn, it should check the units in the attack group, roll a number between 6 and 20 and see if there are enough units in the attack group. If there are, then it should pick a selection of these units and combine them into an attack stack. How the unit combinations in these attack stacks should be exactly is more a combat tactics discussion, but I would suggest something similar to the ratio in which the units for the attack group was produced. If after the combination of the first attack stack, there are still more than 6 units in the unassigned part of the attack group, then another number between 6 and 20 should be rolled to see if another attack stack can be created.


Ok, I tried to write this vision on a combat strategy AI in a way that it might be programmable. I don't know in how far the Civ AI can be transformed to use these ideas and if they really work as well as I hope they will. I didn't discuss ships or planes as I wanted to wait for a reaction on this major part of a combat strategy AI. And I think that the parts about ships and planes can be considered in a similar way.

I also have some ideas about other subjects that are far easier than the above, but that will have to wait until tomorrow.
 
This thread is really going to the heart of the system and is essential.

There is a warning symbol at the bottom left of each post, for reporting a bad post.

I push now a virtual button, for reporting a too good thread!!

... perhaps this thread should be STICKY status, instead of things (closed! ...) like "Sticky: Why isn't Hitler in the game? "???...
 
Hey, Blake, I found a bug that you might be interested in. To create it, end the turn three times. I'm particularly happy about this one as I'm almost positive that no one else has triggered something like this. I checked ahead of time and there weren't any cities being founded on the poles. However, as I love to betatest software that makes huge changes at once (especially my own, which I can then debug, which is almost as much fun), I figured that you probably might find something that you might have overlooked. Save below:

http://forums.civfanatics.com/uploads/32220/AutoSave_AD-1802.CivWarlordsSave


As for my inactivity for the last year, it's due to my borg-like schedule where I keep myself entertained on 21 credits at a time:borg: :cry: . Also, because of this, I lost interest in Civilizarion as I started to think too formulatically and was seeing too many patterns, making it easy. However, I've been a sucker for anything with beta, and sometimes alpha in the title, and just have to try to defeat it to report new stuff. So, don't 'spect anything until I get my masters, ok?:p By then, I might do stuff like Blake here for fun. :mischief:
 
It almost goes without saying, but I find fighting defensive wars to be far more difficult (and frustrating) than offensive wars. The reason why should be obvious: you are not the one in control. Someone else has chosen the time and place of each battle. However, once I've established a basic infrastructure (forge, granary, barracks, library) and begun to produce a standing army, when the AI declares war on me, I frequently have little trouble destroying its stack of doom. This is especially true after factories, when I can produce units seemingly much faster than the AI.

Besides telling the AI players to dogpile the human player(s), here's what I can think of to improve AI warmongering:

Rush-build Forges and Factories
Forges and factories should be very high priority. I always rush forges (through whipping) and factories (with money). I'm convinced that this is why I pull ahead so dramatically in the classical and industrial ages. I've noticed Blake's AI values production much more strongly now, but it still needs to realize the importance of having early forges and factories. They don't need to be everywhere, but that never hurts!

Safer Pathfinding
When I send my units to an AI city, I usually choose the safest route, rather than the fastest route. Perhaps there should be two pathfinding algorithms? What we've got now is the fastest route. What we need is one that will value forests and hills much more highly than open land. Use a weighted tree, perhaps.

Open Space = 2.5
Hill = 2.0
Forest = 1.0
Forested Hill = 0.5

Now, if going from open space to open space takes 20 turns, it might have a value of 50 (20 * 2.5 = 50). If there's a path that goes through 30 consecutive forests, it might have a value of 30 (30 * 1.0). Since the forest path has a lower value, it is chosen. Obviously, the values would have to be tweaked so that the AI doesn't take 500 years to send a swordsman to the frontlines.

Snipe at the enemies' Stack of Doom
I try to keep a small force of catapults behind in my core cities, so that I can damage any enemy stacks that invade. The AI rarely sends its catapults against enemy stacks. I thought that the catapult was the counter to a SoD; yet, the AI never uses it as such. Very poor programming.

Specialize the promotions
A shock axeman is more useful than a city raider axeman, generally. Especially for city defense, promotions should be limited to shock, formation, first strike, city garrison, etc. Perhaps two different kinds of builds should be done: city defense and city raiding. You could decide whether to build a defensive unit or an offensive unit, then specialize the promotion depending on how it was envisioned to be used (city raider vs shock).

Use more forts
Just kidding.
 
KingTux said:
Hey, Blake, I found a bug that you might be interested in.
What, exactly, is the bug?

Wodan
 
I don't know yet, but I think that it was probably something the AI did. Whatever they did resulted in the game crashing, even upon program relaunch. I posted it thinking that Blake might be faster than me at the moment, 'cause he probably has more experience with larger projects like this. Plus, he knows his own code better than I do, and it might take me a week or two before I've processed everything (besides, it's always easier to go through your own code, because there's always a million and one different ways to do things). However, I could do repetitions of worldbuilder over and over and see what's different each turn. As it is, I don't know exactly how the savefiles are encoded, so reverse engineering them might take longer than trying to learn the code.

Why, did you run it like I said and didn't have it crash at all? If that's the case, then maybe I could try something else. In the meantime, if I find out what could have caused it before he does, I'll let Blake know.
 
Have you guys noticed that the AI often founds new cities during wartime? :lol: Ecspecially just a few turns after you declare war on them.

If there were a routine that told the AI not to found a city within X turns of someone declaring war on them, I think that would be helpful. X could be 5, 7, or 10, not sure what is best.

It just seems like it is never a good idea to found a city within 5 turns of someone declaring war on you.:crazyeye:
 
From what I saw, it's quite... strange. You can save it after opening the worldbuilder and get rid of the bug, but it still crashes. On the turn that it's crashing, I've just researched Assembly Line, so it's likely not something I did. Will do some further digging.

EDIT:

Bagh! It's just another incident of the AI founding a city on the pole. Screenshot as proof:

Spoiler :
bug-1.jpg


For a while, though, I was certain that I had something new... Guess I was a little trigger happy.
 
Back
Top Bottom