🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

AI in beat' em ups???

Started by
4 comments, last by majuranus 23 years, 1 month ago
I really need some help here. If you could tell me somethings about AI in beat''em ups like mortal kombat or street fighter... How is that happening??? and an other thing. If i have a 3d object from 3d studio, can i use it to visual c++ as a fighter..?
The games rule. But how you make it is the issue!
Advertisement
Beat-em-up AI is pretty simple. Basically all you need to do is assemble all the possible moves your fighter can make for a given situation (for example, position, strength, the other player''s position, etc) and pick one at random. For example, if the player has ducked to block your last attack, your figther should choose one of the "low" attacks. Or if the player is in the middle of an attack, you could choose to block. You have to make it a little less "perfect" than that, if the player is in the middle of an attack, then your player should have a chance of not picking the block move.

As for your other question, that''s best asked in one of the graphics forums. I will however tell you that it''s not easy. One way it to write an exporter plugin for MAX which writes the object to a format you can read. Another is to use a library which will import a .3ds file (or whatever.) Then you gotta think about your 3D API (the age-old DirectX vs. OpenGL debate) and yada yada yada.

War Worlds - A 3D Real-Time Strategy game in development.
There is a programming contest called "RoShamBo" which has two code variants battle it out in a match of Paper-Rock-Scissors.

Most fighting games are just elaborate paper-rock-scissors games...

Alot of the good programs will analyze patterns and habits...

While some are really silly and do stuff like use the digits of PI to determine what move to use...

But total randomness is rather lame..

My suggestion is to give each character a unique (but not random)fighting pattern..
thanks a lot gyus. I''m gratefull.

Is there anyone that could write me a skeleton program for AI in beat''em ups? I don''t mean writing the entire program. I mean write me a small push to start. I''m writing openGL, Visual c++
I would be gratefull if someone could do this. ANd let him know that he shall be the first receiver of my game!
The games rule. But how you make it is the issue!
majuranus, I don''t think anyone is going to write your code for you; it''s a problem that you must solve yourself. As for the 3d object from 3d studio, sure you can load it in; the process involves opening the file from within your program (it being coded to do so) and reading in the data, storing it in memory in some sort of data structure that you design, and then later using that memory to render and otherwise use it in the program.

As for the beat ''em up AI, I like the idea of giving each individual AI opponent a distinct personality. Maybe one guy will jump a lot more than other people, one character might focus primarily on leg attacks, while for another guy it''s fireball, fireball, fireball...There are a lot of different things you could do. One idea is to give each AI a few tactics it can try, and give it a sort of statistical counter, which would keep track of the average damage it would do or receive when trying a particular tactic. You could then, naturally, have it choose to execute the tactic that let it deal the most damage while receiving the least damage. Such tactics may include combinations of jumping and attacking, rushing, special move combinations, etc. You''d also want the AI to vary it''s attacks - probably by trying out the different tactics.

I find any sort of learning and "higher-level" forms of AI to be very interesting, and here is a perfect opportunity for an application of such a thing. You could even save what it learns (in whatever sort of data structure you decide to keep it in) in a file that the program can load the next time you run the game, so that the AI continues to "learn" with each new time you play it. I think this would be bueno.

I imagine a tactic might be a scripted attack sequence, complete with pauses between moves. Hmm...I myself am making a fighting game, and I just might try employing this sort of tactic/learning technique. What do you think?

- Hai, watashi no chichi no kuruma ga oishikatta desu!
...or, in other words, "Yes, my dad''s car was deliscious!"
- Hai, watashi no chichi no kuruma ga oishikatta desu!...or, in other words, "Yes, my dad's car was delicious!"
Fighting games are all about personality. Think about it. In StreetFighter you had aggressive fighters, luring fighters, blitz-ing fighters and so on. You also had patterns and deterministic responses. For best results I suggest at least mixing all three of the above, along with anything else you may choose to implement (learning, etc).

Personality is simply repeated actions, or tendency. So define the probability that a player would be in one of a number of moods - say agressive, retractive, baiting, calm, kamikaze, etc. Use random numbers to select from these stats (the higher distribution of some states will result in those states being chosen more often, and yes, that''s a Finite State Machine).

// the state variable will represent the current state// states[] represents the probabilities of all the states,// distributed in percentages. ie the first x% are state 1,// followed by y% of state 2...int state;int states[NUM_STATES];..state = rand() % 100;   // probability in percentageswitch(states[state]){case STATE_CALM:   // do calm stuff   break;case STATE_KAMIKAZE:   // attack suicidally   break;..} 


Patterns are a string of inputs, but in this case you may want to define ''trees'' along which the pattern can branch, allowing your characters to vary their actions and to combine them in sequences. And deterministic responses are the simple cases of "if the opponent does this, do this".

// pattern is a tree-like struct that contains frames as nodes,// each of which contains one or more pointers to another,// "sequentiable" framenext_pattern_frame = pattern.frame[j].next[rand() % nOptFrames[j]];DoPatternFrame( pattern.frame[next_pattern_frame]); 


Good luck!


---
Those who can do nothing criticize; those who can, critique.

This topic is closed to new replies.

Advertisement