Search Unity

Awake - Beat 'em up

Discussion in 'Works In Progress - Archive' started by awake, Feb 2, 2014.

?

Where do I go from here?

Poll closed Feb 12, 2014.
  1. Add enemies

    0 vote(s)
    0.0%
  2. Fix punch animation to cover more area

    0 vote(s)
    0.0%
  3. Create a different enemy

    0 vote(s)
    0.0%
  4. Focus on art aspects

    1 vote(s)
    100.0%
Multiple votes are allowed.
  1. awake

    awake

    Joined:
    Dec 24, 2013
    Posts:
    49
    This is the link to the build that I will use for all updates:
    http://dl.dropboxusercontent.com/u/241080670/Builds.html


    Awake, a beat em up game full of humans, dinosaurs, and aliens.

    Awake is a 2 player beat em up game where the players will be able to transport between two different worlds to make progress through a story. The story is not explicitly told, but is discovered through the environments and game play. Since there is a teleport feature, certain obstacles will require the player to jump to a different world to complete tasks to go forward, or just for fun. So on top of beating enemies up, there is a puzzle aspect. The game play will be similar to the Ninja Turtles, BattleToads, and Xmen video games. Side scrolling in 3d on a ribbon.

    Seed Story:
    The players start in a house where there is a dinosaur being excavated in the front yard. The first player, Erland Libby, is upset that the dig is going to be rained on and goes in to the house to get tarps. He finds one of the residents of the house, Star, upset in the kitchen. She says that her family disappeared in there beds. She is packing a sack of equipment to go searching for them. A commotion happens outside and "Enforcers" are fighting with the other people at the dig site. Star and Erland rush out of the house and go down into the sewer, armed with an assortment of packed items, and some digging tools....

    Here is Star, the resourceful housewife seeking to find what happened to her family.
    http://imgur.com/FxNZFbA

    Here is Erland, Paleontologist that just wants to kick butt.
    http://imgur.com/fP7AH5q

    Kitchen Scene:
    http://imgur.com/NoHUvNp

    Getting ready to go to battle against a giant sewer slug:
    http://imgur.com/UnjPkEH

    An enforcer:
    http://imgur.com/Vaci1H7

    I said there would be dinosaurs. Here's one I made of a corythosaur. Not really game ready, but I found good reference images to work off of in a book.
    http://imgur.com/BlCpX
    http://imgur.com/XUNkc
    http://imgur.com/60mRW

    http://dl.dropboxusercontent.com/u/2...70/Builds.html


    things not created by me:
    The person is from blendswap but I re-rigged it:

    Name: lowpoly Female base
    Author: jugapugz.
    Premalink: http://www.blendswap.com/blends/view/71086.
    For Blender 2.52 and up.
    Description:
    lowpoly base
    made by jugapugz
     

    Attached Files:

    Last edited: Feb 2, 2014
  2. awake

    awake

    Joined:
    Dec 24, 2013
    Posts:
    49
    How collision works:
    I found this great post about the game Kinetic Damage: http://forum.unity3d.com/threads/19299-fighting-game-Kinetic-Damage-Released
    Within it there is information on how collision boxes were animated separately and how the scale and positions are fed into Bounds collision boxes in unity3d. I figured I would try it out. In blender I made 1x1x1 boxes and scaled and positioned them. I exported as a .x file and use a script to take the .x file and save the collision box scale and position. Make sure that there are no negative scales because Bounds boxes don't work with negative scaling.

    $ScreenShot20140201.jpg

    I wanted to use rigid bodies, but I liked that the shape of the bounds box follows the animations.
    I basically set a rigidbody box collider to match the hitBox bounds collider:
    rigidBodyCollider.center = hitBox.boundsBox.center;
    rigidBodyCollider.size = hitBox.boundsBox.size;

    That reminds me. It was also very useful to use the inspector to connect different parts of the character.
    By using public GameObject mygameobject; or public myclassname localclassname; i was able to transfer a lot of data between different parts of the character.

    Art:
    If you are using blender and Rigify, a good asset from the asset store is Rigify to Unity by Edelweiss Interactive. It removes all of the excess data that Rigify generates and allows you to keep using Rigify.

    I have a friend drawing some characters for me. A big update will be the conversion from the basemodel to some original art work.


    Game Play:
    Right now I know it is hard to hit the other player or enemy. The strikebox is very small and the punch doesnt have much of a swing to it. I know there is going to have to be a lot of tweaking.

    The game is meant to be played with similar controls to the Teenage Mutant Ninja Turtles NES/SNES games. I purposely don't allow forward, backward or angled punches. Only left and right attacks. I felt like that adds a different strategy to the game play.

    I'm open to any comments and any criticism. Thanks!
     
    Last edited: Feb 2, 2014
  3. awake

    awake

    Joined:
    Dec 24, 2013
    Posts:
    49
    Update: Added enemy return to idle state and chase state to latest webplayer build on dropbox link in first post.
    Now the enemy will creepily follow you wherever you may roam. If it gets annoying try to line up 10 punches.

    A note about the AI:
    I actually use the same set up as the players with a few override methods I call Skynet. Since I went through the trouble of putting in command methods that can be used for more than one player, I decided to control the enemy the same way as the player. Skynet overrides all of the GetAxis values and replaces them with floats, and the GetButton commands with bools. The AI then drives the character. By replacing the keyboard controls with the AI, I can use all of the movement methods the same way as with the player. So the enemy can only attack in the left and right directions just like the player, and physics is the same too. I thought this was better than having AI modify the transform directly.


    In player script:
    public virtual void applyControllerState()
    {
    // this void method is overrided by skynet to give it the same controls as the player.
    horizontalFloat = Input.GetAxis(Horizontal);
    verticalFloat = Input.GetAxis(Vertical);
    jumpBool = Input.GetButton(Jump);
    fire1Bool = Input.GetButtonDown(Fire1);
    }

    In enemy script:
    // this method overrides applyControllerState() method in Player1Controller class
    // The Input.GetAxis, Input.GetButtonDown, and Input.GetButton are replaced with AI controlled commands
    public override void applyControllerState() //runs in a FixedUpdate() loop
    {
    // applyControllerState() must return values for
    //horizontalFloat, verticalFloat, jumpBool, and fire1Bool
    horizontalFloat = horizontalInput;
    verticalFloat = verticalInput;
    jumpBool = jumpInput;
    fire1Bool = fire1Input;
    }


    Here is the enemy chase script, I had to use a tolerance to get rid of jerkiness:
    private void moveToGoal(Vector3 currentPosition, Vector3 goal, float tolerance)
    {
    if (goal.x > currentPosition.x + tolerance) //if goal is to the right
    {
    horizontalInput = 1;
    }
    else if (goal.x < currentPosition.x - tolerance)
    {
    horizontalInput = -1;
    }
    else
    {
    horizontalInput = 0;
    }

    if (goal.z >= currentPosition.z + tolerance) //if goal is forward
    {
    verticalInput = 1;
    }
    else if (goal.z <= currentPosition.z - tolerance)
    {
    verticalInput = -1;
    }
    else
    {
    verticalInput = 0;
    }
    }
     
    Last edited: Feb 2, 2014
  4. awake

    awake

    Joined:
    Dec 24, 2013
    Posts:
    49
    http://dl.dropboxusercontent.com/u/241080670/Builds.html

    Update. I added attack and flee states to the enemy. Pretty easy to avoid right now. I am trying to make a text file to go with each enemy that would help adjust the aggressiveness of enemies as well as include things like attack distance.

    Some other good news. the turn around drawings of the 2 player characters is almost complete. I may stop programming a little to work on some blender 3d modeling. I'll post up that progress here.

    I attached a screen shot of the enemy punching one of the players. (sorry that all the characters look the same!) $ScreenShot20140205.jpg
     
    Last edited: Feb 7, 2014
  5. awake

    awake

    Joined:
    Dec 24, 2013
    Posts:
    49
    I fixed the link in the previous post. I also made the 2 players and enemy different colors.
     
  6. awake

    awake

    Joined:
    Dec 24, 2013
    Posts:
    49
    stuckpicture.jpg
    Running into a little problem with collision, when i jump towards a vertical wall the character acts as if it is walking in the air. I can even jump again. If I stop moving the character does fall normally. Has anyone else run into the same problem?
    http://dl.dropboxusercontent.com/u/241080670/Builds.html

    Also, anyone know how to remove a poll from a Forum post?
     
    Last edited: Sep 8, 2014
  7. awake

    awake

    Joined:
    Dec 24, 2013
    Posts:
    49
    I updated the scripts. I'm using a raycast downward instead of OnCollisionStay to detect the ground. <above links updated>
    Code (CSharp):
    1. private void checkGround()
    2.     {
    3.         distToGround = hitBox.boundsBox.size.y/2;
    4.         grounded = Physics.Raycast(hitBox.boundsBox.center, -Vector3.up, distToGround + 0.05f);
    5.     }
    Future updates will use 4 raycasts on the edge of the hitBox/rididBodyCollider. this will avoid the current problem where if the character is at the edge, you can't move anymore because the ground is no longer detected through the center of the character.
     
  8. calmcarrots

    calmcarrots

    Joined:
    Mar 7, 2014
    Posts:
    654
    Not really sure what is going on in the game. Please organize your thread better. Looks like you put a lot of work on it so good job so far.