don't click here

[1.0 Final] Hedge Physics - 3D Sonic Engine on Unity.

Discussion in 'Fangaming Discussion' started by LakeFeperd, Nov 12, 2016.

  1. LakeFeperd

    LakeFeperd

    Member
    295
    1
    16
    Spark the electric jester
    http://youtu.be/lckFZgyxgoY

    New video of the stage.
    Camera system is still pretty glitchy and there is a lot of stuff to iron out, but it's something I guess.
     
  2. Chimera

    Chimera

    I'm not a furry. Tech Member
    1,272
    17
    18
    Castlevania prettyness
    Looking good so far man. Physics seem to work like a charm, though I'd rather judge when I get the chance to test myself (travelling right now). Some noticable kinks at the moment though I'm sure you're aware of most of them already and are planning on ironing them out. Nice prototype level design too. I take it you're a fan of machines-in-the-sky like myself :v: not enough love for Egg Fleet like levels.

    One thing I might say would benefit you is putting in actual walls, i.e. a mode of wall-running in select areas so moments like 0:34 don't happen unintentionally as that can disorient the player if impropperly done. The level design itself wasn't an issue as much as not knowing where the hell down is.

    Looking forward to how far this develops. Definitely a polished basegame as it is for sure.
     
  3. SpaceyBat

    SpaceyBat

    Member
    2,034
    289
    63
    United States
    Freedom Planet 2
    I've been playing around with the engine over the past few days and I can't really figure out how the animation system works - specifically, how to add new animations into the system and play them via script. It looks like CharacterAnimator.SetInteger("Action", X) is the way to do it, where X is some number between 0 and 5, but this only covers the base animations. How would I assign new animations to Action 6, 7, 8, etc?
     
  4. Atendega

    Atendega

    Lesser Sea Sponge Member
    577
    0
    0
    Comfy couch
    Collecting insults
    I'll probably be crucified for asking this, but... how about some scripted loops? :specialed:
    + - We're going full-on Adventure, aren't we  
     
  5. Ritz

    Ritz

    Subhedgehog Member
    4,083
    107
    43
    I think some scripting would be a nice feature to have, actually- not full-on automation, but maybe a flag you can set so Sonic's forward vector conforms to a spline. That way you could just hold forward to clear a loop successfully without awkward steering compensation, but you still have the freedom to move left and right relative to that path. The challenge there would be keeping it subtle enough that players don't necessarily realize they're being guided, which they will if they deliberately do a hard turn to break away- maybe there could be some falloff where the strength of the snap tapers off depending on how close the player's directional input matches the direction of the spline?
     
  6. LakeFeperd

    LakeFeperd

    Member
    295
    1
    16
    Spark the electric jester
    I won't be making any sort of scripted path simply because I don't know how, I've been trying to do that for a while but it's a lot more complicated once you actually dive into it.
    If I figure this out I'll be finally be able to add rails and my inability to do so has now since become a meme in sfghq's discord channel.
    Still, you can always just switch to the auto camera in order to do loops.

    I'll probably have to address some of the issues with this engine soon. Although most of them are with the camera system, to avoid any major issues, just disable any sort of thing that makes your camera look at a direction, for dash pads and dash rings, I believe I've added a variable to stop this, so, just uncheck it.

    I'll be fixing most issues as I'm developing the stage and as they come up over time.

    @strife

    Just add a transition from "any state" to whatever state that you want with a new action value, then, click on the transition itself and uncheck the "can't transition to self" box.

    Also, if you're adding a new action in itself, then just add a new script and add it to the action maneger(look at how the others are added, and just do the same for yours). Then, in whatever action the player will be before switching to it, add a reference to the Action maneger script and do a "ActionScript.ChangeAction(youraction);"
     
  7. SpaceyBat

    SpaceyBat

    Member
    2,034
    289
    63
    United States
    Freedom Planet 2
    Ah, thanks! I got it working.

    I actually see where my problem was - I completely missed the Conditions list when clicking on a transition, so I filled that out and it's good to go.


    As far as rails go, what I would suggest is that if your current physics engine isn't playing nice with what you want to do, disable the physics entirely when Sonic jumps on a rail and switch to a new physics script that's specifically built around rails. When you think about it, if you disregard all the twists and turns, a rail is basically a straight line on a 2D plane. The trick is to first figure out how to move Sonic along the rail at a set speed, and then adjust his velocity based on the curvature. Lastly, disable the rail script and re-enable regular physics when he jumps or falls off.

    It sounds like a similar technique to camera rails / splines could be used for Sonic? Google "unity camera rail" and you'll see what I mean.
     
  8. LakeFeperd

    LakeFeperd

    Member
    295
    1
    16
    Spark the electric jester
    Yeah, but there's also a problem on getting the closest point to the player and the spline, which I still need to figure out.
    Also, If this system is to go public, then it also has to be easy to use for new users, which poses a new challenge.

    I'll figure this out eventually.

    For those who don't know, you have to code a spline from scratch for this and it's not easy.

    Anyways, considering my goals with this engine, I feel like I'm going to be working on it for a long time now.
     
  9. I like this a whole lot, and I think you've made some phenomenal progress. I had two things that I'd love to see changed, but they're both a matter of preference.

    First, like Atendaga said and you responded to, the homing attack feels way too guided. It seems like if it had a shorter automatic lock-on and a narrower direction cone, that'd make it feel like more of a challenge to chain several enemies rather than a "Mash A to Get Through" section.

    Second, the Sonic model you've made is SO GOOD. I love its design and the animations, particularly the running. One nitpick though, the muzzle isn't rounded enough, so it makes him look a little top heavy, or like he's got an underbite. But again, preference.
    [​IMG]
    Left is Original, Right is Changed.
     
  10. LakeFeperd

    LakeFeperd

    Member
    295
    1
    16
    Spark the electric jester
    So, guys, I'm sorry to say that I haven't been working on this engine for a while now, last month has been pretty bad for me as I've been dealing with a couple issues and doing my best to finish spark in time.

    Anyways, If anyone needs any help, you can join my discord server: https://discord.gg/fR2mmSn
    Feel free to join, anyone is welcome at this point.
     
  11. Just-in

    Just-in

    Member
    5
    0
    0
    I have been wanting something like this forever! Thank you so much! :)
    I am finally being able to make my own Sonic games in Unity as perviously all I have made is silly games based off of other games e.g Floppy Sports is a silly ragdoll version of real and fake sports.

    But really this kind of thing deserves a lot more attention but at least it has more attention than any of my games (lol)
     
  12. LakeFeperd

    LakeFeperd

    Member
    295
    1
    16
    Spark the electric jester
  13. Amnimator

    Amnimator

    Member
    224
    0
    16
    All in all, I feel analog sensitivity for controllers should be less. It should be even less when moving at slow speeds. An idea is to have turn sensitivity be dynamic with player speed. I also found my self having to wrestle with the free cam.

    Also, found a piece of code that can potentially break things in the slope detection script:

    transform.rotation = Quaternion.FromToRotation(Vector3.up, GroundNormal);

    I was doing slope detection in Unity too, and you have to be careful about what's going on. By asking from Vector3.up to ground normal, your code will break at a slope of exactly 180 around the forward axis, or at least when you can't specify which way the angle calculation goes. I emphasize this because you likely can't replicate this with a model import from Blender. Floating point precision and all makes it so 90 degrees in Blender is something along the lines of 89.99999. I haven't tested this out in HedgePhysics, but came into a similar issue in another project:
    You're asking Unity to take 2 Vector3s and calculate the angle between them. Thing is, say we have a Vector direction of (0,0,1) and our current Vector direction is (0,0,0). How would we rotate between them? You can't specify whether you just want to turn around or do a back flip on your head. Whenever something like this happens, Unity will wrestle with the 2 results and basically just break Slope detection at that point. This part is just me spit-balling but this can also explain why Blitz Sonic has a similar bug at certain angles.
    What I'd say would be a fix for this is something along the lines of:

    transform.rotation = Quaternion.FromToRotation(transform.up, GroundNormal) * transform.rotation;

    Anyway, what this does is take your current slope direction and compares it with the ground normal direction and gets the rotation between them. It then takes your current transform.rotation and applies that on top. Quaternion multiplication really just means to rotate by this. Something to also note is how Quaternion multiplication is non-commutative, so keep track of multiplication order!

    All in all, nice job LakeFepard, HedgePhysics is really looking good.

    EDIT: Cleared up clarification a bit and grammar. Sorry mods for the amount of edits I do on my posts :V
    EDIT: Super late edit. Removed some incorrect information.
     
  14. LakeFeperd

    LakeFeperd

    Member
    295
    1
    16
    Spark the electric jester
    1.0 is out! Check out front page for links.
    [​IMG]
     
  15. Andrew75

    Andrew75

    Technical Artist Member
    2,030
    107
    43
    Project AXSX(Sonic Xtreme) + Misc Projects
    I haven't played this yet, but in regards to controls and sensitivity, are there options to adjust that exposed in an options menu? Plus if adding sensitivity vs speed , I think being able to adjust how that works in options would be a good way to play test to get something comfortable for the player.
     
  16. BlazeHedgehog

    BlazeHedgehog

    A "Community Enigma"? Oldbie
    1,467
    11
    18
    Maybe it's just a feature of the test level, but when the camera is scripted to switch to another angle, it's way too fast and incredibly disorienting.
     
  17. Violet

    Violet

    Member
    150
    2
    0
    Sweden
    Flicky Engine, Overdrive
    @LakeFeperd Is there any way to remove the weird camera shake when you perform a spindash?
     
  18. Felik

    Felik

    Member
    1,845
    78
    28
    I'm pretty sure there is considering it's an opensource engine