Chris (or anyone),
Hope someone is still up. I keep getting an error when I run the “check Steam cache” option saying 1 file didn’t pass. Is this referring to //My Games/Civ 5/Cache/ directory? Or something in the main Steam directory?

My game is now crashing 90% of the time when I try to load or save :(

iirc, that means your game installation is somehow corrupted. I’d delete local content and download it again.

There was one file in the original distribution that kept being flagged as corrupt but that didn’t seem to hurt otherwise.

The reason why generalized AI engines don’t exist has much less to do with market incentives than with the incredible difficulty of such a task, especially given the performance requirements of commercial games. Do you have any experience writing game AIs?

If I delete localized content, will it mess with all my current games & saved games?

It shouldn’t - at least it doesn’t for other steam games I can think of. To make sure, just look for where the save files are located an back them up before you do it (you may also want to back up mods if you have those running).

Professionally I am a researcher, doing research in a specialized form of AI, which is not game AI (pm me for more details, if you want). I wrote once an AI for an indie game, but the game has long since disappeared from the web, unfortunately. But it was essentially a clone of the current google competition game. My AI was pretty good, much better than the AI of the author of the game, anyway. :)
Other than also dabbling a bit with real-time AI for Counter Strike many years ago without much result and genetic programming with interesting results I don’t have any professional experience to really show in the gaming world.

Anyway, from what I can observe there are certain parts that are re-used in many games over and over again: Quadtree based space partitioning and node generation for possible waypoints, A* algorithms of various forms for pathfinding, hierarchical AIs for various levels of abstractions, clustering algorithms to give a potential AI a grasp of the spacial distribution of it’s assets, and most importantly it’s always possible to generate an evaluation tree of all possible turns the AI and the player can make and an evaluation for each possibility, prunable to a certain threshold, etc.

Certainly it won’t be possible to produce a general-purpose AI and just use it in any other game without changing it much. But 3D engines, for example, also don’t work like that. But it is possible to produce a solid set of tools (for parameter optimization, for example), libraries and other stuff that would always provide a game a certain set of minimum intelligence. Actually, developing an AI could then be as little as choosing which algorithm to combine with which parameters and apply on which section of the game. And for some genres it would even be possible to make a general-purpose AI, RTS and TBS are prime examples, as are FPS (the stock Unreal Tournament AI was often useful even in Totcal Conversion mods).

In the field I am working in such a shift to collect all the various algorithms into something everyone can use effortlessly is currently happening and seeing the benefits people now wonder why they didn’t have the idea earlier…

What does entering a new era do for your Civ? Is there a bouns for getting there first?

ex. ELizabeth of England made it to Classical Era before me. What exactly does that do?

Not much for the early eras. It’ll tell you when advancing to a later era increases your bonuses.

For the early eras, it’s just a good indication of your, or your enemy’s, progress. For Classical, that’s a big warning flag for me, as it means someone may have bee-lined for Philosophy, and is now getting started constructing the Oracle. That extra Policy that the Oracle gives early on in the game can give you a serious leg-up on your competition.

That’s one of the better things you can say about Civ5, it allows for rather different playstyles.

Me, I couldn’t care less about anybody entering Classical Age - it usually happens in every game for me.
That’s just because the Civ5 tree isn’t designed too good and especially early on it’s possible to get to another age real quick. I once was in Medieval like 2000BC.
Also, I couldn’t care less if somebody builds the Oracle, unless I’m trying for a Cultural Victory (which I did once just for the heck of it) when it’d probably sting just a little.
In fact, due to the cost reduction you can get later via policy and the Christo wonder, in some games I’ve been saving up all my culture until I could get a ton of stuff in one go much later on (as, obviously, it takes quite a while to get to the Christo wonder).


rezaf

Nothing for getting there first. Reaching a new era can unlock more policy trees, and can improve the bonuses from city states. Probably some other little stuff like that too.

I don’t really think saving everything for Cristo Redentor and the Freedom discount is a great idea, even if you’re going for cultural. The early policies are very cheap, and you’ll end up with more net culture if you when the Redentor becomes available if you invest those early points. If nothing else, just buying Mandate of Heaven from the Piety tree will cost you maybe 100 culture and earn 400-500 culture before you hit Telegraph. There’s also the more subtle issue that some of the Policy investments will let you grow and research faster, which means you’ll hit Telegraph earlier.

Okay. The reason I asked is because laypersons tend to assume writing a strategy game AI is much simpler than it actually is. I have some hobbyist experience in that area, coming from a general comp-sci background, and I found that trying to get a computer opponent doing anything intelligent is a fairly mind-boggling task.

I also found that academic AI research, being focused either on non-gaming subjects or on specific traditional games such as chess, is almost entirely useless for computer strategy games. Aside from general sorting & searching algorithms, A* pathfinding is really the only algorithm that can be used directly, to my knowledge – if you know any others I’d love to hear about them. (You mention shooters later; those use a 3D environment where I assume robotics research will be helpful, but strategy games aren’t so lucky.)

Anyway, from what I can observe there are certain parts that are re-used in many games over and over again: Quadtree based space partitioning and node generation for possible waypoints, A* algorithms of various forms for pathfinding, hierarchical AIs for various levels of abstractions, clustering algorithms to give a potential AI a grasp of the spacial distribution of it’s assets,

Sure, but the sorting/searching/pathfinding algorithms are always being reused from textbooks or libraries – no one invents A* from scratch. Higher-level tasks such as hierarchical layers and clustering are certainly an interesting goal for generalized algorithms but I wonder if they aren’t too dependent on the specific game. Can one really extract a useful amount of code for these tasks that is not trivial compared to designing the game-specific abstractions themselves?

and most importantly it’s always possible to generate an evaluation tree of all possible turns the AI and the player can make and an evaluation for each possibility, prunable to a certain threshold, etc.

No, it’s not! That’s why I was asking about your specific experience – in any strategy game that is not chess (or simpler), the possibility tree is far too large to fully evaluate, even for single turn. You have to use massive heuristic pruning to reach acceptable response times.

Actually, developing an AI could then be as little as choosing which algorithm to combine with which parameters and apply on which section of the game. And for some genres it would even be possible to make a general-purpose AI, RTS and TBS are prime examples, as are FPS (the stock Unreal Tournament AI was often useful even in Totcal Conversion mods).

FPS are in a sense much simpler than strategy games, though, because you only need to handle a very small number of actors and possible actions; and NPCs are automatically superior to human players due to reaction time and aiming precision. A Civilization AI needs to manage a dozen units or more without that advantage, and also manage multiple cities and diplomatic relations. FPS AI does have the challenge of navigating 3D terrain but that’s obviously nothing that can be reused in a hex-based strategy game.

In the field I am working in such a shift to collect all the various algorithms into something everyone can use effortlessly is currently happening and seeing the benefits people now wonder why they didn’t have the idea earlier…

The idea of packaging algorithms into libraries is not exactly new, though. The challenge is always to find a format that is both as expressive and more efficient, during programming and at runtime, than directly adapting existing code or pseudocode. Nobody wants to use an engine that turns out to be a clunky underperformer.

Actually, some academic AI research ain’t that useless as it seems sometimes. It is possible to distinguish between two types of AI, one that is run once at the developer’s machine and one which is run on the client machine many times. The mentioned search trees, for example, can be pruned, as you also know. But which branches are bettern to be left in as opposed to others depends on a ‘fitness’ function which can be programmed entirely by hand, but which can also (possibly additionally) be trained. The training part is the one which needs to be run only once. Same applies to FPS - a kill-map (like those disclosed by Valve sometimes) can help an AI to behave more natural.

In my area it’s also mostly such that you run some analysis method on your method once on your data. In this slow phase it learns (for days!). Then the learning results in a model of the data and that model can be applied in a much more cost-effective manner (in real-time often even).

Of course no-one re-invents them from scratch. But re-implementing is sometimes even worse than re-inventing. All the bugs… Also the plain A* algorithm won’t help you with the stuck harvester problem in an RTS, for example. Your implementation needs to be capable of avoiding deadlocks, needs to be capable of re-evaluating and re-computing the path on the fly as the game-world changes etc. Many of these things are missing in many games, even high-quality ones.

Yes and no. Let’s take the tactical AI in Civ5. For any given unit there are only about 8 moves it can possibly perform at any given time. Even just building the search tree for each unit alone with just a depth of 2 (which means generating all the possible countermoves of the enemy), in a sequential manner (but ordered by artillery first, for example) would help somewhat to avoid aforementioned problems while not incurring too much overhead: approximately 8*8 situations per unit, and you can heuristically prune that as well (you don’t have to evaluate all the possible outcomes of putting the artillery right in front of an enemy tank). Additionally you could put a number of simplified situations into a database, and the best moves in these cases (just like an opening database in chess).
Finally you could generate some weights to possible moves and situations by applying co-occurrence based hypothesis building: After observing your own art next to enemy tank with the outcome of a loss of the art in 90 out of 100 times you can put a heavy penalty weight to any move that results in this situation.
edit: And some clustering algorithm that adds spacial awareness could reduce the search space of where to look for solutions even more by for example defining theatres of war. After all, it doesn’t make sense to consider sending the battleship to some random coordinate like 55,87 if your current battle is happening in a rather limited area somewhere between 10,10 and 20,15.

FPS are actually more complex. It’s just that they are so complex, that ‘strategy’ or ‘tactics’ is often not even being considered to be included in an AI. But if you make your problem discrete (like let some strategic AI re-evaluate the entire situation once every two seconds), then you suddenly can apply all the same algorithms that you have already applied to some strategy game before.

Yes, well-defined interfaces between the AI and the game are crucial. But much less work than writing said libraries, roughly by several orders of magnitude… But performance should really largely be a scalable thing: The more time the AI has available, the better its move. Why do turnbased games sit still while I am considering my move? Why don’t they at least stupidly compute the search tree while I am thinking?

Oh, I wasn’t trying to sell this as THE brilliant idea, mind you.
Actually, when I did it, it was basically accidental, as when you skip one policy pick, it’ll (sometimes?) auto-skip all following ones, so it often took me a looooong while to realize I had actually not received any policy for quite a while.

That said, while some policies are helpful, I think currently, skipping entire trees will do very little harm, depending on the situation.
For example, the double XP from the Honor tree will obviously be useful when you’re engaging in a lot of warfare, but not so much otherwise.
The wonder bonus always comes in handy, but having Marble nearby can be a decent substitute, plus it always depends how much production your capital/production city can muster in the first place.
Investing in anything Piety can be a waste if you’re going to switch to the science tree later on.
Etc.
Anyway, most stuff in that trees is rather minor, and you’d have to play on one of the highest difficulties for these bonuses to really tip the scales, at least in my experience.
Having a single city with decent terrain/resources nearby can make much more difference than most of the early trees stuff combined, in my experience.


rezaf

As another former AI programmer (not in the game industry either), myself, I think a) AI programming for games is much harder than people think, and b) AI programming for games is much easier than people think.

If you’re an otherwise good programmer, but have no background in the subject, and you’re just trying to get something to work, you’ll trip over something basic like pathing and it will be so hard to get right this first time you won’t have time for anything else, and the end result will be very bad.

However, if you have a clue about traditional AI techniques, and you’ve maybe taken a course or read a book about pathing and then gained a bit of practical experience with it, coming up with something that works shouldn’t be all that hard. At least it shouldn’t be so hard in the context of a game where perhaps the most important of all features is the AI, and where presumably there is some significant time dedicated to its implementation. Even so it shouldn’t be more than a one-person job in a game like Civ which has such generic units.

Successful developer-side training needs a fairly stable environment, though. Civilization has random maps and is user-moddable – that’s about as unstable as it gets. Fixed-map games like Starcraft already use pre-generated pathfinding graphs and map-specific hints or scripts for the strategic AI, as far as I know.

Your implementation needs to be capable of avoiding deadlocks, needs to be capable of re-evaluating and re-computing the path on the fly as the game-world changes etc. Many of these things are missing in many games, even high-quality ones.

Good point, a fully-featured reference implementation is certainly desirable.

Yes and no. Let’s take the tactical AI in Civ5. For any given unit there are only about 8 moves it can possibly perform at any given time.

True, you could probably use turn prediction to control units in the isolated situation of a single tactical battle. That should be worth looking into.

But performance should really largely be a scalable thing: The more time the AI has available, the better its move. Why do turnbased games sit still while I am considering my move? Why don’t they at least stupidly compute the search tree while I am thinking?

It’s unclear whether that would help much, given that every player can move all units in every turn, and even build new ones – again, radically unlike chess. The exact situation changes so completely that it’s questionable whether you’d get any usable results from the precalculations. Perhaps if one could establish a search tree on a higher level of abstractions (armies instead of units) and average out results…

Once you quit the reminder, it won’t remind you again until you buy a policy or load from a saved game.

The first three trees are fairly weak. Recently I’ve taken to buying the first Liberty policy for the +50% bonus to settler production, and I only take that if I get the policy before I start my very first Settler. The Honor tree is probably the strongest if you’re rushing, but even though I’ve been doing nothing but horseman rushes recently I usually don’t bother.

Piety’s memorable mainly for the 2 free policies (if you’re playing for a Cultural victory) and the -20% unhappiness. For a large empire, that’s significant.

Patronage is a strong tree unless you’ve got nothing but Military city states nearby. +12 happiness and the 4-5 Great People are very decent. That usually translates to a Wonder, a free technology, and a couple of Golden Ages.

Commerce gives you another +10 happiness or so, but you have to buy a lot of weak policies to get to it, so it’s generally not worth it.

Rationalism is strongest if you’ve saved your culture for it. The +2 Science per specialist combines very, very well with Freedom’s 1/2 happiness per specialist.

Freedom’s 1/2 unhappiness per specialist is much stronger than it first appears. It’s the only variable unhappiness adjustment in the game. If you have this and you’re running against the edge, you can shift a few citizens into specialists and get out of Very Unhappy, and then put them back once you’ve built some Happiness buildings. This is less important than before the patch, now that cities you opt to burn cost no unhappiness even while burning. It still matters when you take a capitol, though.

Order has several ridiculously strong abilities. +25% production for almost everything, half city unhappiness penalties, and +5 production per city. Combine that with the Forbidden Palace, which I usually do, and annexed cities cost 0 unhappiness. The only reason to build a courthouse is to avoid the 25% population unhappiness penalty, which is almost 50% if you have Theocracy.

I should try Autocracy sometime, but it looks really weak. Particularly since you have to give up Freedom, which has some strong benefits. I’ve seen people comment on the double strategic resources, but usually by the time I get to the Industrial age I have all the land and thus all the resources I can burn.

I’m currently playing on Emperor (6). I could probably try upping it another notch, but Emperor provides a comfortable level of challenge without being frustrating.

I generally use either a “kill everyone” strategy or a “kill my neighbors” strategy. I’ll take the Honor track for my first if killing everyone, but +1 food in the capital is usually a +25% bonus to growth by the time you can get it.

Commerce gives you another +10 happiness or so, but you have to buy a lot of weak policies to get to it, so it’s generally not worth it.

WHOA! You don’t think the 20 or 25% cost of purchasing items is the single best policy in the game? Even after the luxury diplomacy nerf, maybe even more so now, this is a policy I almost always get. And Big Ben. Rest of the tree is trash though. Sometimes I’ll even wait a while to buy buildings if I’m close on either the policy or the wonder.

My problem with the autocracy track is that by the time you can use it, you probably don’t need it anymore.

With France, I usually take the the +1 tradition food bonus for some early population help and the great works bonus, because I’m rushing to get the Great Library and early Iron Working, so as hopefully to build at least one city with iron before having to conquer anyone.

I’ll then have plenty of culture later on for Piety, and in the unlikely event the game is still interesting that late, I can switch over eventually to Order.

With anyone but France, Culture is a much more interesting decision early on. It depends on what kind of situation my capital is in, if I’m getting enough money to buy a settler reasonably quickly, or if I have to build them, etc.