AI for a 2D fighting Game (needs to be super fast as limited resources)
What kind of AI is used for a 2D fighting game?
If the AI has about 7 different attacks and the player can can have a few different positional states on the screen as levels can be climbed around.
I saw somebody mention a ''state machine'' ???
How would that work?
It needs to be super-fast as running on a 30mhz machine with 200kb of heap memory so i need it to be as light as possible while still challanging.
Thanks for you help.
B
I have been reading through old post for ages and everybody seems to believe that state machines are the way to go for this kind of AI?
State machine it a big long trail of if thens is''nt it?
A state machine would not need to be used every frame only when the AI character is not doing an action?
Should a history be kept of what the AI is doing so that if in his last state was to move to attack then keep moving until the attack has happened.
Also since i am using java (not looking for the old language debate, i have no choice in the situation, though i quiet like java even though it is making me soft as a programmer) is there any speed hints about this kind of thing?
Thanks
Brian
State machine it a big long trail of if thens is''nt it?
A state machine would not need to be used every frame only when the AI character is not doing an action?
Should a history be kept of what the AI is doing so that if in his last state was to move to attack then keep moving until the attack has happened.
Also since i am using java (not looking for the old language debate, i have no choice in the situation, though i quiet like java even though it is making me soft as a programmer) is there any speed hints about this kind of thing?
Thanks
Brian
quote:
Original post by Woody FX
What kind of AI is used for a 2D fighting game?
If the AI has about 7 different attacks and the player can can have a few different positional states on the screen as levels can be climbed around.
How complicated is the player''s situation? In other words, what are the player''s movements based on? Relative position of the enemy? I wonder if it would be possibly to construct a lookup table, perhaps with some randomness to solve this?
quote:
Original post by Woody FX
It needs to be super-fast as running on a 30mhz machine with 200kb of heap memory so i need it to be as light as possible while still challanging.
Are you sure you don''t mean 30MHz (=30000mHz), with 200kB (=1600kb), heh heh?
-Predictor
http://will.dwinnell.com
In it''s basest form, yes, a state machine is a big series of if-elses. A lot can be done to make it more elegant and a bit faster (using function pointers instead of state values for instance).
I would agree that an FSM would be best for a fighting game situation. Assuming some things about the style of your game, the matches don''t last all that long so trying to have the opponents "learn" how to beat you would be kind of silly. Besides, those are a little more difficult to manage and slower; since speed is a huge concern, learning AI is out.
You''d probably also want to fuzzy up your logic so you can present the concept of difficulty. So for instance, if the character is standing still and the player starts an attack, you can have it that on the easiest difficulty, there''s a 20% chance he''ll block, a 5% chance he''ll counterattack and a 75% chance he''ll do neither.
But at the hardest difficulty, you could have it that there''s a 40% chance he''ll counterattack, a 40% chance he''ll block and only a 20% chance of him doing nothing.
These are suggestions of course... Anyway, look into Finite State Machines and how they work. They''ll do you well for this.
-Auron
I would agree that an FSM would be best for a fighting game situation. Assuming some things about the style of your game, the matches don''t last all that long so trying to have the opponents "learn" how to beat you would be kind of silly. Besides, those are a little more difficult to manage and slower; since speed is a huge concern, learning AI is out.
You''d probably also want to fuzzy up your logic so you can present the concept of difficulty. So for instance, if the character is standing still and the player starts an attack, you can have it that on the easiest difficulty, there''s a 20% chance he''ll block, a 5% chance he''ll counterattack and a 75% chance he''ll do neither.
But at the hardest difficulty, you could have it that there''s a 40% chance he''ll counterattack, a 40% chance he''ll block and only a 20% chance of him doing nothing.
These are suggestions of course... Anyway, look into Finite State Machines and how they work. They''ll do you well for this.
-Auron
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement