AI for a small RTS

Started by
12 comments, last by Palidine 14 years, 2 months ago
Quote:Original post by MONSTROZZITY
Any clue about resource management though?


Define resource management. That's not something the AI has to worry about unless you're writing a computer-opponent level AI. As I mentioned, I wouldn't even start to think about doing this until you have the entire game functional as player v. player. Or at least reasonable functional.

If you're curious, I believe I've made other posts before outlining the architecture I used for the computer-opponent. Just search the site.

And re:Emergent's point about target choosing: definitely forget about anything better than "closest target" until you have the basics stood up. However, after covering the basics you're definitely going to want to spend a lot of time on the target chooser. That's a really huge deal for player perception of the intelligence of the units. An anecdote of interest we spend a full 1.5 person man-month simply designing the algorithm for most intelligent target choosing; it involved tons of spreadsheet battle simulation to derive a the basic mathematical ruleset for our specific game. The result worked pretty wickedly, but was relatively non-intuitive: don't always focus fire, don't always hunt what you're best at killing, etc. Anyway, you need all the basics stood up before working on this anyway because you'll want to test many unit skirmishes of TargetChooserPolicyA versus TargetChooserPolicyB.

Another thing to be aware of is that the actual most correct choice is frequently not the one you want to go with because it may appear "dumber" to the typical user. What's important is user-perception of intelligence, not actual intelligence.

It's also fair to pawn off this micro-management on the user. i.e. units do basic stuff, we want to encourage micro-management by not providing the "best" solution (despite what you typically see on forums, our surveys found that a larger portion of the user base wanted more micro-management not less)

-me
Advertisement
Quote:Original post by MONSTROZZITY
Actually Predictor, could you be a little more specific as to how Algorithms could help, or just refer me to another post on Algoritms that might explain a little more in-depth?


An algorithm is a recipe for how to solve a computer program that can be applied in any language. So basically: these are the logical steps you take to implement so and so a solution. Knowing how to translate an algorithm to working code is an essential part of learning how to program.

Predictor is simply saying that it's probably going to be more productive for you to ask about how to program something in the sense of algorithm than how to program something in the sense of actually syntactically correct Python code. Basically, the type of answer I gave you was a very high-level algorithm of sorts; I didn't write the Python or whatever code, just told you how to logically approach the task. [smile]

-me
Quote:Original post by Palidine
It's also fair to pawn off this micro-management on the user. i.e. units do basic stuff, we want to encourage micro-management by not providing the "best" solution (despite what you typically see on forums, our surveys found that a larger portion of the user base wanted more micro-management not less)


I didn't really intend on making an micro management A.I. when I said that, I really should have asked how to make a resource management system for the player to use. Then again, that doesn't really belong in the A.I. section for the forums.

Thanks for the description of Algorithms Paladine, and I'll look through your other posts to see if you had put anything on resource management.

I was actually wondering whether or not I should buy that book called "Game Programming with Python". I got the book " Beginning Game Development with Python and Pygame: From Novice to Professional". Should I have gotten the book you suggested Predictor?
"Aarivaderrchi"-Inglorious Bastards.
Quote:Original post by MONSTROZZITY
I didn't really intend on making an micro management A.I. when I said that, I really should have asked how to make a resource management system for the player to use. Then again, that doesn't really belong in the A.I. section for the forums.


Gottit. Yeah it's pretty simple. You just have a central counter for each type of resource, probably just an integer. Production units add to it either on a tick or when the harvester delivers it's payload (depending on what economy type you build). Anything built just subtracts from those same counters. You block actions probably at the UI level based on whether or not the item can be afforded.

It also depends on what type of construction economy you build. You can either go 100% cost up front: which is easy and i'd reccomend starting there. Or you can go pay as you go where each tick you subtract a percentage of the total build cost: this is the C&C model. That's a lot more complicated: basically each factory has a construction queue of items being built (need that anyway), each frame you iterate each factories queue and subtract the cost to build that frame's worth of construction. If the player is out of resources, you don't advance the percent done.

yeah... start with 100% cost up front. like I said you'll need construction queues anyway but then it's a simple timer. layering the pay as you go on top is something you can consider later and, though complicated, should be easy to plug in.

-me

This topic is closed to new replies.

Advertisement