PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

AI for Fight Games (Street fighter Style)

Twelvegames · 15 Nov 2004, 17:39 UTC
Hi,
We are developing a 2d Fight game for Handhelds.
We are looking for Whitepapers, articles ecc about creating AI for beat em ups.
Thanks a lot
I can't give you an example off the top of my head, but I suggest a search for an actual book on Artificial Intelligence in video games and Fuzzy logic.


JJB
I agree with JJB. That style of game also lends itself well to genetic algorithms. I will look through some of my GA books and papers as I distinctly remember discussions of a streetfighter type game using GA to build the AI.
AI? For beat'em up game? Genetic algorithms?? You must be kidding :). What can be more simple than AI for this kind of game?
Then give him some articles or headsup on doing it. :)


JJB
JongJungBu wrote:Then give him some articles or headsup on doing it. :)
JJB


I don't have articles :). But the simplest way to have AI is to have a series of "if () {} else if"
or switch. This will do perfectly for such a simple task.
Well, something like this:

Code:
if (enemy_far)
{ShootFireball();// Or few random proper actions}
else
if(enemy_close && enemyState.Jump)
{MakeUppercut();}else
if (enemy_close && enemyState.Defend)
{Makebackheel();}


Etc, etc.. If combos are possible, you can record them and play easily. AI will have a "stack" of commands, and "play" will simply add basic comands to stack for future execution.
While a finite state machine is an adequate AI technique for a simplistic opponent, it is very difficult to tune for a realistic one. GA will allow you to choose from a wide population of candidates for various levels of difficulty and skill sets. Certainly there are many approaches to this problem.
When I was working on one of these games, I used a genetic algorithm. I never compelted the game as my copilot went overseas but the ga way seemed to have promise.
While not the reference I was looking for, I came across O'Reilly's AI for Game Developers (ISBN 0-596-00555-5) which provides a good example of determining GA fitness (probably the most difficult aspect of GA implementation) in an RTS.

There is also a good discussion of using a FSM for Streetfighter style games per jaguard's suggestion.

The book is definately worth reading.
Twelvegames · 16 Nov 2004, 14:23 UTC
Thanks a lot, i will take alook at it.
It's so strange that there is so few articles on this around the Web.
Fitness evaluation would be extremely difficult in this scenario, also saying use a ga is going to be a bit misleading, as a ga would be used to optimise another system , what would this system be?

Ive played around with using a ga to evolve a neural network for fight response before, with only limited success. The evolved fighters generally only use one tactic as their main weapon such as crouch down and repeatedly punch, as it is very difficult to get out of fitness minimums during evolution, But this was more of a neural network exercise than anything ,

using a ga and coevolution to evolve state machine ordering could be very successful indeed (giving hints away here for forthcoming title) but it does not always give realistic game play as some of the best fighting techniques can be very dull to play against.

Really, depending on the number of moves your character can do, id hand craft a state machine with added random events for the time being and see how it plays .
http://www.gamasutra.com/features/20041 ... g_01.shtml

... has the O'Reilly chapter on "Fighting Game Strike Prediction".
Finite state machines will be enough I think. Just make a lot of them.
Neural network algorithms are not worth it, I think. Virtual Fighter or something used them but I don't think anybody noticed.
Ludens wrote:Finite state machines will be enough I think. Just make a lot of them.
Neural network algorithms are not worth it, I think. Virtual Fighter or something used them but I don't think anybody noticed.


I disagree - there's a very good reason why Virtua Fighter is regarded as many for the most indepth fighting game there is, and the AI is part of that.
I disagree - there's a very good reason why Virtua Fighter is regarded as many for the most indepth fighting game there is, and the AI is part of that.


Well yeah, I'm not saying that the AI is bad. I tried playing with the AI in VF and it works. If you do the same thing, like kick the player all the time to win, the AI will eventually think of a way to prevent you from doing it. But it's nothing that can't be done with finite state machines.
The key point here is tuning.

Using a finite state machine places the burden of tuning on the developer. The AI will then be a direct reflection of his/her playing skill and technique.

While creating an AI that is self-tuning is quite a bit more difficult, it can be equally more rewarding - to both the developer and the customer.