Hello, can anyone give me any tips/hints on working out collision when making a Arcade Fighter? If you want specifics its going to be made using SFML and C++. Also, any programs that you would recommend to make the characters in? Any help would be appreciated.
2D Arcade Fighter Game,
Members - Reputation: 1198
Posted 13 May 2014 - 05:46 AM
I assume that you want to develop an arcade fighter as "Street Fighter". I also assume that you will use sprite-sheet for your characters. Given that for pixel perfect collision you should calculate for each stance/animation in the sprite-sheet which pixel is empty and which is part of the fighter. Then in every Update method in which you detect for collision you do:
1. take the current animation of both fighters and their respective position
2. check if rectangles (around the characters) collide
3. if they do then you do check for each pixel of the colliding part of both rectangles and if there are pixels that are from both characters then you have a collision
The algorithm for step 3 is pretty simple, I think you could easily find it online, I could give you the code too.
Of course those calculated arrays with empty/non-empty pixels should be already loaded and re-used every time in the collision detection. Calculating/Loading them on the fly will be a killer
Crossbones+ - Reputation: 1368
Posted 13 May 2014 - 08:20 AM
To answer the art question posed, the program you make the characters in doesn't matter as much as the tutorials you follow. It's generally more about the technique than the technology. With that said, start with:
1. MS Paint.
2. GIMP (free) or Photoshop (costs money)
Members - Reputation: 204
Posted 13 May 2014 - 08:59 AM
I've also been thinking about how to handle collision detection in fighting games, so I did some research about it and I found some pretty cool results. Some games use the pixel perfect approach as DpakoH mentioned, But there are others who use a collection of "Hit Boxes" for each frame of animation. The fighting game Skullgirls uses the Hitbox method. Here is a link so you can get an idea of how it works.
While hitbox detection is most often faster than pixel perfect collision detection, you have to manually create the hitboxes for every single frame ,of every single animation and for every single character in your game, while the pixel perfect method only needs the image data. But in my opinion I think hitbox detection is the way to go. It makes it very easy to specify which parts of your character are Hurt areas (Areas that can be hit by attacks, such as the torso, head ,etc.), and which areas are Attack areas (Areas used in attacking, such as, fists, legs, weapons, etc.). Though the downside is that it will most likely be tedious to set up, unless you make some kind of external program to make editing the hitboxes for your characters easier. But then again the same thing could be done with pixel perfect collision detection if you use a separate set of images along with the original image data that specifies the hurt and attack areas. For example you could color the hurt areas blue and the attack areas red. Then when you do the collision detection, you just get the color of the pixels that are colliding and determine if its a successful hit or not. But this would make your game take up more space due to the extra image data.
Edited by xinfinite33, 13 May 2014 - 09:01 AM.