Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Rhythm Games problematics solved ?

Discussion in 'Input System' started by BenouKat, May 4, 2019.

  1. BenouKat

    BenouKat

    Joined:
    Feb 29, 2012
    Posts:
    222
    Hi !

    I'm documenting a lot about the new input system, and it seems awesome.
    I'm making a ryhthm games, with a hard timing.
    Back in time in Unity 4 (yes), I wasn't able to do what I want since the old inout system was not reliable enough on WHEN the user exactly hit a button. But I want to do it again nowdays.

    I've a simple question : I've reading a lot of things about framerate independance, this thread was a LOT of info i've needed.
    But I test the input myself and i'm also getting lost about this frame situation, and what contains the CallbackContext.startTime information you get when you receive an input event in Unity ?

    I've tested it a bit, i'm also get this "fixed frame gap" by testing it at low framerate, like :
    Time = 0.1734
    Time = 0.1738
    Time = 0.1988
    Time = 0.1993
    etc...

    To be clear : I don't mind having the event late. My only need : I want the exact (or as exact as possible) time the player hit his button (I mean the time the OS says "hey ! He pushed that !").
    In modern hardcore Ryhthm Games, timing window can be below 20ms. Having a 16.6ms of potential error window when running at 60fps with the old system is way too bad. I was hoping so much the new system fix that by simply giving the info more precise that "An input hapenned last frame, bro."
    And by more precise, I need to know exactly when, during the elapsed frame, the input has been triggered. (Of course the question of gamepad that have a bad polling rate, or OS that send the event at a bad rate is another subject you can't do about, i'm just talking about Unity part.)

    I've read the doc about the data stored in each event gathered. It contains the variable "time" with the timestamp I look for : the timestamp of when the input has been catched by the "background" process.

    Can you confirm that the value stored in CallbackContextt.startTime is this "time" I'm looking for ?
    If no : How can I get this value ? It is possible ?

    Thanks a lot :)
     
  2. BenouKat

    BenouKat

    Joined:
    Feb 29, 2012
    Posts:
    222
    Hi ! I'm sorry to bumping this, I'm still hoping fir an answer.

    I add a TL;DR :

    Does CallbackContext.startTime gives the "closest-to-reality" time of when the input as been pressed by the user ?
    If not, where do I get this time ?

    Thanks a lot !