What is the best method for AI?

Talk about making games.

What is the best method for AI?

Postby Fojam » Sat Jan 14, 2012 10:56 pm

what is the best method for going about making a computer player in a 2 person fighting game. The AI has multiple attacks that he can do and can pick up and use items. The AI's difficulty level should also be changeable.

what is the best way to go about doing this? i have never programmed ai before so this is new for me
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: What is the best method for AI?

Postby skydereign » Sun Jan 15, 2012 1:37 am

The extremity of your request varies massively by how interactive you want your enemies to be... but in any case, the best way to approach this is to learn how to do simple ai first. If you haven't done basic platform enemy controls then you stand little chance of getting what you want. But when you do start working on it, I would do one of two things. Either create a custom event through activation event that can be triggered at times depending on the player's actions, or the more precise method of creating custom timers and variables to control the actor's reactions. Using the current target (I would account for at least 3 possible other enemy/player actors) and address any about to be attacked states. Depending on these, and the reactions, you can choose what action to take next, for instance jump towards the player and attack. Or, if the player is in an attack state, dodge by running, rolling, jumping away, or similar. I would also include personality to the actors, which would make changing difficulty a little easier. But, as I said you should first learn how to make simple enemies. Then figure out how to make them react with one or two moves. When you've figured that out, you can add more functionality and reactions. Suffice to say you should also be very comfortable at making your player actors (without moonwalking) otherwise you'll have plenty of bugs to deal with.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: What is the best method for AI?

Postby Fojam » Sun Jan 15, 2012 1:46 am

well i have done a platformer where the enemies just run on paths like in mario, but thats it. i think i see what you mean though. ill use timers to delay between attacks, and have those timers get smaller with each higher difficulty level. Then i can make the attacks the enemy chooses in a heirarchy. The attacks with the larger damage will have less of a chance of happening in the low difficulty level, and a higher chance in the high difficulty level. Then i can group the moves into 3 sections, melee, projectile, and defense.

how would i go about on recovery, though, like if he is hit and goes flying off the stage? how would i program him to automatically attempt to recover? should i make regions where "off the stage" is and say when he hits it make him try to recover? or should i do it in a draw actor even and make it happen when his x value is a certain number or his velocity is high?
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: What is the best method for AI?

Postby skydereign » Sun Jan 15, 2012 6:23 am

For the record enemies in mario rarely follow paths. They react to their environment, so you could place them at any place and they will react properly in every case. So the use of paths more or less is not reactive nor interactive. The way you are planning it sounds like it will be very predictable, and more based on power than anything. Powerful moves aren't what make a player good in smash, so assuming you are basing the gameplay and enemy ai off the originals, than a computer player using that system will be very predictable. Now for your question, the recovery system for at least the original smash is very predictable. When the computer players are off the stage, they make the most optimal jumps to recover. So, that's all you need them to do (though it'd be nice if you improved their edge recovery a bit). But, since this is your game, do whatever you personally feel comfortable with. If the hierarchal system works for you, than do so.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: What is the best method for AI?

Postby Fojam » Sun Jan 15, 2012 5:06 pm

well for the recovery, i realize how to make him recover, but how do i make him detect when he needs to recover?

and i am having trouble figuring out what you mean about how to make it less predictable. right now i want to start out with just having the AI recover, like in training mode. in training mode, you can hit the ai around all you want and all he will do is try to recover. After i make that, i want to build from there, making him attack and having variable difficulty levels on the attacks. but it seems very complicated.

Also i just realized what you mean about the enemies reacting to their environment in mario. In the original mario, i see that the goombas would move in one direction, and then when they collided with something, they would immediately move in the other direction. I think i see now how to atleast make part of the AI. I can add when he collides with something on his left side, he will pull the moveRight() function.

I really appreciate your help with this so far by the way thank you
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: What is the best method for AI?

Postby Fojam » Mon Jan 16, 2012 2:06 am

ok heres what I have so far. I know a lot of the code in the game is jumbled and not optimized, but try to ignore that. Im going to optimize it when i have everything working

executable:
http://dl.dropbox.com/u/8500676/iSSB%20executable.zip

source:
http://dl.dropbox.com/u/8500676/iSSB%20Source.zip
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest