Hi,
Here I want to start a little talk about:
How To realize a good real-time-strategy-ai?
Does anybody knows an engine which supports such an ai?
I've made some strategy-games in the past but i've everytime used a round based ai which i have developed for myself. Now i want to make a simple rts-game with simple irrlicht graphics. But i need a good ai for this.
Thanks for Answers - Konstantin
AI for Real Time Strategy Games
-
- Posts: 12
- Joined: Fri May 18, 2007 3:06 pm
- Location: Panketal, Germany
well pathfinding is not that difficult i looked into it you just have to lead the units around the vertexes of the bounding rects or boxes but i dont really know how to achieve ai...
greets,
halan
greets,
halan
My Blog: http://www.freakybytes.org
A simple AI is rather simple but not too good - however:
I'd write some kind of list to tell my "AI" what it needs to have.
So for a basic "basebuilding" ai I'd take something like:
You need 1 mainbuilding.
You need 2 supply depots.
You need 1 barracks.
Every X seconds the AI will go through this list. Let's assume it already controlls all needed buildings -> nothing happens. Now you (as the opponent) destroy one supply depot. The next time the AI diggs through the list it's check "do I have 2 supply depots?" will fail so the AI know what to build. The "where" is something different bat that shouldn't be that hard either. It isn't hard to implement some basic AI. The real hard part is to balance it and make it better/harder to beat. Some older games achieve this by allowing their computer players to cheat by "seeing" the whole map and/or using limitless resources. However if possible don't do that too.
To get back to the "AI script" you could also add tasks like this one:
You need 10 marines.
If you've got more than 5 marines, let them attack the enemy.
Now the AI will train up to 10 marines and send them out to attack the player once their number reaches 5. If one or two die, one or two are trained again and will attack immediately. If 5 or more die between 2 checks the AI won't send them to attack anymore unless they're at least 10 again.
I'd write some kind of list to tell my "AI" what it needs to have.
So for a basic "basebuilding" ai I'd take something like:
You need 1 mainbuilding.
You need 2 supply depots.
You need 1 barracks.
Every X seconds the AI will go through this list. Let's assume it already controlls all needed buildings -> nothing happens. Now you (as the opponent) destroy one supply depot. The next time the AI diggs through the list it's check "do I have 2 supply depots?" will fail so the AI know what to build. The "where" is something different bat that shouldn't be that hard either. It isn't hard to implement some basic AI. The real hard part is to balance it and make it better/harder to beat. Some older games achieve this by allowing their computer players to cheat by "seeing" the whole map and/or using limitless resources. However if possible don't do that too.
To get back to the "AI script" you could also add tasks like this one:
You need 10 marines.
If you've got more than 5 marines, let them attack the enemy.
Now the AI will train up to 10 marines and send them out to attack the player once their number reaches 5. If one or two die, one or two are trained again and will attack immediately. If 5 or more die between 2 checks the AI won't send them to attack anymore unless they're at least 10 again.
You should also check out a book by Mat Buckland; Programming Game AI by Example. Delves into Finite State Machines and A* pathfinding with examples and code which is what you will probably be dealing with when programming RTS ai.
Edit with amazon link: http://www.amazon.com/Programming-Game- ... 1556220782
The homepage for the book and author is at: ai-junkie.com.
-
- Posts: 12
- Joined: Fri May 18, 2007 3:06 pm
- Location: Panketal, Germany
Only partially... I got it three weeks ago but my exams are bugging me...
In my opinion its good, but AI could be handled a little bit more. Perhaps you should visit the author's site:http://www.cjgraphic.com. The examples from the book can be downloaded there. Perhaps a look at them helps to come to a decision...
In my opinion its good, but AI could be handled a little bit more. Perhaps you should visit the author's site:http://www.cjgraphic.com. The examples from the book can be downloaded there. Perhaps a look at them helps to come to a decision...
i have this in chm formatzeno60 wrote:You should also check out a book by Mat Buckland; Programming Game AI by Example. Delves into Finite State Machines and A* pathfinding with examples and code which is what you will probably be dealing with when programming RTS ai.
Edit with amazon link: http://www.amazon.com/Programming-Game- ... 1556220782
The homepage for the book and author is at: ai-junkie.com.