Adobe Native Extension

13567

Comments

  • GaslightGamesGaslightGames Posts: 156Member
    It's going to be a little longer/later before I can create the GitHub and release the next version which will include multi-controller support.

    I have it working, in that I can now tell which controller is pressing/moving an axis, so that's working!

    It just becomes much more complicated, as there is a limited amount of data you can send from Java to AS3 via an asyncEvent (two strings).  That's not too much of a problem, so wont take long, but figuring out why the application was crashing when attempting to use the OuyaController crash took a little longer than anticipated.

    The short answer is the correct use of Jar's in an ANE and that, just like the Highlander, there can be only one.  I'll post an update, more details, the next ANE and (I hope!) the GitHub repo so everyone can have a go with it :-)
  • Wet_NoodleWet_Noodle Posts: 3Member
    so you should only need to add support for controller id to your current extension to support multiple controllers. then an instance of the extension class would be created for each controller connected to the OUYA.  you should post up what you have gaslight it will go much faster.
  • LaboratoryLaboratory Posts: 24Member
    edited January 2013
    Just finished packing my other project away. NOW THEN... I've got your test app running. 

    I'm getting TONS of noise from the Left Stick you probably include some deadzone stuff on the Java side. AS3 events are expensive enough that it would be good not to bombard the app when nothing is happening, especially with the AIR overhead. And sometimes I'm getting  some insane values:

    Left Stick: 0, 0

    Left Stick: 0, 0

    Left Stick: 0, 0

    Left Stick: 165.92213, 987.475

    Left Stick: 165.92213, 987.475

    Left Stick: 166.92213, 986.475

    Left Stick: 166.92213, 986.475

    Left Stick: 166.92213, 985.475

    Left Stick: 166.92213, 985.475

    Left Stick: 0, 0

    Left Stick: 0, 0

    Left Stick: 0, 0

    Left Stick: 0, 0

    Also why have LeftStickX and LeftStickY events as they both seem to have both values? Given I'm just using what you've posted, so maybe you resolved much of this?

    Also, I missed mention of the trackpad, and don't see any events for it. Or the OUYA button. ;)

    Finally, re:source sharing: You could just post a zip for now. Helping you would literally be my highest priority.
    Post edited by Laboratory on
  • rocketbunnyrocketbunny Posts: 46Member
    It's really up to Gaslight what he wants to do with the project as it is his code.  In saying that, if he is happy to release the source for either contributing or a separate fork from his own code, that would be great too. 
    Robert Crane
    CEO, Rocket Bunny Games
  • LaboratoryLaboratory Posts: 24Member
    I've done some additional testing, and doing a lot of quick button presses causes a lot of delay on reading the input. So if, for example, I move my finger around the d-pad quickly, I'll get those inputs over a couple seconds rather than the half second it took me to do it.

    In other news, I have a nice UI setup for the test app! Check it out.


  • GaslightGamesGaslightGames Posts: 156Member
    so you should only need to add support for controller id to your current extension to support multiple controllers. then an instance of the extension class would be created for each controller connected to the OUYA.  you should post up what you have gaslight it will go much faster.
    The approach I was looking to take was to initialize the extension once, and then on the AS3 side (in the SWC) create 4-instances of a Controller class.  As the AsyncStatusEvents are fired from Java, then depending on which "x_" (where x is the controller/player number) is received, then update the values within that class instance.
    I'm not sure of the benefit of instantiating 4 extension instances, because of the way the OuyaController class works in Java.
    Just finished packing my other project away. NOW THEN... I've got your test app running. 

    I'm getting TONS of noise from the Left Stick you probably include some deadzone stuff on the Java side. AS3 events are expensive enough that it would be good not to bombard the app when nothing is happening, especially with the AIR overhead. And sometimes I'm getting  some insane values:

    Left Stick: 0, 0

    Left Stick: 0, 0

    Left Stick: 0, 0

    Left Stick: 165.92213, 987.475

    Left Stick: 165.92213, 987.475

    Left Stick: 166.92213, 986.475

    Left Stick: 166.92213, 986.475

    Left Stick: 166.92213, 985.475

    Left Stick: 166.92213, 985.475

    Left Stick: 0, 0

    Left Stick: 0, 0

    Left Stick: 0, 0

    Left Stick: 0, 0

    Also why have LeftStickX and LeftStickY events as they both seem to have both values? Given I'm just using what you've posted, so maybe you resolved much of this?

    Also, I missed mention of the trackpad, and don't see any events for it. Or the OUYA button. ;)

    Finally, re:source sharing: You could just post a zip for now. Helping you would literally be my highest priority.
    Noise:
    I get loads too, but strangely ONLY from the Second controller.  If it's not connected, then no noise.  The Stick is firing a genericMotionEvent in Java, which is being handled... but I just need to change some parameters and it'll check if the stick is 0.0 again (the first time this occurs, we need to know, so we can tell when the player has stopped moving the LeftStick).

    LeftStickX and Y:
    The values that are being printed are actually coming from 2 Java events... but this could probably be cleaned up.
    When a MotionEvent occurs, you can get the values of AXIS_LS_X and AXIS_LS_Y (for example), so for simplicity sake, whenever a MotionEvent fires there's a separate method that can check for the stick, X, Y, Trigger etc and fire off the asyncStatusEvent.
    What I was trying to avoid was parsing the values at the AS3 end - as you can ONLY send strings!  So if I concatenate X and Y, so the values are (in String) "x.x,y.y" then one needs to parse the string for the comma every time.  It might be worth checking on the performance impact between the String check versus the Java event handling.

    Trackpad and OUYA Button:
    It's on the list - but multi-controller support was, I figured, a higher priority for most :-)
    And the OUYA Button is technically handled, but because it's like the HOME button in Android, you can't do anything with it.  There might be something one can do at a later stage, but for now, not interrupting how it works was what, I figured, might be the best approach.

    Source:
    The main reason for not sharing at the moment is that it's changing so dramatically!  Once I can have it at a point whereby it's not going to change too much more (i.e. end of today :-) ) then I'll push it to the GitHub repo I'm setting up and you folks can all see it!
    It's really up to Gaslight what he wants to do with the project as it is his code.  In saying that, if he is happy to release the source for either contributing or a separate fork from his own code, that would be great too. 
    My preference would be to open the source for contributing!  So that everyone's updates can be added to one clean extension... but I'm not adverse to forks, just as long as it's in the best interest of the extension/community/etc :-)
    I've done some additional testing, and doing a lot of quick button presses causes a lot of delay on reading the input. So if, for example, I move my finger around the d-pad quickly, I'll get those inputs over a couple seconds rather than the half second it took me to do it.

    In other news, I have a nice UI setup for the test app! Check it out.


    Niiiice!
    Later on today I'll have a more complete ANE, so we can look to incorporate the UI in a sample project :-)

    As for input delay... I don't currently see any :-|
    That's not to say that there isn't a delay - sometimes it can be due to the USB Debugging and tracing to the console.
    But we have some ideas on how to improve performance and once the repo's open to all, hopefully we can blast on with more features, support and improvements!

    Thanks for all the feedback, folks - really appreciated!
    I hope my next post will be to the repo, so we can get this thing motoring even faster :-D
  • LaboratoryLaboratory Posts: 24Member
    edited January 2013
    Thanks for the update!

    I can't imagine a string.split() in as3 is more expensive than an event.

    My thoughts on how it works so far. My preference is always towards being AS3-like, so getting events from an object rather than checking for booleans would make more sense for the events. Now for example, we just get a generic "button" event from your controller Singleton. It would be nicer to get a button code and name from the event rather than needing to check against the singleton. You're already using a custom event, so you may as well pass the info along. What are your thoughts?

    The delay is actually the UI, which I have hooked up in my version of the test project.

    I JUST got Scout installed on my OUYA, and I'm getting TERRIBLE performance. I probably need to hack at my controller class a bit more.
    Post edited by Laboratory on
  • GaslightGamesGaslightGames Posts: 156Member
    edited January 2013
    The VERY rough and ready code is available here: https://github.com/gaslightgames/AIROUYAController

    I'm already working on fixing the multiple controllers issue and I can change so that we can have "LeftStick" events, rather than LeftStickX and Y separately... just doing the breakdown in AS3.

    As for the events stuff, in order to get any values passed from the event, you need to have those values stored somewhere in the signalling class - you can't pass more than (type:String, bubbles:Boolean = false, cancelable:Boolean = false) in the dispatch... and then storing the value somewhere WILL cause collisions.

    Edit: Hmm, replying before my coffee is a BAD idea!  OK, so I'm extending the Event class to carry a/some value variables.  These will contain which button/stick/trigger was pressed and any data relating to them.  In the case of buttons, the data will be 0/null, but for sticks it'll be the X/Y etc.

    I think the whole architecture of the ANE could be switched around to be more robust... but it was about solving the bulk of the problem: getting the controller to talk to AIR.

    As for the UI stuff... interesting that the performance is so bad!  I haven't done anything more complex than the Test app in the ANE... but this is intriguing!
    Post edited by GaslightGames on
  • SueseSuese Posts: 120Member
    Stage3D is working very slow on my OUYA even with rendering settings on Direct or GPU.  Anyone having luck with Stage3D or AIR performance in general?
    TheSuese.com - Elite Developer Backer
  • SueseSuese Posts: 120Member
    Correction*  Stage3D crashes the Activity on the OUYA even though it works fine on the PC.
    TheSuese.com - Elite Developer Backer
  • rocketbunnyrocketbunny Posts: 46Member
    edited January 2013
    Suese, I'm having no problems at all.  My Stage3D Air app runs at a solid 60fps.  I'm using FlashDevelop.
    Post edited by rocketbunny on
    Robert Crane
    CEO, Rocket Bunny Games
  • rocketbunnyrocketbunny Posts: 46Member
    Gaslight, I have your ANE in my game and it initializes correctly, your trace output in the ANE works but it doesn't seem to return the events to my app.  I've copy and pasted your event handler setup in your demo code exactly and it just isn't being called.  

    Any ideas?
    Robert Crane
    CEO, Rocket Bunny Games
  • GaslightGamesGaslightGames Posts: 156Member
    edited January 2013
    Gaslight, I have your ANE in my game and it initializes correctly, your trace output in the ANE works but it doesn't seem to return the events to my app.  I've copy and pasted your event handler setup in your demo code exactly and it just isn't being called.  

    Any ideas?
    I've just pushed a new version to the github repo - the ANE on there is massively updated... use the one in the OUYAControllerANELib folder, as that's where the build script dumps it.

    There's been some major changes to how it works, fixed a load of bugs, some back-end issues and full support for multiple controllers :-)

    If you can check the new version and give that a whirl... might solve the problem?

    Post edited by GaslightGames on
  • LaboratoryLaboratory Posts: 24Member
    edited January 2013
    Suese said:
    Stage3D is working very slow on my OUYA even with rendering settings on Direct or GPU.  Anyone having luck with Stage3D or AIR performance in general?
    The main problem, from what I can tell, is the resolution. The fact is the screen is huge, so when you've got a dirty rect, it's more expensive to redraw.

    I realized there's a drop shadow on one of my assets that wasn't being cached beforehand, so that was murdering my updates. Also a nested clip that wasn't getting stopped. All better now and back to normal town. I'm getting the best performance from "direct" mode.

    But let's not highjack this thread with performance questions. :) The same recommendations that go for any other mobile device apply here when it comes to AIR.

    I just got the ANE to build. Huzzah. Haven't had to do that before. I had to manually make it "package" the newer ANE under the ActionScript Build Packaging menu when I switched from the old one.

    So here's a question: I've made changes to the Lib project. Built the SWC. Compiled the ANE. The test app, which is pointing to the ANE, isn't showing any changes though. I added some test words to the existing traces and they still trace what they did previously. Very strange. Am I maybe missing something? I need to sleep for a few hours before continuing. 

    Thanks again for posting that Gaslight! I've got my earlier version of the test app working really well now with the UI. I'll update it and upload it once I figure out my issue here.

    -Clayton Grey
    Post edited by Laboratory on
  • GaslightGamesGaslightGames Posts: 156Member
    And another new version to the ANE: https://github.com/gaslightgames/AIROUYAController

    This time with TrackPad support :-)

    I also spotted some problems with the Left and Right thumbstick - I was giving the wrong values, so that's been fixed.
  • rocketbunnyrocketbunny Posts: 46Member
    Nope.  Even with the latest version, it doesn't seem to be firing events back.  Very strange.
    Robert Crane
    CEO, Rocket Bunny Games
  • LaboratoryLaboratory Posts: 24Member
    edited January 2013
    It's working for me. Haven't been able to test multiple controller support as my controller 2 is on the fritz.

    I just submitted changes for some Event stuff.

    For anyone whose looking to get involved, there was a step that threw me: You need to extract the library.swf from the lib swc and copy it to the java project folder before you build the ANE. I missed that step and was subsequently VERY confused as to why my changes weren't happening! ;)

    Edit: So I've got the visuals working well. A little *too well* now that the joy sticks stopped being noisy the joysticks won't recenter anymore, so I'll need to put something in for that! :)

    I am still getting random extreme values for the left joystick on mine. We might want to sanity check over or under 1/-1 as well.  It seems to be related to the touch pad...........

    Edit 2: I'm actually having a tricky time of this. Because I never get a "centered" announcement, it's tough to know to reset the value. I was trying to do it with a timer, but that solution only works well for registering quick movements. So you end up with either too much of a delay for quick movements or glitchy movement for slow movements. Going to need to thinking on this. Similar situation with the triggers. Suggestions welcome! :D Otherwise it's looking good!
    Post edited by Laboratory on
  • WillzZzWillzZz Posts: 26Member
    Can't wait to finally check this out today! Just got the game running on the devkit last night, so I'm psyched to start dev work on controller support. and some custom ouya UI.

    I'll happily give feedback as I get to it. It might be easier if you guys idled in the irc channel some of us are in, if possible.
  • GaslightGamesGaslightGames Posts: 156Member
    Nope.  Even with the latest version, it doesn't seem to be firing events back.  Very strange.
    Interesting... do you have a test App you can send over with the configuration you're using, then I can take a look?
    It's working for me. Haven't been able to test multiple controller support as my controller 2 is on the fritz.

    I just submitted changes for some Event stuff.

    For anyone whose looking to get involved, there was a step that threw me: You need to extract the library.swf from the lib swc and copy it to the java project folder before you build the ANE. I missed that step and was subsequently VERY confused as to why my changes weren't happening! ;)

    Edit: So I've got the visuals working well. A little *too well* now that the joy sticks stopped being noisy the joysticks won't recenter anymore, so I'll need to put something in for that! :)

    I am still getting random extreme values for the left joystick on mine. We might want to sanity check over or under 1/-1 as well.  It seems to be related to the touch pad...........

    Edit 2: I'm actually having a tricky time of this. Because I never get a "centered" announcement, it's tough to know to reset the value. I was trying to do it with a timer, but that solution only works well for registering quick movements. So you end up with either too much of a delay for quick movements or glitchy movement for slow movements. Going to need to thinking on this. Similar situation with the triggers. Suggestions welcome! :D Otherwise it's looking good!
    With regards to Edit 2: Yeah, I know this bug - it's the one I figured out at midnight last night, when I couldn't sleep and I think I emailed you saying "I can haz bugz" :-P  OK, I didn't reference lolcatz, but I know the problem and will fix in a moment :-)
    WillzZz said:
    Can't wait to finally check this out today! Just got the game running on the devkit last night, so I'm psyched to start dev work on controller support. and some custom ouya UI.

    I'll happily give feedback as I get to it. It might be easier if you guys idled in the irc channel some of us are in, if possible.
    What's the IRC details (server/chan)?  Can get on an idle away, heh :-)
  • GaslightGamesGaslightGames Posts: 156Member
    WillzZz said:
    Awesome, thanks WillzZz - idling away :-)

    Also, another new version of the ANE is available.  Now with fixed thumbstick support (actually zeroes!); Updated Event names to more closely match OUYA's Docs (thanks Laboratory!); a new Demo project with UI (again, props to Laboratory!)

    So, if more folks can check it out, break it, see how it works, then we can find and fix any bugs that may crop up - but for the most part, this ANE is (dare I say it) feature complete!
  • rocketbunnyrocketbunny Posts: 46Member
    Gaslight, I run your demo apk and I get nothing on screen but a gray screen.  Can you build your demo again in release mode and using captive runtime and post a link to it somewhere please?
    Robert Crane
    CEO, Rocket Bunny Games
  • GaslightGamesGaslightGames Posts: 156Member
    Gaslight, I run your demo apk and I get nothing on screen but a gray screen.  Can you build your demo again in release mode and using captive runtime and post a link to it somewhere please?
    From what you said in the IRC channel, I guess this is working now?  Glad it is! :-D
  • rocketbunnyrocketbunny Posts: 46Member
    The Test demo apk works.  Can't get mine to work though.  I'll figure it out. :-/
    Robert Crane
    CEO, Rocket Bunny Games
  • GaslightGamesGaslightGames Posts: 156Member
    edited January 2013
    The Test demo apk works.  Can't get mine to work though.  I'll figure it out. :-/
    Have spotted some unusual behaviour - so I might be getting on to the problem you're having!

    If I connect a second controller in an app beyond what the test app looks like, then the second controller seems to act as P1, which doesn't make any sense!

    There's also something strange going on with a null value crash... which I think is related to the bug I've spotted and I think may be related to the bug you're seeing.

    Edit: I was being daft with initialising, so it was my code, not the ANE.
    Post edited by GaslightGames on
  • rocketbunnyrocketbunny Posts: 46Member
    Now that Gaslight has a good working ANE, I think there should be a section on this forum called "Adobe Air on OUYA".  

    I believe that a lot of people will use Air to build games for OUYA and it needs a central place.

    If anyone agrees, please say so.  Boxer8 might do it then.
    Robert Crane
    CEO, Rocket Bunny Games
  • GaslightGamesGaslightGames Posts: 156Member
    I agree!
    Beyond the controller for AIR, we have the soon-to-exist IAP extension for AIR (will get on this after the CREATE competition), details on adding OUYA support to AIR apps (the -app.xml file, as the manifest in AIR is a little different to normal apps), getting decent performance (Bitmaps, Caching, Stage3D) and more.
  • IQpierceIQpierce Posts: 54Member
    I agree there should be an AIR-specific forum section as well!

    I'm also very interested to hear what needs to be customized in the manifest (*-app.xml file) specifications - I don't recall seeing this in this thread before.

  • Volcanic-PenguinVolcanic-Penguin Posts: 90Member
    One more vote for an AIR category! ;9
  • mfrasiermfrasier Posts: 10Member
    Of course I'd back that idea!
Sign In or Register to comment.