Interesting - but the blog article reads more like a press release than an article of interest to programmers.
My recent RTS game uses a new style of AI that basically hybridizes rules-based AI with emergent AI logic. I've recently written a blog post about the general philosophy that I used, and talk some about why it worked, etc. The article is fairly high-level, but it's meant to be the first in a series. In future articles in the series, I'll go into more depth about specific sub-topics.
As a disclaimer, I'm really not an AI programmer at all -- my background is in databases, financial modeling, etc. But it just so happens that database experience, which often involved distilling data points from multiple sources and then combining them into suggested decisions, etc, for executives, also makes a great foundation for certain styles of AI. The approach I came up with leans heavily on my database background, and what concepts I am familiar with from reading I have done on AI (emergent behavior, fuzzy logic, etc), and the results are startlingly good.
Total development time on the AI was less than 3 months, and its use of tactics is some of the best in the RTS genre, I believe. Anyway, I'm very open to talking about anything and everything to do with the design I used, as I think it's a viable new approach to AI to explore in games, and I'd like to see other developers potentially carry it even further. If there's anything else you'd like to know that the article doesn't discuss, feel free to ask.
Here's the link: http://christophermpark.blogspot.com...ai-part-1.html
Interesting - but the blog article reads more like a press release than an article of interest to programmers.
Hmm, it really wasn't intended to read that way (that's honestly a bit depressing if that's how it came off). It was something that originated as a question over on GamersWithJobs, and the post was so popular there (and copied elsewhere) that I thought it would make a good first post for my series about the AI in the game. It's a hard balance to be general enough that the scope of the conversation can be understood, versus getting so detailed that the overall conversation gets lost. That's why I wanted to do a broad overview first (which still ended up being pretty long), and then delve into specific sub-topics later.
Last edited by x4000; 06-02-2009 at 10:44 AM.
There's a lot of enthusiasm, and a lot of talk about how awesome it is, and very few (are there any?) concrete examples. After having skimmed the article a couple of times now, I still have no idea what system your AI uses, and I actually AM an AI programmer.
If you want to make this article a useful starting point for discussion with engineers, rather than the guys at GWJ, then you'll have to structure it a lot differently.
Hmm, maybe I should have waited until I was further along in this article series before posting here -- again, this was meant to be conceptual overview instead of something filled with concrete examples. I'll let you know when I have a couple more of the articles in there, which will be more nuts and bolts.
The main takeaways from this particular article are supposed to be:
1. Rather than building a decision tree, thus simulating a central intelligence, this particular approach puts the decision making at the level individual units. Individual units decide what to attack, where to go, etc.
2. The individual units also look at what other units are doing a bit when they are deciding where to go, and that's what helps to create the flocking-style behavior. I intend to go into that a lot more in one of the later articles.
3. The above is basically the tactical stuff, for the strategic level it is using a centralized decision structure. I don't go into much detail in the article about it, because it is a bit complex to explain briefly, but basically it is just analogous to database queries with fuzzy logic added on. Using LINQ, I'm bypassing the decision tree structure altogether (again, more details and concrete examples planned, this can be an article in itself).
4. Using points #1 and #2 above, I was myself surprised to find how much emergent behavior occurs. This is the "sub-commander" as I mention in the article. I was all set to code that sort of behavior, but never had to because it came out just from how the individual units acted. This is easy to code, and it gives surprisingly good results really quickly, because of all the variables the LINQ queries are considering.
5. I don't know what the tendency in the AI community at large, I'm certainly not a part of that, but just looking at other RTS games from a player's perspective it seems like a lot of the time a "best" decision is reached and then the AI does that. That's part of what makes the others trickable. I'm suggesting that finding a "best" decision is not only difficult, but also pointless, because it makes it too predictable. Sometimes a slightly non-ideal decision can actually be the best thing, just because of the surprise factor. Encouraging randomness and unpredictability in the AI War system was something that I started dabbling in, and then ramped way up after a bit of playing because it was all still in the bounds of reasonable decisions to make, and being so unpredictable made it seem more human. Players tend to anthropomorphize the AI to the point where they see intent where there is none, and this makes the AI seem more devious even than it is. Again, another big topic for a followup article.
6. Then the other big thing, potentially controversial, is how I'm skipping the economic simulation because it's just pointless to simulate, and with a player-vs-AI setup it frees me up to design all sorts of random scenarios that are lopsided in various ways. This would NOT work in pvp style games, but in a co-op style game (or single player), I think it's something that should be done more in games because it opens up all sorts of new scenarios. Other games have been doing this for years in scripted campaigns, but this basically integrates that into procedural campaigns. This is perhaps the hugest discussion of all, because a lot of people are likely do disagree with the fundamental approach I used there, and this part not widely applicable to most other game designs. My point in favor of the approach is that it creates interesting situations for the player when it is used well, that's all.
And there were some other more minor points in there too, and some extra explanation for non-programmers so that they can understand why this AI is even particularly different, but that's the general gist of the article, that's what it's meant to convey.
And yes, I am surprised and happy with how well this worked out in the game, and a number of players have asked me how that was done, so that enthusiasm I'm sure came through. It's really hard to do a post-mortem for a project when you are basically happy with how it came out, without people just saying "oh, that's just PR" or whatever. And to an extent I guess it is PR, in the sense that I want other people to share my enthusiasm for the new approach, and also give it a try in their own games. I've spent a long time in a business environment coming up with new ideas that I haven't really had a chance to share with the larger programming community, so working on my own has made me really happy to be able to contribute (hopefully) new thoughts to the larger community.
Anyway, this intro article is the only one that is going to be at all non-technical, because it pretty much gets across everything that a non-programmer would have any interest in. I'll post links to added articles about the above technical topics as they come up. Some of it is code-focused nuts and bolts stuff, but a lot of it boils down to overall code architecture and design philosophy. I don't think my specific code is the only way to go by a longshot, but I think the general design philosophy for many parts of the AI can be widely applicable. It's basically just combining one discipline (database style-thinking for ERP / decision making system) with another (AI).
Personally I think general decision trees, triggers and whatnot are a bad idea. They can be exploited by any player with the time to map out options. Of course predictability could be reduced by having a deterministic algorithm that takes randomly adjusted input data.
I can't quite imagine how to apply a database mentality to games... I've always viewed databases as a vehicle for storing data and running reports. I'm sure you'll enlighten us.
I'm not an AI programmer, but I did take my first step into that domain by writing a goal-oriented action planner for one of our current games. In theory, it's possible for emergent (or at least, semi-emergent within the confines of the action suite you provide) behavior to result. I'm excited about what we're going to be able to achieve with it.
You should visit aiGameDev.com and read through the article about influence maps used for the winning game in a competition to create an RTS AI.
I've just read this on slashdot...
I'm doing essentially the same thing with LINQ, although you could code it out with regular loops instead (it would just be harder to read, in my opinion, and a lot more code with so many effective where clause comparisons). This is referring to how the decision is made for what target an individual AI unit will choose, or otherwise how it will act. When once I have a smaller data set, the AI looks at the most likely candidates, and has a slight chance to discard the top ones. That chance increases the more other AI agents are currently acting on the same choice, but it still remains small-ish.
I should also point out that I'm using the Mersenne Twiser algorithm for randomization, rather than a default implementation of Random, because that provides so much better results, just on its own.
That's the basic approach I'm using, anyway.
http://aigamedev.com/open/article/rts-fps/). I had not seen that before, but it was quite interesting, and I think that sort of thing is totally needed.
In AI War, the fact that I have multiple planetary battlefields really makes it easy for me to do that on a planetary scale, and the AI does in fact take this into account when its determining how to reinforce its own planets. When it's determining how to attack your planets, I just leave it as randomized (except with certain AI styles that use specific other logic, such as always attacking the strongest player, or sending all waves to one planet until it dies, etc -- Assassin and Sledge Hammer, those two), because that has seemed to be more effective.
The "database query" approach also works well for this sort of thinking. One of the variables that that the queries I'm using takes into effect is the "danger level" near each potential target. That is calculated on an interval, and basically is just the strength of all of the various ships near the target, how much damage they can do against the attacking ship. On the weaker AI levels in the game, they intentionally attack targets with a higher danger level (this is one of those intentionally-stupid decisions which doesn't look very stupid to your average human player, but which makes things much easier for them), and on the higher AI difficulties of course it generally tries to pick off lower-defended targets if it can.
But not always! There's a random chance (and some ship types, like bombers, have a higher likelihood of making this choice) that ships even on the higher AI levels will just go directly for the best target regardless of the danger level. This is part of what makes them unpredictable, and it's also sometimes really effective as a "suicide run" that lets them take out a valuable target.
Okay, part two of the article is now online, with a more in-depth discussion of a couple of topics (some of which already came up here), as well as some code snippets: http://christophermpark.blogspot.com...2-queries.html
Not to be a dick but...we get it. You have a blog and you want to promote it but you're not really contributing to the indiegamer conversation, you're just pimping your blog. It's a little obnoxious.
Put the blog link in your sig and join the conversation as an actual community member. Blog whoring is barely a step up from spam posting for cheap Viagra.
But I will say this -- you guys do a pretty good job about making someone who is trying to contribute feel bad about themselves. It's not like I have a grand and devious plan to trick the indiegamer population into coming to my blog or buying my game. Do you think that I imagine that indiegamer visitors all rush out and immediately buy anything that someone posts?
If I wanted to just promote my site, there are easier ways (and I am doing those -- press releases go out to the various outlets that are actually interested in press releases, and that's where real traffic comes from). I may not participate overly actively in threads here, but I've read a number of threads over the years here, at gamedev.net, and at places like stackoverflow. At the time in many cases I don't have time to contribute, or anything meaningful to actually contribute since I am just getting into whatever topic is being discussed. But now that my current project is done, and I've figured out what I needed to figure out in order to make it happen, I thought it would be nice to give something back, share what I did find out.
Maybe I waited too late -- if the game was a WIP and not on sale yet, perhaps there would be a different reaction since there would not really be any chance that I'm trying to drive sales (through a developer site? that's really no way to drive sales, there just aren't enough of us to make a meaningful dent.).
That's basically all I'm trying to say. I've tried to give back, maybe not in the best way, but in a way that I hoped would be helpful and would spark some interesting discussion. In a few cases, such as the co-op thread, there was a pretty interesting discussion (and I was surprised by the prevailing attitude, and a few interesting counter-points were actually raised that made me consider things in a new light). But overall, I'm just getting criticized for not following the unwritten rules (I guess I should be contributing to other threads about which I know comparably little first, before I post on something that I actually have an opinion about? Should I be soliciting advice on things that I don't really want advice on?)
I'm sure someone will respond with a "this is the way you should do things" comment, and that's fine, but I've had enough abuse and am not really inclined to try anymore. My first post here was criticized for just being a blog link and not really starting a discussion here, and that made a lot of sense so after that (the second two posts) I've tried to be engaging enough here to start an actual conversation here not so much about my game or blog, but about the ideas that I find interesting. I know lots of programmers, but not many who are into game programming, so I had hoped for a more interesting topical discussion here.
Look at me, I've gone on and on, but I feel pretty strongly about this. I was trying to be a nice guy and give something back, and you've made me feel pretty sleasy over and over. I think you guys have a nice community over here, and I'm sure I will continue to lurk and read posts when there's some topic I need more information on, but nothing is worth this. I understand a bit of cynicism, but this goes beyond what I consider reasonable.
It's easy to not blog-whore. Just cut and paste the contents of your article into the thread, and keep your blog link in your sig. Then we can have the discussion here (thus fulfilling the purpose of the message board), and people who are interested in reading your other articles can click the link in your sig. Easy.
I think the objectionable part was appearing on slashdot. That's not inherently bad in itself, but made it seem as though you were just "whoring" the link (and that this forum could have been one of many that had this post appear in it).I understand a bit of cynicism, but this goes beyond what I consider reasonable.
Clearly that isn't the case, but seeing it from a POV where we know little about your motives or intentions, I wouldn't say this kind of cynicism is "beyond reasonable". (We're not trying to be hostile toward you, we're just inherently weary)
I mean, all of that was already clearly here in this very thread before most of the snide comments. I think I was clearly trying to hold up my end, which is what makes the cynicism start seeming downright hostile. That's the thing, I think I had reasonably demonstrated my motives to at least be afforded some consideration and not be called "one step up from a viagra ad" or whatever.
Well there's definitely interest in these topics. There's a lot of programmers here.
But a lot of us are overly sensitive to spam. And the old "here's an article that I just posted on my blog <link>" spam is a really old one, and frowned upon on a lot of boards.
I've read the second part now and I'm not really seeing how your AI is different from a normal FSM AI, you're just using query language. Good for you, that's what you've got skill in and it obviously works well.
Another pointer, if you'll accept it: Don't include gigantic blocks of LINQ SQL or whatever the hell that is. It's completely unreadable, I suspect even to someone who understands it. You might as well have put
for all the value it gave your article. These types of article usually are not at all formatted like yours have been. By "these types" I mean the articles where the premise is: "I've discovered some really nifty technique, let me tell you how cool it is." The thing is, we're programmers, but we're not going to learn LINQ SQL to discover how cool your technique is.Code:HAHA! You can't understand this code noobs!
Anyway, don't get discouraged man. I'd rather have you here than not. We're just a cranky bunch.
Thanks for the note of encouragement, Backov -- just as a side comment, that's how LINQ is actually formatted, spacing and all, straight out of Visual Studio. There's not really any other way to format it in that language, code blocks cannot be separated as in a procedural language and still function. Not trying to be obscure there, as a longtime SQL programmer that's a pretty basic query with an abnormally high number of comments to aid readability. I could do psuedocode, but there's nothing equivalent in another language. Part of that is that there's not any way (without gotos or a sort) that I can think of to arrive at the same sort of "soft preferences" implementation as compared to the normal "hard rules" of if/else.
I guess part of the point of my articles is: "hey, look at this technique, it's not all that different but with these few changes from the standard look how much better results you can get (and with less code)." If you read boards with users griping about all the stupid things AI in other RTS games do, mine doesn't demonstrate any of those. And if you read the AI code scripts from a game like SupCom, the operative parts when done in LINQ are shorter and more readable (well, your point being "that's only true if you know LINQ," which is valid).
Maybe I'm not doing a sufficient job of explaining it, or maybe I just haven't covered enough angles with it, or maybe my overall approach really isn't that different but just the specific implementation is what makes the difference. I'm not enough of an AI programmer to know on that last point, but surely there would be lots of other better implementations if that were the case. So I'm pretty sure there's some originality here, I must just be doing a poor job of expressing it.
Well, I'll keep trying with future extensions to the article, probably the next one to hit sometime next week. I shouldn't even be saying that, probably, because someone's going to slam me for it. Anyway, I won't be posting a link here (thrice burned is plenty for me), but if the discussion continues here I'll probably participate.
I think people should chill out a little. The content is factual and perhaps relevant to some. If you scare away newcomers you'll just end up the king of an empty forum. Not my idea of fun.
If someone posts code, consider it a bonus to those that understand it. If you don't, ignore it and move on. By all means flame him if he uses an empty for loop instead of sleeping or dumps 500 lines of code into the forum, but anything else is fair enough.
Thanks guys for the aigamedev links, it's quite an interesting site. Pity how much content is paid-only. *grumble grumble*
Given Alex and Petra make thier living doing it, I can understand thier need to charge.