Xmonger
Chieftain
- Joined
- Nov 4, 2016
- Messages
- 88
I'm thinking there should be a saying, "it wouldn't be a Civ forum if every other post wasn't bashing the AI". Warning, long post.
Anyhow, I work in AI and have been in the field for many decades, through it's ups and downs, and am versed in the classical techniques and all the new exciting developments with DNN's (Deep Neural Nets) you're all hearing about. Given the amount of commentary on the Civ AI I thought it might be interesting to hear some thoughts on the technicalities of Civ and game AI in general (in a personal side company I also develop games).
In AI today there are basically two main techniques which I'll call "Classical" and "Connectionist" (any other practitioners out there just hold your nose, I'm simplifying). Classical is all the technologies (algorithms, concepts) that are developed as what we think of as a algorithm. An algorithm is just a recipe, and a venerable game AI algorithm is A* which is used for path finding still used in games today (it's how a mob finds it's way over to bash your head in).
Key idea: with classical techniques we (humans) tell the computer how to be smart, which assumes that we're smart enough to do it.
Connectionist has been around for a long time too but has been slow in coming because it requires lots of compute power, which (thank you gamers) is now available with our high end GPU's (there also was an important missing theoretical development). With this technique (also known generally as Machine Learning) we teach the computer how to teach itself, then feed it lots of data. For example, we set up the computer to detect things in pictures, but don't have to tell it what a cat is, but if we feed it lots of pictures of cats it will learn how to detect cats, really well. As good or better than humans now. This is the power behind all the recent advances you've seen such as image and voice recognition (and AlphaGo from DeepMind).
Key idea: with connectionist techniques we teach the computer how to learn, and the hardest part we have is getting enough data for it to do so.
Punchline: Civ and most games use classical techniques, which are fragile, break easily (and when they fail they usually do so spectacularly) and exhibit little spark that helps us get over the uncanny valley. Further they take an enormous amount of work and as the game develops they take more, and more work. You could spent a billion dollars on the Civ AI and get something that would still be fragile. This has nothing to do with developers, it's the nature of the problem and available technologies. But there's hope.
Connectionist techniques are ones I think we'll start to see more of in games because they're more robust (however when they fail they also do so spectacularly, but they just fail less), and they are generally easier (and trickier if that makes sense) to do. But they take a lot of data. Like, a lot. Take whatever you're thinking of and quadruple it.
Warning, techie bits here.
So what about Civ, connectionist sounds pretty good, why not do that here? Well let's see. We'd need about, oh say 100k to 500k full games as training data to start, let's just generate data from AI vs AI games. Then we'd need to define the network, what's the cost function? In other words how do you define the 'value' of a move? Well that's a great question, like what's the numerical value (from 0-100) of making a builder? It needs to be a formula, how would you express that? Be careful and don't turn it into a classical system by putting too much thought into it, if it's complicated it probably won't work. But what about the hundreds of other things you could do at any moment of the game? What's the cost function for that? Finally, what are the input neurons and output? Given the number of orthogonal actions at any point it kind of seems like the network would be bigger than what even our modern CPUs/GPUs could handle. Brrrrr .... I'd love to get some time to look into this, but at first glance it's not an obvious solution.
So what does Civ actually do? Some combination of classical techniques, yes A* probably for moving pieces. The main AI is probably a type of expert system, which is just a database of rules of what to do in various circumstances. As I said these are fragile and error prone, and when you push them (higher level games) they'll break. But Civ does have an advantage which is the system already is an expert system of a form. The game already knows what is possible and legal at any point in the game, so the AI can leap off of that. It's probably something like review all possible actions and then consult a database of likely choices, then modified by things like agendas and leader traits.
Conclusion: Sorry folks for the length but I needed to get that off my chest. Complaining about game AI is like complaining about the weather because a) you're not a weatherman and b) there's nothing the weatherman can do about it. Having said all of this in my tiny opinion the Civ AI is excellent, I'm continually surprised at the smart moves the AI's are making. Though I've played the game forever I'm not a good player (too busy but I like VI so much am keeping a game going most of the time), but in my games I appreciate how the AI Civ's appear to have distinct personalities and generally make good decisions.
Anyhow, I work in AI and have been in the field for many decades, through it's ups and downs, and am versed in the classical techniques and all the new exciting developments with DNN's (Deep Neural Nets) you're all hearing about. Given the amount of commentary on the Civ AI I thought it might be interesting to hear some thoughts on the technicalities of Civ and game AI in general (in a personal side company I also develop games).
In AI today there are basically two main techniques which I'll call "Classical" and "Connectionist" (any other practitioners out there just hold your nose, I'm simplifying). Classical is all the technologies (algorithms, concepts) that are developed as what we think of as a algorithm. An algorithm is just a recipe, and a venerable game AI algorithm is A* which is used for path finding still used in games today (it's how a mob finds it's way over to bash your head in).
Key idea: with classical techniques we (humans) tell the computer how to be smart, which assumes that we're smart enough to do it.
Connectionist has been around for a long time too but has been slow in coming because it requires lots of compute power, which (thank you gamers) is now available with our high end GPU's (there also was an important missing theoretical development). With this technique (also known generally as Machine Learning) we teach the computer how to teach itself, then feed it lots of data. For example, we set up the computer to detect things in pictures, but don't have to tell it what a cat is, but if we feed it lots of pictures of cats it will learn how to detect cats, really well. As good or better than humans now. This is the power behind all the recent advances you've seen such as image and voice recognition (and AlphaGo from DeepMind).
Key idea: with connectionist techniques we teach the computer how to learn, and the hardest part we have is getting enough data for it to do so.
Punchline: Civ and most games use classical techniques, which are fragile, break easily (and when they fail they usually do so spectacularly) and exhibit little spark that helps us get over the uncanny valley. Further they take an enormous amount of work and as the game develops they take more, and more work. You could spent a billion dollars on the Civ AI and get something that would still be fragile. This has nothing to do with developers, it's the nature of the problem and available technologies. But there's hope.
Connectionist techniques are ones I think we'll start to see more of in games because they're more robust (however when they fail they also do so spectacularly, but they just fail less), and they are generally easier (and trickier if that makes sense) to do. But they take a lot of data. Like, a lot. Take whatever you're thinking of and quadruple it.
Warning, techie bits here.
So what about Civ, connectionist sounds pretty good, why not do that here? Well let's see. We'd need about, oh say 100k to 500k full games as training data to start, let's just generate data from AI vs AI games. Then we'd need to define the network, what's the cost function? In other words how do you define the 'value' of a move? Well that's a great question, like what's the numerical value (from 0-100) of making a builder? It needs to be a formula, how would you express that? Be careful and don't turn it into a classical system by putting too much thought into it, if it's complicated it probably won't work. But what about the hundreds of other things you could do at any moment of the game? What's the cost function for that? Finally, what are the input neurons and output? Given the number of orthogonal actions at any point it kind of seems like the network would be bigger than what even our modern CPUs/GPUs could handle. Brrrrr .... I'd love to get some time to look into this, but at first glance it's not an obvious solution.
So what does Civ actually do? Some combination of classical techniques, yes A* probably for moving pieces. The main AI is probably a type of expert system, which is just a database of rules of what to do in various circumstances. As I said these are fragile and error prone, and when you push them (higher level games) they'll break. But Civ does have an advantage which is the system already is an expert system of a form. The game already knows what is possible and legal at any point in the game, so the AI can leap off of that. It's probably something like review all possible actions and then consult a database of likely choices, then modified by things like agendas and leader traits.
Conclusion: Sorry folks for the length but I needed to get that off my chest. Complaining about game AI is like complaining about the weather because a) you're not a weatherman and b) there's nothing the weatherman can do about it. Having said all of this in my tiny opinion the Civ AI is excellent, I'm continually surprised at the smart moves the AI's are making. Though I've played the game forever I'm not a good player (too busy but I like VI so much am keeping a game going most of the time), but in my games I appreciate how the AI Civ's appear to have distinct personalities and generally make good decisions.