Greetings!
I've created a new sub-forum here dedicated to talking about GalCiv III AI. Because of our forum system, active posts here will float up to the top so you can see this post from the main forum too.
A big welcome to GalCiv III fans or future AI game developers!
## AI Background ##
GalCiv III is the first of the GalCiv games where I didn't write the initial AI for. This has turned out to be a good thing, something that we will all benefit from for years. But in this section, we'll talk about what this means.
Unlike the previous GalCiv AI's, this one is data driven. That means most of its intelligence is derived from XML files in the game directory. The team implemented the AI as a huge library of APIs that use this data and make very simple decisions with it. Because the game is 64-bit and because each AI player gets its own thread, there is a huge amount of built in potential to do some amazing stuff.
In late March of 2015, I finished up my main work on Sorcerer King and began to look at the AI for GalCiv III. The primary strengths in the AI are what I just described. However, it has some weaknesses too which revolve mostly around not being very good at PLAYING the game.
To use the Chess metaphor, the GalCiv III AI at the 0.80 level (March 2015) knew how to play the game. It just didn't know how to play it well yet. That's where I came in. My pre-release work consisted on making the AI more skilled in playing actual humans.
If I were to rate the GalCiv AIs over the years, and this rating changes a bit based on how I"m feeling that day I'd rate them as follows where 1 is brain dead and 10 is the absolute best AI a game can have.
GalCiv OS/2: 8
GalCiv I for Windows: 7
GalCiv II: Dread Lords: 6
GalCiv II: Dark Avatar: 8
GalCiv II: Twilight 7
GalCiv III: 1.0: 6
## AI Expectations ##
Anyone who has had to deal with me on forums knows that I have very limited patience for arm-chair AI designers. I'm old and cranky. If you're participating in these discussions, here are a few ground rules you need to understand:
1. Nearly all players play at either beginner or easy. And by nearly all, I mean 90%. This has always been the case and will always be the case. So feedback or suggestions that involve affecting those players negatively or spending a vastly disproportional sum of money and time on some AI idea just isn't helpful
2. Unless you've programmed AI, feedback suggesting new APIs isn't really helpful. Every AI discussion always has people suggesting things like "The AI should be able to detect threats" or "The AI needs to build better fleets" or "The AI should reinforce planets that are endangered" as if these features weren't in the game before I showed up. That's the most basic stuff. The aI fails to do those things because something else happened and our job is to figure out what happened that kept it from doing those things.
3. Extreme exploits aren't going to be fixed. Most people who win the game are taking advantage of some level of exploit. That is fine and we can, on a case by case basis, determine which ones we should address. I tend to fix exploits that are too tempting to ignore. If the AI is making bad trades, for instance, that's something that should be fixed. But if someone has figured out that they can kite some unit in tactical battle for 45 minutes doing 1 damage per turn until the monster is dead I"m not going to fix that kind of thing. Kite away, my friend.
4. My near time objective is to get the GalCiv III AI up to a 7 and later an 8. It is extremely unlikely I'll be able to get it to a 9 on my arbitrary scale because it's not commercially viable and I've never seen a game reach anywhere close to a 9 and only one commercial strategy game has reached an 8 besides Dark Avatar. Most PC strategy games are less than a 6 and provide their challenge through actual cheating AI which is much cheaper and often more fun for players anyway.
5. Understand what cheating really is. If you get a handicap at bowling or golf you are not cheating. If you get to walk up and kick down the pins you are. People throw around the term "Cheating" so lazily now that it's having a negative impact on the incentive to actually make good AI. The AI in GalCiv does't cheat with 1 exception: On the higher difficulties it doesn't have FOW (and even that is something I'm looking to get rid of). Giving an AI a handicap (i.e. every credit it makes is matched by another 0.25 credits) is not cheating, it's a handicap. If the community ever reached a consensus that giving the AI a handicap is cheating AND felt the AI was dumb then it would make more sense to just have the AI actually cheat (i.e. just give the AI whatever units, weapons, techs, etc. it needed based on the difficulty level, much easier to code).
## AI Weaknesses in 1.0 ##
The biggest problem I'm dealing with in the 0.80 to 1.03 AI of GalCiv III is that all its thinking is empire wide. I cannot control spending on a per planet basis. I do not have access the shipyard building a ship. I am making decisions for an empire without any local knowledge. As a result, the bigger the map, the weaker the AI gets.
The second biggest issue is related and has to do with the ships. The AI doesn't currently have access to the ships in a way that lets me work with them based on on their location. I've alw2ays written the AIs in GalCiv as a gamer and less as a programmer. So, in my mind, I always thought of fleets as having a geographical duty. That isn't the case in GalCiv. As a reuslt, it has a lot tougher time coordinating ships into coherent local "Stuff. The bigger the map, the worse it gets.
Now, before someone says "How can you have crazy sized maps and an AI that can't 'handle' it" I'll bring you back to expectation #1. The AI handles it just fine for nearly all players. It's for people who are really good at strategy games that can overcome this and it's not an all or nothing thing (The AI, with enough handicaps, can overcome this weakness).
Nearly every weakness in the 1.0 AI boils down to a lack of local awareness (that is, letting planets, ships, shipyards, think locally instead of globally). The AI would do great as a federal politician...
## Rolling up our sleeves ##
I have a bunch of low hanging fruit that I intend to address in GalCiv 1.1, 1.2, and 1.3. Let's talk about those first:
1. Eliminate the AI's all seeing FOW vision. This will actually make the AI substantially smarter on bigger maps. This seems counter intuitive until you see the weaknesses I pointed out. It's better for the AI to only "see" stuff that actually matters so that it's not sending ships across the map or building starbases where it has no business doing so.
2. Making the AI more aware of ZOC. Remember, the AI gets annoyed when units and starbases are in its ZOC. The AI makes no distinction between meat and silicon. As a result, the AI often ends up with war with each other because of this which reduces the AI's focused strength.
3. Pre-war build up. This is something I'll be working with the Civ IV and Civ V AI developers on. This is something they're good at that I haven't done as much on. So I'll be implementing some of those systems (not source code of course, I'm just going to talk to them about it) into the AI.
4. Localized tactics. This will be a major bit of work but we will start dividing up the galaxy into theaters and have the AI start thinking of its empire and strategically vital interests as theaters rather than the current system which defines 2 theaters: Theater of focus (where it is concentrating its forces) and everything else.
## How you can help ##
Helpful: Telling me dumb things you saw the AI do that made you able to beat it is helpful. Very helpful in fact. Any mistake that would allow you to win regardless of the handicap.
Not helpful: Things that could be addressed just as easily with a handicap. The AI doesn't build up its planets well. This is on our list. But it's actually not that important since that can be addressed with handicaps.
Really helpful: Saved LATE games with descriptions of what you are seeing. Maybe the AI isn't defending its planets well. Maybe it's sending out crappy fleets. Maybe its fallen way behind militarily. Maybe its ships are crappy. These are things that I'm interested in.
Thanks all and cheers!
This issue is currently the AI's main weakness when it comes to fighting wars. It is simply not capable of adapting right now, because it doesn't have ship blueprints with different defenses that it could use to adapt.
While we could easily mod in blueprints that allow that (relatively easy, it would be quite a lot of work, just not difficult work), I don't know if the AI is capable of recognizing that it needs to make vessels which counter your weapon/defense combos, so it might be for nothing.
Are you sure the AI doesn`t make weapons to counter yours or am I understanding wrong?
In my game, if I make missiles, it won`t be long before the AI comes out with ecm missile contermeasures that zap my missiles before they can do anything.
The only ship designs the AI which have strong ECM are ships which themselves have missiles as primary weapons. For the rest, defense techs are added to designs on an 'as they fit' basis, based on newly researched techs, not on what opponents do.
While it's possible the AI is coded to respond to what you're fielding against it by fielding ships with particular defenses, I've never seen the AI adapt a ship design.
If I may chuck my 2c:
I think the absolute first priority of making singleplayer interesting (crucial for a game like GalCiv3) in strategy games, is to make the AI Fun to play against. I cannot stress that enough. I realise there are criticisms of the Civ5 AI, but I also think one thing Firaxis did pretty well was give the AI's a sense of personality in most layers of the gameplay. With the matches of GalCiv3 I have played, I think there is a bit of that going on, but could be improved. I will add, though, that I feel like I haven't played enough and still don't understand the game fully. As has been stated here, the AI's ability to execute moves on a local basis is hamstrung and I have definitely noticed that. I'm convinced that once the AI is capable of accounting for localised variables, it will become much more interesting to play against, even at low difficulties.
Also, I happen to think having a space Ghandi would be pretty freakin' cool.
What I really hate, and has ruined the re-playability of previous strategy games for me, are things that would likely be described as cheating/gratuitous handicaps. My best example is Star Wars: Empire at War, where the strategic layer of the game had some really cool, 4x-lite ideas. However, you would quickly find that careful manoeuvring of strategic assets and fleets would become extremely dull and repetitive when you discovered that the huge stack of death that you fended off would automatically spawn over the world it came from, and the AI would auto-spawn stacks of buildings and units on worlds it just conquered. This made the game a complete grind, and is a pretty gratuitous example of how to quickly kill off interest in future re-playability. I don't have a problem with giving an AI handicaps, but that has to come with interesting behaviours that are fun and satisfying to play against as well as avoiding the perception that AI doesn't adhere a cheesy different rule-set. I really hate that.
I followed the development of GalCiv3 and picked it up at around launch in large part because of what the devs hoped to achieve with AI. Making it interesting and fun to play against and that the AI would be capable of 'learning' through collecting player data. Honestly, I think at this stage in GalCiv3' life cycle and hearing that it has had a very successful launch, I think the AI is definitely above average and I am looking forward to seeing future improvements.
Yes, playing challenging. I think I've peaked my difficulty level, until AI gets its FOW turned off. Krynn and other AIs just have a huge advantage, not having to SEARCH for planets. I play pragmatic or benevolent, so I dont do of the major colony spamming that peeps do on goldlike with malevolent.
Yeah. I had the Krynn and Iconians waltzing warships and constructors throughout my ZoC (another thing that annoys me), colonizing worlds and capping resources they hadn't actually scouted.
I know it's getting updated, but it feels really silly having your AI opponents getting pissy with you for having ships in their ZoC, but they would constantly waltz through your borders with the middle-finger raised. Last game I played, I just got so annoyed with them that I went about killing all of them off like house pests... Not even a Drengin.
I haven't played GC3 at all. I have, however, spent dozens if not hundreds of hours observing the AI behavior in GC2 during the course of creating and testing my Tech Tree Fix mod for Twilight. From what I've read, it sounds like some of the same problems are still plaguing the game.
For all the heat marigoldran is getting for the tone of his posts (which I have no problem with), he makes some of the best comments on strategic-level AI that I've seen. Some of his points are things that I've been thinking for a long time with regards to GC2. Particularly the idea that the AI should ideally work against the strong players -AI and human alike - rather than simply going after the weak. As part of the long process of testing my mod, I watched the AI play out hundreds of games. The same pattern kept repeating over and over: after the initial struggles, when the balance of power was fairly well established, it became a cycle of everyone ganging up on the weakest player until they were gone, then ganging up on the next weakest player, etc. The strongest player in the mid-game was virtually never knocked out of the top spot and eventually won the game every time. The same thing happens if the human is active in the game - once the human is on top, finishing up the game is mere formality due to the simplistic AI tendency to kowtow to the strong and prey on the weak. Of course we all remember those messages from the weak AIs exhorting us to resist the strongest AI, but they were empty messages. What those messages needed was some action or proposal to really work against the strong AI.
The secret diplomatic modifiers are, in my opinion, a brilliant suggestion. They should not only be secret, but independent of other modifiers and your visible relationship. What I mean is that a certain race may be friendly with you on account of trade routes or other things, but may secretly consider you a threat and be open to working against you with others. Or, two races may be unfriendly due to ideology or whatnot, but could actually be amenable to treaties or even an alliance in the face of a common enemy. If you're the strong one, they may be friendly with you, too; but that shouldn't stand in the way of them deciding to bite a chunk out of your empire if you get embroiled in conflict and send your fleets half a galaxy away. Maybe they'd even (gasp) make an alliance with your enemies.
Could such a thing be worked out? I dunno. I'm just an armchair AI designer with dreams of the ideal game. I think, though, that it's the biggest and most important challenge after getting the AI to actually play a decent game.
In my latest game, I ended up being the aggressor, but I knew they were going to DOW me, so I did a pre-emptive attack (no, it was like I surrounded planets first, I just DOWed first). Thought I was weak, so I ramped up my military very quick. The AI didnt even have a lot of ships to try to figure out what they were in love with. Well, their first ships that were "new" designs were in fact designed to counter mine. Well played AI. This may have happened simply because I was the aggressor, and built A TRUE war fleet first. Perhaps they countered me. Thats the key, is that human and AI need to both "continue" to evolve.
In my previous post, the Yor simply NEVER adapted. Several hundred missile boats over a few hundred turns. They never had many defenses for my energy beam weapons, and continued to use Missiles even though I ONLY had missile defense on my ships. Now Yor did have hundreds of ships compared to my 30 or so. It might have been the AI just needed to "try" to use them and get killed before making any new ships (it did not "swarm" me with even half its ships). Yes, refit is too expensive, but at some point you need to realize that what you have is WORTHLESS and either scrap or refit. Sending them into the slaughter doesnt do much good, if you have historical info that this has been happening the last 100 turns.
I've seen the same thing when testing in soaks, there is invariably a strong AI who simply gets ignored, while mid-level ones pick off the even weaker members.
I'd really like to see a diplomatic modifier which kicks in once the top empire has ~50% higher power than its next rival, which improves relationships between other factions and prompts them to seek "please go to war with X" deals. The 'we have a common foe' modifier could also be a bit more potent.
I've seen the same thing when testing in soaks, there is invariably a strong AI who simply gets ignored, while mid-level ones pick off the even weaker members. I'd really like to see a diplomatic modifier which kicks in once the top empire has ~50% higher power than its next rival, which improves relationships between other factions and prompts them to seek "please go to war with X" deals. The 'we have a common foe' modifier could also be a bit more potent.
I would rather see something like it has 2x the portion of the total score for remaining factions.
So if there are 10 factions with a total score of 1000, then any faction of 200+ would get a negative (200/(1000/10)) = 2x and it would escalate from there.
This kind of thing is why I don`t go onto the forums if I`m enjoying a game. Now that I know the AI doesn`t have to search for planets, it`s not so fun any more. There is some truth in ignorance is bliss. I really should have learned this by now.
To be fair, the way the AI colonizes planets works somewhat like it's finding them (it appears to prioritize those it has 'seen'). Its... kinda opaque and I haven't figured out the mechanism yet, but it doesn't rush out colonizers to all planets everywhere on the map as if it knows where they are.
Remember, this is a game, and it needs to be fun. It needs to work as a game more than it needs to work as a simulation of international diplomacy.
What you described (AI saying one thing, and then doing the opposite) is not fun, unless the player has some way telling when the AI is lying. Civ5 vanilla (at release) actually tried what you're suggesting, and players found it very frustrating: they didn't interpret it as a "clever AI that was capable of lying", the interpreted it as "broken random psychopathic AI that was incapable of acting peacefully/forming reliable agreements" and so had to be treated as implacably hostile regardless of apparent posture. This removes choices from the game, and so makes it less fun. In the end, Civ went back to making the diplomacy more transparent.
There is a possible way around this. What you're suggesting isn't necessarily fatal if the player has ways to discover when the AI is telling the truth and when it is lying (e.g., an espionage system). Then we're back to expanding player choices again (Do I invest in espionage on my friends to watch out for backstabbers, or on my foes to sabotage their production?), and more choices = more fun, at least if the choices are meaningful. Nonetheless, given the negative player response to "lying AI" when implemented in CiV, I would be wary of trying to implement it ("but better") in GalCivIII.
[...]The hug difference is that my customers don't expect that when they hit "Turn" that they get all the answers and get to "keep playing" in one minute. We get hours to perform our processing.
Frogboy, could you please confirm or deny the assumption above that CPU cycles is a limiting factor?
With computer chess opponents, for example, you can simply set the search-depth to N+1 to get a more challenging game, but computational cost increases exponentially with every extra move ahead the AI is asked to plan. Does the GalCiv3 AI engine have this property, or does it simply lack things to do that are computationally expensive compared with available time? (I know map size increases computational cost, but do you have ways to "think harder"?).
I would like to suggest that this is an important issue. What you asked for in your original post is, frankly, bug reports. That's great, and I welcome the clarity in what would constitute a useful bug report on the AI subsystem, but that's only one part of improving the AI. There's also the question of higher-level design issues.
Incidentally, I play on Challenging and find it a challenge. That probably puts me above much of the player base, but below the skill of most forum jockeys. But I can certainly discern AI behaviour that 'undermines' the feeling of the game for me even at this level: for example, an AI that adapted more flexibly in its ship design (building shields and dropping armour when I've got beams) would feel much smarter than one that simply has a better production bonus.
You said that 90% of players play on Normal or below. Firstly, if that's the maths then thank you for even bothering to engage with the rest of us. That figure demonstrates how vastly unrepresentative the forums are of the player base. Having said that, forum players are your biggest fans and advocates. So one of the things you need is ways to improve what forum players perceive as good strategy which are cheap to implement (in terms of your own investment). This is why I'm asking about CPU cycles.
I'm going to go out on a limb and speculate that while most players play on Normal or Easy, most players also have modest CPUs, but the forum jockeys, as well as playing on higher difficulty modes, also tend to have more powerful CPUs. And if they don't, they would be willing to upgrade if you give them a reason to do so.
Most players don't just play on Normal or Easy; they also have crappy graphics cards. But the biggest fans have ninja cards. That's a way of transferring the cost of good graphics from expensive-to-dev-but-cheap-to-customer to cheap-for-dev-but-expensive-for-customer. The archetypal example is anti-aliasing: really quite cheap to implement (at least compared to creating another tier of high-res textures) but very computationally expensive. So players can be told "if you want better graphics than X, go buy a better gfx card and turn the settings up to 11". Most players don't; but the biggest fans spend $1000 on a gfx card, and wax lyrical about how Crysis is the best ever...
What you want to be looking for is a way to make the same commercial dynamic work for you in the AI subsystem. Also, you've got Moore's Law working for you: what may have seemed expensive at launch quickly becomes normal.
So we're looking for techniques that are easy to implement and give a noticable change to how the AI feels, even if the cost is more computationally expensive than you previously thought feasible (within reason).
Let me suggest a couple of ways this approach could result in a change to the feel of the game, for the better:
* you could split the CPU-cycle budgets between the AI unevenly. So (for example) Drengin could be given a low CPU-cycle budget, but a big positive handicap in production, and they will feel like a big dumb juggenaught; other races the opposite
* you could open up new decision subsystems that are computationally costly but allow more sophisticated player interaction. For example, instead of just weighting tech value for trade by research point cost, have each opponent calculate their current build-order, and weight value by how far a tech helps them reach the end - or calculate current and alternative build-order strategies, and weight by whether this allows a new strategy.
Of course, if only 10% of the player base is using these, then you're not going to want to invest heavily: but again, I suggest, implementing without optimising is OK for 10%; just ask them to throw money/CPU at the problem.
Anyway, I don't know if it is feasible to trade off better perceived AI for a requirement for faster CPUs. The main point of this post is to prompt that line of enquiry, and to suggest that both for the satisfaction on your fans, and for efficient use of your own limited resources, it would be a good idea to assume that there is a good correlation between the most demanding customers and those who are willing to buy CPU power if you can find ways to use it.
I don't think it is off-topic to comment on how the use of development resources might be influenced by consideration of the level of play of the player base. Clearly the number of good players working this forum is much higher than in general, and those individuals recognize the deficiencies in the AI much quicker than the average player (if the average player even notices, in many cases). But it does not follow, in my opinion at lease, that the use of developer time be targeted at the average player when considering AI, with the idea that some deficiencies of the AI won't be noticed by most players, so why bother.
I can give my own experience. I was a better than average amateur chess player. But I spent a lot of time reading about grandmaster strategy, and if their opinion on a given opening was bad, I avoided such lines even though at my level it probably didn't matter, and might even have been an advantage because my amateur opponents wouldn't expect it. In Civ 4 BTS I was a Noble player who kept (and keeps) trying to figure out how to win on Prince. Again I would listen to the top players and their play throughs. But the real point here is that if I saw comments by these players that bemoaned some aspect of the AI of the game I paid close attention.
And this leads on to my consideration of other games. If I see respected players downplaying the AI it influences my interest in the game, even though I will never be playing at their level. I put off buying Civ5 for a long time because the initial opinions of respected Civ players was very negative, not only about 1UPT but also about the AI's poor play I remember one play through in which a noted Civ4 player showed how to run rampant with a simple minded strategy, partly because the AI didn't know how to counter. Along about BNW release the opinion seemed to improve and the let's plays from Marbozir, etc., gave the impression that things were improved so that experts could enjoy the game. That changed my decision on buying.
So I understand that this forum is a small slice of the players of GC3. But getting the good players to have a positive view of the AI in the game is critical. And furthermore, it is a very good policy to follow the let's plays and streams of people like Marbozir, Quill18, Arumba, and others. These guys pick up on what makes sense and what is fun really fast. And there are a lot of people that watch their let's plays before making a buying decision.
I don't think I am saying anything the developers aren't aware of. Of course sometimes the experts will focus on something highly esoteric which isn't worth the investment to follow up. But I think their opinions are the best starting point. Not that the average guys should be ignored; heck, if I notice something wrong, (like my post in which I described how an orbiting AI fleet neglected to come out and kill an undefended transport I had left by mistake) then that's a serious issue.
The biggest problem is to figure out who the real experts are, and who are talking like experts but through their hat, and who think that just posting again and again will somehow have an impact. I have opinions but I have tried to not pretend I am a genius at GC3. Hopefully no one will mistake me for Marbozir, heck, I don't even have the right accent.
I remember reading a long time ago that the developers expected that when the game was released that it would be the good players that found the exploits, the poor AI play, and so forth the most quickly. That's the right focus, and putting effort toward improving those situations I believe in general makes good sense, even if I don't necessarily see the problems in my own games. (FYI I am playing at challenging at the moment).
I would like to see the number of players per difficulty and how much TIME they play. I would guess a large portion of players who play at normal or below also play less overall time than those at higher levels. The higher level players are also probably veterans, play larger maps and play longer. It would be a good stat(s) to know.
Second that. Add in a feature that collects gameplay statistics on players through steam.
And turn the game into a stat padding excerise? No thanks. I know stardock gets ALL the stats they need already, and thats whats important.
## How you can help ##Helpful: Telling me dumb things you saw the AI do that made you able to beat it is helpful. Very helpful in fact. Any mistake that would allow you to win regardless of the handicap.Not helpful: Things that could be addressed just as easily with a handicap. The AI doesn't build up its planets well. This is on our list. But it's actually not that important since that can be addressed with handicaps. Really helpful: Saved LATE games with descriptions of what you are seeing. Maybe the AI isn't defending its planets well. Maybe it's sending out crappy fleets. Maybe its fallen way behind militarily. Maybe its ships are crappy. These are things that I'm interested in.
Within the context of these ground rules, I'd like to re-frame some of the suggestions I've made previously (also previously provided a bunch of save games). In particular, to understand which are too tempting to ignore, and dumb AI allowing a player to win regardless.
We'll start with one which Brad has already indicated is on the radar, in the interests of getting off to a good start. Specifically, the AI for the Precursor Worlds DLC did not have the capability to explore Precursor Artifacts, nor does the AI adequately prioritise the extremely powerful Precursor Worlds either in colonisation or war. Clearly, it's in the too tempting to ignore category, and also represents dumb AI behaviour.
Another important issue is that the AI does not adequately stack components. As a result I'll always have faster ships and late game run rings around the AI, wiping out empires in a turn. Again, this is too tempting to ignore due to the magnitude of the benefits and represents dumb AI behaviour, comparatively.
The Bureau of Labour is too tempting to ignore given the benefits to overall empire output (and even with 1.6 and the Coercion changes, the benefit of 50/50 variations remain huge).
The final one is exploiting diplomacy. It's way, way too tempting to ignore. As I've shown in the strategy guide thread, even with a variety of massive handicaps on the human player, it's too easy to win anyway.
https://forums.galciv3.com/475253/page/1/#3619763
Looking at the dates of the last two posts, this seems to be a thread that was dead, so I'm not sure if replying to it will have any value.
My AI programming is very limited. I am not a programmer, and do not have a background in programming. But I have programmed AI for NWN for many years, if that lends me any credibility. And I am a frequent player/modder of Civ III if that, too, will lend me any credibility.
Off the top, I'm really quite happy with where GC3 stands right now, my opinion including the map editor and AI. I more fear downgrades from added content than I look forward to upgrades. Does the AI make bad decisions about where it places improvements on planets? Yea, but not game breaking. Particularly not game breaking at the 90% levels I imagine, although I've never played them. So what then is the AI discussion really about?
Firstly, you, Frogboy I mean, are hesitant to use cheats to give the illusion of a stronger AI. Secondly, it seems the desire for improved AI is to make the AI into a tougher opponent and to prevent the AI from taking actions that are just patently foolish to most players. Okay, we have our goals.
Now we need our perspective. From what perspective will we be regarding our efforts and determining whether or not our efforts have pushed us closer to success? From the player's? Or from the designer's? My experience in NWN has taught me that the best mods are mods that DO NOT give the player everything the player wants, mostly because the players are of the type that want immediate satisfaction and don't realize that too much immediate satisfaction actually breaks down those elements of the game that make it fun - namely challenge/reward. However, that particular of the discussion seems almost irrelevant here, because both the developer and the players want the same thing: an AI that models as much as possible the behavior of the best players. Or at least creates the illusion of doing so while having a similar result.
So, keeping the goals and perspective in mind, I thought to myself, 'how would I go about doing this?' In order to answer that, I first had to break down my gameplay. Immediately I saw the first hurdle - my gameplay never changes. The only element that would change my gameplay in a significant way is the layout of the map, more specifically, the answer to the question - how close is my nearest opponent?
Aaah, but there is second major factor that SHOULD impact my gameplay, but actually doesn't, and I have almost fallen into a trap. That is because I don't play with any victory conditions. My ideal game is an unending one. For most people, and most certainly the AI, victory conditions are going to determine gameplay. Some players let their path to victory evolve as the game goes on, some decide what victory condition to aim for based on the map, and some predetermine the victory they are after before the map has been loaded.
So on turn 1, since we can equate gameplay to strategy, the AI should of course already have a desired victory condition. To do this, the AI needs a way of assigning values to the map, and determining which type of victory condition may be best. If it were me, since we do not want an AI faction playing the game without a chosen victory condition, I would also program in an equation that could at some point inform the AI that its chosen victory condition is not going to work, and it needs to pick a new one. That equation is not only important in its existence, but in its timing as well. If that equation is already coded into the AI, then simply re-timing it so that the AI changes strategies sooner will go a long way towards making the AI more challenging and realistic. And, again, if it were me, I would include 2 variables for that timer: a relatively small random one, and a relatively large one based on the personality of the faction. Smarter factions, and higher difficulty levels for that matter, are going to change strategies sooner.
I personally also think that the chosen victory condition should be affected by the faction's traits and personality.
Now, once the faction has chosen its victory condition (VC), how will it achieve that goal? It should never, never put 100% of its resources into it. A player never would. So how much? Again, it depends on the map, and the largest factor is the projected power of other factions. Military power firstly, but as a fairly decent player, once I have determined that I am not in range of an invasion, the largest 'fear' factor for me is not military, but tech. I am far more concerned about other civs being ahead in techs than I am about being in last place with military strength. What should be a significant factor, but rarely is, is whether or not I am behind in colonies. THAT indicates to me that ALL of the AIs need to be expanding faster. So... military, tech, and expansion. Of the three, its pretty clear right now that the AI focuses on military the most, and that should not be the case, because a strong military is the weakest asset of the three to have, until enemy warships are in your ZOC. So, regardless of VC, I would reprogram the AI to focus less on military and more on techs and expansion.
Before continuing, I point out that strategy and tactics are two entirely different things, as Frogboy has noted as well.
I am not saying I would program the AI to ignore military. But investing so much into a pretty crappy military early on has a huge opportunity cost from which no recovery is possible. With the exception of range. If I were playing a human opponent, and we both started out in the same cluster or near enough, the first thing I would research is military invasion and rudimentary weapons. If no other faction is in range, I wouldn't research military for quite some time. So obviously range needs to programmed in as a factor regarding how many resources to put into military build up.
And yet, a malevolent faction with a conquest VC SHOULD pursue a strong military. The secondary problem comes in when they have the armada, but no range. So somewhere there needs to be a line or two of code that tells them to build some constructors to close the distance between themselves and their chosen victim ASAP. Otherwise they are "all dressed up with no place to go." Somebody posted above that they hate it when they see AI constructors that have traversed half the map, it doesn't seem realistic, and so forth. I beg to differ. Sending out constructors is an action that the AI rarely does, and this gives humans a HUGE advantage. I start sending out constructors very early on, and even before my expansion stage ends, on an insane map, I can target any other faction in the galaxy, and take any resource I want. And trade with anyone.
So I would also program in constructor behavior, again with a random factor and personality check, and let fly the constructors across the galaxy.
Another strategic factor is the use of credits. Aside from the beginning of the game, where I rush maybe a factory or two, and colony ships, the only thing I use credits for is buying techs. I don't start upgrading survey vessels until I have upwards of 50k credits, or so. It is rare rare rare that I upgrade a military ship. Why not upgrade military ships? Its easier to produce them, the cost-benefit ratio doesn't pan out. So why does the AI upgrade so often (and as someone said, particularly when an enemy fleet is so close?)
So I would prevent the AI from upgrading military ships except under very unusual circumstances, or at least have a more common sense equation involved, one that included distance from nearest shipyard, turns to build a new ship, and distance to nearest opponent. Then the AI could use all of those credits to purchase techs.
Another strategic factor is diplomacy - as, again, was already pointed out, or asked, why doesn't the AI lie more? In my current game, my traditional nemesis (Svarri Empire, portrayed by the Aliens, from the movie of the same name) are the highest ranking military, and we are mutually out of range. But their diplomatic communications and report all point to them wanting to eat my face. So, naturally, I vamp up my military strength, send out constructors, and in short order I will be decimating their fleets. I feel this topic was covered in the diplomacy thread enough to warrant not going into more detail on hit here, but it should be pointed as a factor in regards to strategy.
The final grand factor is expansion. Unless there is a military threat in range, the AI should be colonizing as much and as fast as possible until it no longer can. Again, constructors are needed for this.
So, aside from the initial determinations, what else impacts my gameplay (or would, if I played with a typical style)? The fact that I can pretty much count on the AI to do exactly what I expect it to do. The moment the AI becomes predictable to the player is the moment that the AI (should) have no chance against the player. Players can plan in advance (discussed), change plans more quickly (discussed), react, and know what to expect. Reaction can be programmed in (discussed a little), but the AI can never be taught to know what to expect, not really. Situations can be programmed in (and I suppose true AI is going to be able to learn as it goes), but on either a strategic or tactical level, the player has a huge advantage here. And this is where most of the programming needs to be done. Sigh. So what would I do, if it were me?
The first thing I would do is revisit the initial VC, and program in secondary and tertiary VCs, and have the AI working towards them as well, albeit with less focus. If the time comes that the AI needs to change its goal, it shouldn't be starting from scratch. In addition to giving the AI a stronger chance of success, this would also create a chance for the AI to be acting tactically in ways that could catch the player off guard, and force the player to reallocate resources, which would then also be slowing down the player's rate of strength gain in comparison to all other factions in the game.
Secondly, I would try to program in possible tactics for both the AI and the player (which I'm sure has been done). For player tactics, when the AI recognizes them, the AI acts/reacts accordingly. For AI tactics, the AI will pursue them not to the point of defeat, but to the point of LIKELY DEFEAT. Big difference. And where the AI action overlaps the AI reaction, I would have the AI dedicate more resources to that overlap because it is more efficient. Which should only be a matter of checking two variables instead of one.
I think that is a pretty good start for strategy AI. In sum: don't put let the AI put all of its eggs into one basket, and account more for range in AI decisions.
Tactics is something else entirely.
On tactics:
I don't know if will actually post this reply. From a programming perspective, tactics is more about making a list of specific things the AI should do and could do. Ironically, though, while I am unsure whether I will post this, I think its more what Frogboy is looking for than a discussion of strategy.
Maybe a new thread simply called "Tactics" should be started where people can list tactics they use, or bad AI tactics.
One thing that comes to mind right off, as I mentioned above, is the use of constructors. The AI only seems to use them for resources or planetary bonuses, not for expanding range.
Hmm, maybe I'll go ahead and start that thread.
My point is, there are numerous suggestions various people have made that actually meet Frogboy's criteria which have not yet been actioned. I'd like to suggest they are considered for the future.
Lots of posts here so not sure if it's been mentioned, but
AI Declares war when it's not even near you.
Often I get declared on war from Civilizations which I can't even find on the map, which means they are at least more than one civilization away from my border.
Yesterday I had a game where two civilizations declared on me and I could not find them. One civilization I found and they were two(2) civs between my civ and the attacking civ. Later (read after I defeated the other civ) I found the other civ and there were 3 civs still between us and was more than 150 hexes away to their border, let alone starbase or planet/shipyard.
I assume the AI probably spent resources trying to deal with me and could never reach me with the exception of a long range scout.
So my suggestion (which should be a fairly simple check) would be an AI civ should never declare war on another civ which is not within a certain striking range. Take their average war ship (or life support level) and double/triple that range (assume dropping two starbases inbetween) to get to the civ they declared war on. In later games if they have life support researched that range will clearly inclrease, but if they are not spending science to increase life support they can't hope to reach me, yet I can easily build up my fleet, then drop a few bases on the way and take over a planet. Once that's done I usually would have enough defense to protect that planet, so it's a lost cause for them.
As you mentioned I guess you could just give all AI an handicap of lifesupport range, but why have it in the first place if all AI needs it, giving them more scienes does not mean they will research life support so no help there. It would be simpler to just reduce how far a way a civ can be before it's too far to declare war on.
Another thought I was just thinking , which should be a fairly easy check is to check "Alliances".
Now I am not talking about formal alliances but rather the diplomacy level of target civ and other civs to them.
For example, if civX wants to attack me, it should be able to check how many other civs I am on a "Good" basis with, then determined by their level of power and my level of power (and some possible ratio of friend civs) determine if attacking me is a good idea.
The reason I mention this is i civX declares war on me and I am friendly with 3-5 civs which know him, then I can easily talk(read trade) my friendly civs to declare war on them as well, which will then take away a lot of resources from them keeping them occupied. This is how I often deal with enemy civs which I don't want to deal with at the moment(just sick the dogs on them).
From a code point:
If civX has "A" military power, and I have "B" military power and also have 3 friends, which can declare war on them, then 10% of their military power gets added to mine ("B"), if mine is more than "C"% of their military power they won't declare war on me. otherwise I can simply sick the ally civs on them and for the most part all but ignore them (as they are defending off the others).
- What the numbers/percents are would need to be played to be figured.
More aggressive civs would have higher difference values, while more conservative civs would have lower difference values.
There are many great features available to you once you register, including:
Sign in or Create Account