Search Unity

SkateBoarding Game

Discussion in 'Physics' started by SuperVoximus, Aug 10, 2015.

  1. SuperVoximus

    SuperVoximus

    Joined:
    Nov 5, 2013
    Posts:
    102
    Ok, I've made a few posts about this in the past, but they never got anywhere. I am a huge fan of skateboarding games such as the Tony Hawk Pro Skater games. I've been trying to make a skating game for a very long time, but the complexity of the sport made it very hard to replicate.

    So maybe we can figure it out together. The goal of this thread is to slowly discover viable techniques to make the basic mechanics of a skateboarding game.

    A few main topics to tackle would be Basic Movement and Air Control, Grinding and Tricks.

    I once tried to use Translation to simulate a moving skateboard, yeah, that went terrible :D It was decent ground control, but the air control was absolutely terrible.

    Let's start with the basic movement, any ideas anyone? Perhaps rigidbody physics based?
     
  2. ironbellystudios

    ironbellystudios

    Joined:
    Jul 21, 2015
    Posts:
    410
    I say go back to Skate or Die! That was game was the best :D
     
    JamesArndt, Meltdown and KingLlama like this.
  3. SuperVoximus

    SuperVoximus

    Joined:
    Nov 5, 2013
    Posts:
    102
    I was looking for something more like tony hawk pro skater :D
    It's so frustrating because using Translation my skateboard goes crazy in the air and its unplayable, using something like addforce flips the board instead of pushing it forward.
     
  4. ironbellystudios

    ironbellystudios

    Joined:
    Jul 21, 2015
    Posts:
    410
    I know, I know, I just get all nostalgic. I suspect something with rigid body would in fact be possible, but its not going to be an easy problem to fix (in fact, its practically the whole game to get it right).
     
  5. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Translation just means moving something, or maybe you mean you used the Translate() method, either way you didn't simulate it 'with translation' - you wrote some code to simulate it.

    Given most of the game is about the physics of the movement I expect its best to write custom physics code. Unity physics will get your started pretty quick, but you will run in to a lot of edge cases: by the end of the project 90% of physics code would be custom anyway.

    I'd still stick with a rigidbody, but make it kinematic, that way it can still bang in to things, but you can control its movement.

    • Start by assuming the skateboard is a plane, calculate the force to apply based on the slope of the plain and the direction it is facing.
    • Initially stick with moving in the direction of the wheels (later you may want to consider sliding... but you can fake this with animation depending on your needs).
    • Add turning (probably via a small rotation which given you move in the direction of the wheels should do the trick).
    • In the air the movement should follow the standard gravity equations (spinning can be animation only, and the choice between going over something and going up and down something can probably be determined at the start of the jump based on ramp angle and user input)
    • Work out some basic crash mechanics (if force is X amount different to wheel direction then fall)
    • And so on...
    Get each piece right then move to the next.
     
    ephor likes this.
  6. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    If the movement you had was fine on the ground then use that when grounded & have a tweaked movement for in the air. I have a script for platformers in game jams to give me a quick & dirty start place that has wind effects when not grounded, physics movement to simulate moving on ice, different movement when on normal ground & just set bools based on the collider tag for whatever they are on & use the relevant movement code.
     
  7. SuperVoximus

    SuperVoximus

    Joined:
    Nov 5, 2013
    Posts:
    102
    Thanks for the reply guys, it all helps a lot :D

    I loved the time and effort put into the posts and I'm glad to say I am finally getting some good ideas flowing. I'll be working on this for a few hours or so, if I make any progress I'll be sure to share some ideas!
     
  8. dev01

    dev01

    Joined:
    May 3, 2010
    Posts:
    21
    Any progress? I'm interested in the code for it as well
     
  9. SuperVoximus

    SuperVoximus

    Joined:
    Nov 5, 2013
    Posts:
    102
    Sadly, I have not made much progress, after seeing my project fail over and over again, i thought I'd try to use a character controller instead, after that failed, I tried to use rigidbody movements. Every single one of the methods I've used has failed one way or another. Perhaps the sport is too complex in nature, or maybe I don't have the skills needed. It seems my dream of making a good skateboarding game will remain a dream.
    I still play Tony Hawk Underground 2 on my PSP almost everyday, I have litterally thousands of hours spent on the Tony Hawk Pro Skater franchise, and I truly believe I could create a very enjoyable game, if I could only get the technicalities sorted out.

    I'm sorry guys, this is a first timer for me, I've never been beaten to the ground like this. Every time I struggled with technicalities, I would find some way to solve the issue. But here, there is just no way for me to do this.

    I am putting my ego aside, and admitting that I am simply NOT GOOD ENOUGH of a game developer to figure this one out.

    Any further help/ideas will be greatly appreciated.
     
  10. Andreas12345

    Andreas12345

    Joined:
    Oct 17, 2013
    Posts:
    526
    I ve done so far this http://www.instructables.com/id/Arduino-driven-Balance-Board/
    For next, i have ordered some skatboard trucks and will mount they with some tilt sensors and MPU 6050 on a board, so i have the body controler ready.
    The steps for tricks etc... you need a team to make this all how do you like it. Thats the hard part. :)
     
  11. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Keep it simple.

    Use a vehicle physics package for the skateboard for turning etc.
    Then for tricks, use animations for the board. Obviously you'll need to disable the vehicle physics while doing animations.

    Then use animations for the character as well.

    Think of a character standing on a vehicle.

    Thats how I would approach it.
     
  12. Dubtoker

    Dubtoker

    Joined:
    Feb 11, 2016
    Posts:
    6
    um, you using wheel colliders for the wheels bro??
    I dont agree with downloading packages... they never what you really want to achieve and hell someone else made it...
    I like to know how to make everything....
    Make 4 wheel colliders that are inside an empty object , thats parented to skateboard object, thats parented to an empty "player" object ... put the player animation object parented to the empty player object...

    this way everything inside the empty player object can be animated in one single animation,
    make sure you create animation attached to the "empty player object", then all children can be animated inside one animation...

    Also if ya using a follow cam type script, maybe put the "empty player" object at players head height, and set the script to follow that.. then ya can get better follow angles aiiii

    if you wanted too, and i sometimes do this (bit of a cheat) make a player object for each required animation and just use a code like "gameobject.SetActive(true) or (false) for each trick you want the player to do..

    then have an "idle" character / gameobject to start game with,
    when Input is detected, disable "idle" character , enable "moving" character/ gameObject.... you could use Mathf.Abs(rigidbody.velocity.magnitude) to speed up player skating animation depending on rigidbody speed.

    then when ya want to do a trick ya can "gameobject.setactive(false) to all. Then set the trick player object to true,
    like i said a bit of a cheat way but it works and uses way less complex coding...

    Apologies if my way of explaining is odd but not good at that hahahaha
    ask me if ya not sure what I mean...

    Also if ya want some tricks that are activated with multiple button inputs???

    you could use a "timer loop" like an INT that counts down, waiting for next expected button.

    you could make boolean game states, ie If Player is in air - boolean - inAir = true;
    then if a button is pressed it could have a different function.

    if(playerinAir == true && playerSpinning == true && Input.GetButton("Fire1") == true)
    {
    idlePlayerObject.SetAcvtive(false);
    movingPlayerObject.SetAcvtive(false);
    nollie360PlayerObject.SetAcvtive(true);

    }

    or both together?? not sure how its done proffesionallllly?? never looked into it just my own hack method =)

    put the RIGIDBODY on the "empty player" object.

    Use MotorTorque on all 4 wheels at same time, to simulate a Skate Push.

    Rotating the "empty player" object should rotate all objects inside.

    You could make joints in unity that attach the front and back wheel colliders to the skateboard
    so the board could tilt from side to side?

    Consider having skateboard ANIMATION objects for each trick... and use SetActive "hack"??? or probly some other simple way to do it..

    ok um all mi ideas at mo... please I might be so wrong ... but maybe help someone i hope, please feel free to quiz me, i would also help with coding these ideas... they are of top of mi ed soooo .. peace
     
    Last edited: Mar 21, 2017
    kodagames and qster123 like this.
  13. GamePyro-com

    GamePyro-com

    Joined:
    Jul 28, 2018
    Posts:
    197
    Any asset or controller to start with we only want it as side feature / fun feature at our game not at main also for winter season snowboard.