Jump to content
  • Advertisement
Sign in to follow this  
rubicondev

Turn-based RTS AI

This topic is 3076 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi chaps. Can I beg a little help here? I'm not a newb to general AI programming stuff, but I just can't my head around where to start with putting a decent AI together for my current project.

It's a turn-based strategy game using a hex board and all movment is per tile. To visualise, the closest game I can think of is DS/Advance wars and actually the AI in that is pretty much exactly what I'm trying to do.

Here are my key problems:

1) Each AI team needs to be able to make basic tactical decisions based on a triangle of desire between attack, defend, expand. I can handle this bit as far as getting to the point where I give individual orders to the units

2) Each unit needs to have simple goals such as "move to that hex", "operate the building (to take control of it)" etc.

3) This is where I'm tripping up. A lot of the required behaviour needs to be scripted, and then given over to the AI to fulfil the scripted behaviours.



Here is a simple example of my problem.



Level X. A load of enemy tanks get spawned by a script, popping onto the beach from a carrier. The gameplay in this level is that all the enemies then move through a trench to a target spot where they get evacced by helicopter (another script with a trigger box). The human player has to mullha most of the tanks to "win" that level.

The actual movement through the valley needs to be done by the AI as I would like it to react to threats (if a tank on the ridge gets to the edge it gets within firing distance, so shoot at it), but basically keep on making progress to the extraction point.


What I'm looking for is a method that allows some goals to be given (like my move to helipad) by hand, whilst other behaviour can happen based on circumstance.

Are there any resources I should be looking at here? I don't expect someone to tell me how to code this, but it would be nice to find the right book or article that sheds some light on this specific kind of AI behaviour.

Sorry for the long post and thanks in advance...

Share this post


Link to post
Share on other sites
Advertisement
I sometimes think I answer 'Influence Maps' too often.
The strategy (for the player) is to move to point B. The tactics is how they're going to do it. By using Influence Maps you can plot a path of weakest resistance , an area where you might want to concentrate a force to create that path or the path of lowest 'visibility if you're doing it by stealth'.
At a simpler level this will then translate into 'Destroy building A' or 'Suppress Enemy B'.
I might have got who we're playing as wrong but it'd be the same the other way around.
You might want to start with this (long) thread :
http://www.gamedev.net/reference/articles/article1085.asp
and the search on 'Influence mapping' for more visual examples.
One of the AI Programming Wisdom books had a good article and Penny Sweetser is a name that crops up in quite a few of the searches.


Share this post


Link to post
Share on other sites
I don't think the previous poster addressed what it is you are trying to accomplish. If I understand, you are trying to make it so that the AI alternates between being self-sufficient and scripted. That is, have an overall goal, but be willing to suspend the execution of that goal while you do something that is more pressing.

I would consider doing things like hierarchical finite state machines (HFSM). The other thing you can do is simply a FSM with hysteresis. That is, you keep a note of what your prior state was so that you can return to it when you are done. The state change would be from "travel to my goal" to "defend myself". In "defend..." you can do whatever you need to do to fight. Upon conclusion of that action, you return to "travel...". That's the quick way.

Another way to so push actions onto a stack with the most recent being the top of the stack. When that action is solved, it gets popped back off the stack and you see what action is under it (now at the top of the stack). The benefit of this is that you can have many layers of goals that keep interrupting higher ones.

Share this post


Link to post
Share on other sites
Thanks. I went for a fairly simple approach in the end.

I now do my strategic goals stuff in an "team" AI manager and they issue various orders to the units under their command (or they will when I get to it).

But also for scripted units they do use a small list of goals that are given by the script and marked as scripted. These units get no help from the team AI at all now, they just pick a best thing to do from the hand given goals.

I got this working over the weekend and its fairly convincing given that the level in question is more about beating a set environment. Now its on to the wider problems of making the team AI give sensible orders...

Thanks again for the help, was most useful..

Share this post


Link to post
Share on other sites
hey Rubicon,

a useful site for you might be www.aigamedev.com loads of begginner video tutorials, interviews, master classes, case studies they even have their own sandbox going on. Hope you find it helpful.

Mark

Share this post


Link to post
Share on other sites
Quote:
Original post by AeroAstroArtsLtd
hey Rubicon,

a useful site for you might be www.aigamedev.com loads of begginner video tutorials, interviews, master classes, case studies they even have their own sandbox going on. Hope you find it helpful.

This.

While it may seem awkward for me/us/anyone to pimp AIGameDev.com here, this has been discussed with the powers that be here at GameDev.net a long time ago. They are cool with it since the target audience differs quite a bit. That being said, AIGameDev.com is the place to go for a lot of what AAA mentioned.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!