Controller lag and inaccuracy

124»

Comments

  • AyrikAyrik Posts: 429Member
    Changing it from event. will not allow the OuyaController to change the axes based on its controller mapping system. I copied it directly from my code, so there's obviously something different here. Which version of the ODK jar are you building from?
    Saga Heroes - Adventure RPG
    image image
  • VAMflaxVAMflax Posts: 44Member
    0.0.6
  • tgraupmanntgraupmann Posts: 2,869Administrator, Team OUYA
    0.0.6 includes "1C". There's "1D" which includes the pause fixes.

    The 0.0.6.1 minor update will be coming next week.
    ~Tim Graupmann
    OUYA Inc | Android Developer
    Skype: tgraupmann_prey

    http://github.com/ouya/docs
    http://github.com/ouya/ouya-sdk-examples

    Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]

    Use caution when setting [persistent wireless mode].
  • VAMflaxVAMflax Posts: 44Member
    What are the pause fixes?
  • tgraupmanntgraupmann Posts: 2,869Administrator, Team OUYA
    When you hit the system button it exits and unity stops playing music/running.
    ~Tim Graupmann
    OUYA Inc | Android Developer
    Skype: tgraupmann_prey

    http://github.com/ouya/docs
    http://github.com/ouya/ouya-sdk-examples

    Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]

    Use caution when setting [persistent wireless mode].
  • MonzerolMonzerol Posts: 9Member
    edited March 2013
    Chiming in to say THANKS A TON to everyone who contributed to this thread. You guys saved me lots of time for eliminating the controller latency in my project :)
    Post edited by Monzerol on
    Takusan Works - Programmer, Composer
    Check out our game, Shuttle Rush!
  • EMcNeillEMcNeill Posts: 47Member
    Sorry if this information is already out there; I'm just trying to get a sense of the state of this.

    Is the controller lag issue A) already fixed in 0.0.6.3, B) going to be fixed in a later update, or C) neither and I should try to implement Ayrik's solution from this thread?

    My game is very much twitch-action and local-multiplayer-focused, so getting rid of the lag is a high priority for me.
  • AyrikAyrik Posts: 429Member
    I don't have the answer for you, but I am going to say to ignore my fixes and recommend you use OuyaUnityBridge by @goodhustle if you need the fix right now, which you probably don't unless you need to send your game to a QA team or something to get it done by release.

    Presumably the lag will be fixed in the 1.0.0.1 release of the official plugin, so you should probably just wait unless you really need it now. @tgraupmann will probably answer you shortly with an official answer.
    Saga Heroes - Adventure RPG
    image image
  • tgraupmanntgraupmann Posts: 2,869Administrator, Team OUYA
    As @Ayrik said. If you want it right now follow the awesome post. Otherwise it's my next priority. I have some repro projects. If you want to share your project with me, I can use that validate the fixes.

    Subscribe for updates to stay up to date.
    ~Tim Graupmann
    OUYA Inc | Android Developer
    Skype: tgraupmann_prey

    http://github.com/ouya/docs
    http://github.com/ouya/ouya-sdk-examples

    Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]

    Use caution when setting [persistent wireless mode].
  • EMcNeillEMcNeill Posts: 47Member
    I can wait a week or two before integrating it. I'll hold off and see how the next version works. Thanks, guys!
  • ShielsShiels Posts: 119Member
    @Ayrik Is OuyaUnityBridge for Unity 4 only? I'm on Unity 3.5.7 and I can't seem to get it working. Adding UNITY_OUYA into scripting define symbols isn't possible in Unity 3 (as far as I know), but that can't be the problem because I can simply change them to UNITY_ANDROID.
  • AyrikAyrik Posts: 429Member
    Does the documentation say anything about it? It is not my tool, @goodhustle made it.
    Saga Heroes - Adventure RPG
    image image
  • tgraupmanntgraupmann Posts: 2,869Administrator, Team OUYA
    Only these defines exist:
    http://docs.unity3d.com/Documentation/Manual/PlatformDependentCompilation.html

    That said you can put logic into a DLL and use your own symbols.
    ~Tim Graupmann
    OUYA Inc | Android Developer
    Skype: tgraupmann_prey

    http://github.com/ouya/docs
    http://github.com/ouya/ouya-sdk-examples

    Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]

    Use caution when setting [persistent wireless mode].
  • ShielsShiels Posts: 119Member
    @Ayrik Not really... it only merely implies that Unity 4 is required so I wanted to find out if it's true.

    @goodhustle Is it true?
  • goodhustlegoodhustle Posts: 144Member
    @Shiels, sorry, the project tagline didn't mention that I did build it in Unity 4. The first line in the README.md does say: "A minimalist, unofficial bridge between the OUYA ODK and Unity4." I've updated the project tagline on github to be more clear.

    The prefabs and example project won't work with Unity 3, but I can't think of any other reason (than the preprocessor defines - see http://forum.unity3d.com/threads/71445-How-To-Set-Project-Wide-pragma-Directives-with-JavaScript) that the actual source code would be incompatible. Is there a specific problem you're having?
    Beast Boxing Turbo - OUYA Launch Title!
  • ShielsShiels Posts: 119Member
    @goodhustle There wasn't really a specific problem, it was just crashing on startup so I assumed it was because I am on Unity 3. But it is fine for now. I'll try again some other time.
  • ArakadeArakade Posts: 32Member
    Thought it'd be good to close the loop on this thread.

    After my last post here, @goodhustle's response gave me pause and and I immediately ceased implementing my 'shared-memory' approach.  In explanation, I guesstimated relative performance as follows (for multiple simultaneous controllers -- not so bad with 1 controller):
    1. score 100% : theoretical ideal performance (probably not possible without /dev/input use?)
    2. score  10% : JSON approach incurred every type of lag possible (a.k.a. "Legacy input")
    3. score  70% : OuyaUnityBridge from @goodhustle (current implementation transfers data via JNI and does this once per stick per frame but this could be reduced to 1 JNI making it 80%?)
    4. score  90% : anticipated shared-memory approach (still required 1 JNI call per frame but no transfer)
    5. score  90% : Android-pure approach from 1.0.1.9 (assuming Unity code is fast ;-) )

    When I originally posted, I'd not known @goodhustle had taken his further so had thought (2)->(4) was a worthwhile investment.  After his response, I found it harder to justify going from (3)->(4) without trying (3) first so I did that.  ...and it was good.  Thank you, @GoodHustle :-)

    Now, however, I'd hope it's all moot since Tim's released his 'non-Legacy' version which directly calls the UnityPlayer event handling code meaning (a) low latency and processor time and (b) we can use Unity-standard Input methods!  (though I'm not yet sure how much controller compatibility we lose/gain for this?  Hopefully Unity have this in hand!)  With 'non-legacy', I'm see solid 60FPS cap experience so far!  Fingers crossed ;-)

    HTH, Rupert.
    Snowball fighting snowmen?
     += flamethrowers, rocket-launchers, arenas, etc! o_O
     += open development !?
  • ArakadeArakade Posts: 32Member
    p.s. @Shiels OuyaUnityBridge worked fine for me under Unity3 once I put #defines in the 2 files it's used in.
    Snowball fighting snowmen?
     += flamethrowers, rocket-launchers, arenas, etc! o_O
     += open development !?
  • goodhustlegoodhustle Posts: 144Member
    @Arakade, thanks for your summary. :)

    Unfortunately it's not 100% moot yet! I haven't tried out the non-legacy Unity Input system yet, but now that I've worked with the ODK's OuyaController class a little more, I'm wondering if some of the nicer features would be lost. The hotplugging-safe Player Number system is way better than the poor ordering of the Unity joysticks array, and that alone is almost worth all the work. I don't know it's even possible to figure that out from Unity-land Input joystick numbers. 

    That is to say, Unity is sort of infamous (amongst us desktop devs) for having some really old joystick bugs that never seem to be fixed. Last I checked, there was no support for hot-plugging of joysticks and the joysticks array sometimes doesn't match with joystick indices in input. Maybe it's been fixed and I'm just not up to date - but it's always a pain in the butt, and letting OuyaController do all the work has been really awesome.

    And it's sort of a separate issue, it turns out that using one Activity class to manage everything has made it a lot easier to implement IAP and regular ODK calls by staying really close in lockstep with the official iap sample app (which is also basically one activity class). Turns out that there were a lot of big improvements between 0.6 and 1.0 which I was able to take advantage of quickly. So I'm sticking with my solution for now.
    Beast Boxing Turbo - OUYA Launch Title!
  • tgraupmanntgraupmann Posts: 2,869Administrator, Team OUYA
    I've had feedback from the Unity folks, and they don't actually like how we've done our own Activity.

    But I think it's mostly because the Unity plugin system does not support handling multiple plugins that have their own activity code.

    Mainly because there's only one Plugins\Android folder that is used.

    I would prefer that the plugin architecture would support Assets\PluginName\Plugins\Android that way every plugin could contribute snippets to the main activity.

    They also suggested that input works for now, but we may be forced to use UnityNativePlayerActivity route if they ever decide to change the input system.

    They have some comment about managing 3.X vs 4.X code paths is a maintenance nightmare. But what else can we do because there's no more updates coming to 3.X?

    When Unity headquarters receives their OUYA console, we'll start to be able to loop their devs into our forum threads here to get their best practices and ideas. And in turn they'll be getting our feedback.
    ~Tim Graupmann
    OUYA Inc | Android Developer
    Skype: tgraupmann_prey

    http://github.com/ouya/docs
    http://github.com/ouya/ouya-sdk-examples

    Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]

    Use caution when setting [persistent wireless mode].
  • goodhustlegoodhustle Posts: 144Member
    @tgraupmann Boy, would I love to have them change the Input system for the better. :D 

    Seriously, though, I know @AngryAnt was around early on in the forums, and may have already suggested he had some ideas for optimizing the plugin in the very beginning. Not sure if he's still hanging around!

    It would be great to get their feedback and recommendations especially with respect to handling input on consoles that provide advanced SDK features for controllers. I can only imagine that their support for controllers on XBLA/PS3 is way better than what they offer for standalone, but as I'm not a licensed dev for either of those platforms, I can only guess.
    Beast Boxing Turbo - OUYA Launch Title!
  • AngryAntAngryAnt Posts: 28Member
    @tgraupmann We're getting an OUYA? A bit late, don't you think? :P I'm just waiting for my own box to arrive from my Kickstarter backing before I get involved in my spare time.

    @goodhustle Still kicking, waiting to get my hands on an actual box before I can get started. I have a bunch of notes on the Unity integration which I'll test out when I get the box, but it's all spare time, so we'll see.

    I haven't even received my tracking info yet and have no idea how to find my backer #, so it'll probably take a while. I'm heaving off for Unite Asia next week. Hopefully the OUYA is waiting for me at home when I get back.
    Emil "AngryAnt" Johansen
    Game developer, AI specialist, Unity expert
    http://AngryAnt.com
  • tgraupmanntgraupmann Posts: 2,869Administrator, Team OUYA
    I'm still waiting on my tracking #. You assume I have power over such things.

    The OUYA console is headed for Stockholm. Which office are you in Angry?
    ~Tim Graupmann
    OUYA Inc | Android Developer
    Skype: tgraupmann_prey

    http://github.com/ouya/docs
    http://github.com/ouya/ouya-sdk-examples

    Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]

    Use caution when setting [persistent wireless mode].
  • HicsyHicsy Posts: 177Member
    lol yup waaay too late  :P
    Can't find aapt.exe? Temp fix: Copy another one from 'android_sdk/build-tools/17.0.0' back to your 'platform-tools'
           -=Hicsy=-
    PM me        Facebook

  • tgraupmanntgraupmann Posts: 2,869Administrator, Team OUYA
    The first thing to try when you get the OUYA is controller #4 in the experimental build.

    http://tagenigma.com/ouya/OuyaSDK-1.0.0/

    Just using controller #4 crashes the Unity player.
    ~Tim Graupmann
    OUYA Inc | Android Developer
    Skype: tgraupmann_prey

    http://github.com/ouya/docs
    http://github.com/ouya/ouya-sdk-examples

    Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]

    Use caution when setting [persistent wireless mode].
  • fresofreso Posts: 56Member
    Is the controller latency fixed in the latest ouya-unity-plugin? Because I have probably 100ms lag.

    If not, should I try the methods used in this thread?
  • tgraupmanntgraupmann Posts: 2,869Administrator, Team OUYA
    if you use the ShowUnityInput example you shouldn't see any lag.
    ~Tim Graupmann
    OUYA Inc | Android Developer
    Skype: tgraupmann_prey

    http://github.com/ouya/docs
    http://github.com/ouya/ouya-sdk-examples

    Check out the latest docs for your game engine: [setup] [adobe air] [android] [clickteam fusion] [construct 2] [corona] [libGDX] [game maker] [html5] [marmalade] [monogame] [unity] [unreal]

    Use caution when setting [persistent wireless mode].
  • fresofreso Posts: 56Member
    I never answered this, but I did get lag with ShowUnityInput, so I assumed it was not the plugin. However since we couldn't get rid of this 100ms input latency, we lost interest in coding for OUYA. It's a real shame. :/

    Had some dead time now during holidays so I was thinking of trying a wired controller just to see if it helps.
Sign In or Register to comment.