Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Making an Arcade Beat 'em Up

Discussion in 'Editor & General Support' started by AceSV, Aug 23, 2014.

  1. AceSV

    AceSV

    Joined:
    Dec 16, 2012
    Posts:
    20
    I love the old 2.5D beat 'em ups. I have made a few with Flash and Game Maker, but I think going full 3D would solve a lot animation hardships, so I want to try it in Unity now. I'm new to Unity and 3D programming in general, so I don't know what Unity features I'm even looking for. Any kind of advice you guys might have would be great. I did google around for Unity Beat 'em Up and Unity Melee tutorials, but the things I found seemed kinda half-hearted and not strong enough to get me where I want to go.

    If you're not familiar with 2.5D beat 'em ups, some popular titles included Golden Axe, River City Ransom, Final Fight, Streets of Rage, King of Dragons, Double Dragon, Battle Toads, Scott Pilgrim vs The World and Micro Super Defense Force (just kidding, that one's mine). The modern Dynasty Warriors series is very similar, but I want to avoid the constant butt-view in my own games.



    In case it helps, the way I used to make beat 'em ups in 2D was with a blit engine, meaning the graphical representation and "physical" representation were uncoupled. Each brawler character object was basically a box with xyz coordinate and size, which contained a variable for its spritesheet and current frame. In the main loop an "artist" function would pass through all of the brawler character objects and draw them onto the screen each frame. The switch from blit to 3D is a little weird, at best. I may end up using box or cylinder colliders when I do it in Unity to keep it easy, although I'm afraid that might fail if I try ragdoll physics or switch to states like ducking or lying down.

    The way I programmed attacks was using big timeline events. This might look like:

    var timeline_index;
    var timeline_position;
    var timeline_done;
    var timeline_speed;

    const TL_PUNCH;

    ButtonPress(){ timeline_index = TL_PUNCH; timeline_position = 0; timeline_done = 0; }

    //in the main loop somewhere
    if(timeline_index == TL_PUNCH){
    timeline_position += 10*timeline_speed;

    if(timeline position >=40 && timeline_done <40){
    sprite_frame = 36; //might indicate winding up for the punch
    play_sound("whoosh");
    timeline_done = 40;​
    }

    if(timeline >=60 && timeline_done < 60){
    sprite_frame = 37; //half extended fist
    timeline_done = 60;​
    }

    if(timeline >=80 && timeline <100 && timeline_done < 80){
    sprite_frame = 38; //fully extended fist
    //hitbox would create a collision checking box at x,y,z with the size and parameters specified.
    //hitbox returns true if it collides with a valid target.
    if(hitbox(x,y,z,xsize,ysize,zsize, damage, force, stuntime, direction, etc)){
    timeline_done = 80;
    play_sound("boff");
    cancombo = true;​
    }​
    }
    //and so forth; ​
    }

    So I know from poking around that Unity's character animation systems are not designed to work that way, and of course, a 3D animation should be smooth, rather than jumping from frame to frame. I would love to be able to just program beat 'em ups in Unity the same way I did in Flash AS3, but as far as I can tell, I can't take direct control in Unity the way that I used to.



    Another surprising steep hurdle for programming beat 'em ups are the menu systems. Rather than simply "press start" and go, an advanced beat 'em up game should have character select, mode select difficulty and stage select, which amount to a lot of variables bouncing that the game then needs to take account of when it creates the scene. Again, from blitting, I'm used to just loading a background graphic, like, background = bg_city; rather than something gotoLevel("city"); Level progression would be handled much like the attack timelines, except instead of waiting for a specific time, it would check if all opponents are defeated.
     
  2. JamesArndt

    JamesArndt

    Unity Technologies

    Joined:
    Dec 1, 2009
    Posts:
    2,912
    This guy actually posted up some very interesting insights into how he's tackling a "beat em up" style game in Unity. Check it out.

     
  3. AceSV

    AceSV

    Joined:
    Dec 16, 2012
    Posts:
    20
    I've seen that already, and it's not really helpful as far as figuring out what to do. Like it doesn't explain by what mechanism a punch is registered against an opponent.

    And really, I already know how to make beat 'em up games, I just don't know how to use Unity. For instance, today I learned that Unity has a Character Controller component that works more the way I am used to than the Rigid Body component. The step and ramp controls are more useful to me than a physics simulation (except that isGrounded() can't handle downward ramps). That's the kind of information I'm looking for.
     
    Last edited: Aug 25, 2014
  4. JamesArndt

    JamesArndt

    Unity Technologies

    Joined:
    Dec 1, 2009
    Posts:
    2,912
    Ahh yes I see where you're coming from now. I am working on a mobile "beat em up" as well. I do a lot of tutorials so maybe this is something I should cover. That or we could connect in IM or something and information share techniques. I have a good character motion working right now. I'm going to set up the hit detection today. I am using this setup.

    http://wiki.unity3d.com/index.php?title=FPSWalkerEnhanced

    I am checking for character grounding as well, but it's with a tiny raycast at the player's feet. It shoots down a small 1 unity raycast down in the Y axis. If it hits a collider tagged "ground" it registers the character as grounded. I can adjust the length of this raycast as well to trigger ground detection on uneven slopes and surfaces as well.
     
  5. ThreeYams

    ThreeYams

    Joined:
    Aug 26, 2016
    Posts:
    2
    Found this series a couple days ago. It needs some of improvement, but it's by far one of the best free tutorial playlists I've found on the subject.