the science behind fighting game


#1

Hi:

I want to produce a flash based fighting game, a la street fighter. I’m a graphic designer, so i can take care of the character designs and animations needed, but programming is more of a hobby for me, so I’m not that skilled on actionscripting.

I need to know what’s the logic applied to the events on a fighting game, and how the AI is programmed… I’ve guessed that it responds to a lot of “if” statements, but think that i would stress the CPU too much to run smoothly. Any hints on how to tackle this kind of game programming?

I have seen a shockwave based fighting game of the Teen Titans wich turned out pretty good, with special moves and everything. Does anyone knows if you can make the game in flash and then import it on director to use its more powerful engine?

another thing: how are the “special moves” commands issued? I mean, the “down-downforward-forward + punch” type of thing…

ok, any help would be greatly appreciated


#2

Greets Flash programmer.
We (me and my Dev team) were going to develop A SF Game too.
But were programming our own 3D Engine and now we need 3D modellers and 2d / 3d graphics men :slight_smile:

We would like to invite you to join us if u want :slight_smile:

i posted another topic here in this forum explaining what we have and were going to do.


#3

Im wondering why my replies and posts wont appar immmedietly…


#4

Thank you so much for your proposal, DeathRay, but this particular project is going to be my final work for college, to get my grade as graphic designer, and it is based on a thesis about communicating national identity through videogames and animated series, so my concept and character designs are already decided, and they all are heading to 2d cartoon look.

But, maybe we can keep in touch, if you want, and I can be of help in the graphic design area of your game, and I can ask you for help when I’m stuck with the code.

Thanks again

salut!

Sir Patroclo


#5

Hey, Sir Patroclo.

First off, let me suggest that you head over to Flashkit.com’s game forum; there are plenty of talented people there who will be happy to help you out. Specifically, look for a guy named Marmotte. He has an open-source fighting game that’s one of the better ones I’ve seen. Tell him I sent you. :slight_smile:

What you are assuming is correct; basically you will have to code every conditional to get the game to work. But Flash supports OOP, so it isn’t too difficult if you know what you are doing.

Flash can handle a game like this, but Director is definately more powerful when it comes to scripting; the main advantage of Flash over Director is its smaller plug in and penetration. If you are planning on delivering this via the web, go with Flash. If you want to put it on CD, use Director (although I find Director’s Lingo to be much harder than Flash’s actionscript, and if you are not a good programmer yet you might encounter some trouble).

In order to check for special moves, you should use arrays to store player key strokes. For example, the player presses the right key. The program adds the value ‘right’ to the end of an array called ‘moves’. Then, it checks each value of the array to see if they match a pre-determined combination. Below is a quick example in pseudo-code:


// establish the array
player_moves = new Array();

// set special move sequences
fireball = "down,right,punch";
axe_kick = down,right,kick";

// function to add values to the array and check the sequence
char_attack = function(attack){

char.gotoAndStop(attack);
// playes the animation of the attack

player_moves.push(attack);
// adds the last move to the end of the array
sequence = player_moves.toString();
// sets the var sequence equal to the moves in the array

for (i=0; i<player_moves; i++){
if (sequence == fireball){
char.gotoAndStop("fireball");
}else if (sequence == axe_kick){
char.gotoAndStop("axe_kick");
}
}

char.onEnterFrame = function(){
if (key.isDown(key.PUNCH)){
char_attack("punch");
}
}

hth. If you have any questions about this, feel free to ask here or at FK.


#6

Hi JapanGreg:

Thanks a lot for replying. I went to FlashKit with some of this doubts but nobody answered me :hmm: , and, now that you mention it, lookin for threads about fighting games found out about Marmotte and his games. Got hands on his sample file of capcom vs snk with a playable Terry Bogard, but didn’t get all of the general structure. And I surely don’t want to rip off his code, first because it’s wrong, I don’t get to learn how it works and i can’t personalize to my specific needs. So I thought that starting from scratch would be better, knowing the main idea behind the code. Perhaps I shouldn’t try to reinvent the wheel either :stuck_out_tongue: .

I’m planning on delivering the game through the web mainly, so I hope Flash can handle it.

Thank you so much for explaining the movement code, it surely gave me a better idea of what i should aim for.

Have no doubt that I’ll take in account your offer of help, but right now in the prodcution process I’m finishing the details of theory and design, just wanted to have the main guidelines of the coding solved ahead. I think now that I’ll do better if I ask specific question of where I get stuck instead of getting anxious about if I can handle the whole thing.

Maybe in that you can give some little advice? on how and where get started when planning code, what things to take in account… what I’ve done with actionscripting so far is, I think, of intermediate level, with great dosis of imagination to solve problems, but a little indisciplined indeed.

Thanks again

Sir Patroclo


#7

Greets “Sir P”
of course lets keep contact :slight_smile:

And good luck with ure exams :slight_smile:


#8

Sorry to hear that; I found your post from Dec. 15th. Usually the people at FK are very helpful… the only suggestion I would make is try to start your own thread on the subject instead of replying to someone else’s; that way people can’t miss the question.

Marmotte created that file as a learning tool, so I’m sure he wouldn’t mind if you use it as a basis for your game, although I agree that using the code en masse wouldn’t be the best idea. But it is true that you will get the best results from creating the code yourself. (glad to hear you aren’t afraid of hard work :wink: )

How you structure the code really depends on what types of actions you need to happen; when approaching a game like this, I use an approach called control frames. Basically, I utilize the onEnterFrame handler of nested movie clips to simulate conditionals of the character status. This lets me code moves quickly and add things like combos, etc. while limiting the amount of code and the number of keys used in the game. Depending on how you need your characters to function, this might be a good approach for you. However it isn’t a very advanced technique, and I’m not sure how the approach impacts performance of larger games.

I’ve written a lot of posts on the control frames theory on the FK boards; if you search for my user name and the term control in the games forum, you should be able to find them. If you would like a better explanation of it, let me know.

hth get you started. Good luck! :thumbsup:


#9

JapanGreg, I’ll search for your threads, study them and come back to you if I have doubts

Thank you both, always amazes me (and inspires me) the good will of people towards strangers over the internet.

best regards

Sir Patroclo


#10

you can randomize moves and give a player certain options…its basic ai…but never use STRINGS in any language to comepare to basic things…Enumerators are much better for that and use bit values … making it much faster… do you just need a simple ai…you can just do that with nested ifs…


#11

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.