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?
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 :)
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.
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.
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.
@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.
@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.
@goodhustleThere 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.
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):
score 100% : theoretical ideal performance (probably not possible without /dev/input use?)
score 10% : JSON approach incurred every type of lag possible (a.k.a. "Legacy input")
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%?)
score 90% : anticipated shared-memory approach (still required 1 JNI call per frame but no transfer)
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 timeand (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 ;-)
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.
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.
@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.
@tgraupmann We're getting an OUYA? A bit late, don't you think? :PI'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
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.
Comments
The 0.0.6.1 minor update will be coming next week.
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].
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].
Subscribe for updates to stay up to date.
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].
http://docs.unity3d.com/Documentation/Manual/PlatformDependentCompilation.html
That said you can put logic into a DLL and use your own symbols.
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].
@goodhustle Is it true?
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.
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].
Game developer, AI specialist, Unity expert
http://AngryAnt.com
The OUYA console is headed for Stockholm. Which office are you in Angry?
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].
-=Hicsy=-
PM me Facebook
http://tagenigma.com/ouya/OuyaSDK-1.0.0/
Just using controller #4 crashes the Unity player.
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].
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].