Has anyone gotten a FlashPunk game running on the OUYA?


(Zachary Lewis) #1

I got an OUYA last week, and after playing some of the games I noticed that some were old Flash games. I was wondering if any developers have successfully gotten a FlashPunk game running on the OUYA.


(Michael Houser) #2

Huh, that’s very interesting! Do you recall any of the titles? Did they seem like the sort of thing that would be ported to stage3d?


(Zachary Lewis) #3

A lot of Terry Cavanagh’s titles are on the OUYA store.

The ones I’ve noticed that I know were originally Flash games are Bullfist and Don’t Look Back. I know he’s been porting many of his games to C++, so I’m not sure if these are ports or some Adobe Air version of his old games.


(Ultima2876) #4

The OUYA and similar systems are a publishing target of mine. I can’t say much yet (non-disclosure agreement), but it’s something I’ll be doing a lot of work with soon.


(Michael Houser) #5

On Twitter, Terry C. says the older flash games are still in flash (Don’t Look Back, etc), and that with simpler games things work fine. There seems to be some suggestion that the Ouya is more powerful than your typical Android phone, but no one has formally confirmed that, at least as far as I’ve seen.


(Ultima2876) #6

I’ll be purchasing an Ouya within the next couple of weeks, I’ll report back here with some more information.

One source of trouble when running FlashPunk games on mobile is scaling to large resolutions. For example if you have a 320x240 game running on a 1080p device, it has to do a large scale to get it to full size. If you instead scale to 720p, you’ll get much better performance… but it won’t fill the screen.

However, the Ouya has quite a powerful CPU (1.3ghz quad core) so it could go either way really. I’d imagine most FlashPunk games would run OK on it… but I guess we’ll find out soon enough!


(Andrew) #7

Has anyone had more experience with this?


(Ultima2876) #8

I should really give it a go. I have an Ouya, I’ve just never really bothered to set it up or anything.


(MaToMaStEr) #9

I’m currently developing a game for the ouya with AS3 and FlashPunk. I’m using FlashDevelop to build the AIR App with Captive Runtime. At the beginning I had low framerates, around 30 fps while in my pc it runs at 60 fps. After changing the render mode in the manifest to “gpu” the game ran at 50 fps on my OUYA… good enough. The “problem” is that the graphics seem to be “smoothed” or antialised. This didnt happen when the render mode was set to direct.

My game is almost ready and the FPS keep going down with the number of Entities the engine has to manage. I read somewhere that using Starling should help with this issue, because of the way Flashpunk and similar engines handle bitmaps and stuff. The thing is… I really like Flashpunk :frowning: Any advice?

Anyway… the game is playable and works great :slight_smile:


(Ultima2876) #10

Ah, I guess Ouya has the same problem most mobile devices do then - I thought it had decent hardware so wasn’t sure if FlashPunk would tax it. We have a solution that can help if you have a game we’d like to publish on Android - send me a PM if you want to discuss that (it’s basically a drop-in version of FlashPunk that runs on Stage3D instead of blitting, designed to make porting FlashPunk games to mobile a 1 hour job instead of 20 hours plus).


(MaToMaStEr) #11

Thanks! That would be awesome! Damn… I’m new to this forums… can’t find a way to send you a PM…


(Ultima2876) #12

Ah yeah, these forums don’t let you PM until you have a certain amount of posts. Rather annoying! You can reach us over at http://www.kickbackgames.com (I don’t like to spam links around but I don’t really have much of a choice here without PM’s being available to new members - sorry!).

This of course goes for anyone with games they’d like to publish on mobiles. We’re aiming for 100 awesome games by april, so we want your games! :stuck_out_tongue:


(Andrew) #13

Do you know of any decent tutorials that show how to port a Flash program to AIR (and then maybe to Android, but just to AIR is good enough for now)? I’m really struggling to find any decent documentation on it!


(MaToMaStEr) #14

It’s actually fairly easy if you’re using FlashDevelop. (I sugest you download the latest version first)

You just have to create a new Project picking the template “AIR AS3 Projector”. Then copy/paste all of the source files of your AS3 Project into the new project folder and build. To package it as an AIR App, open your project folder / bat and run CreateCertificate.bat then in the root folder, run PackageApp.bat

Rememebr to publish to the lastest Flash and Air versions bu going to the menu Project / Properties. You can change some of the options of your App going to Project / Air App Properties.

Hope this helps :slight_smile:


(Andrew) #15

Thanks, I got it working! I have one other question though, if it’s not too much bother… how does one make it scale? At the moment it’s running in a tiny window in the corner!

I got the controller working using Terry Cavanagh’s joypad class:

http://distractionware.com/blog/2013/07/free-to/


(MaToMaStEr) #16

Good I’m glad to hear that :smile:

  • For my gamepads in my PC and OUYA I’m using Adobe GameInput API (http://www.adobe.com/devnet/air/articles/game-controllers-on-air.html). I’ve never tried Terry’s Joypad Class so I can’t tell you which one is better…
  • About the dimensions, in one side you have your game dimensions, you set these up using your Engine constructor in your Main : super(width,height,…);
  • On the other side is the “window” size. You can set this dimensions going to Project/Properties or using the [SWF] tags
  • Now, usually the Flash dimensions will be bigger than the Engine dimensions. You can then scale it setting the property FP.screen.scale accordingly right after you call super() on your Main. ( http://flashgamedojo.com/wiki/index.php?title=Screen_Scaling_(FlashPunk) )

(Andrew) #17

Thanks for the post, but that isn’t quite what I’m looking for!

What I meant to ask is if there is a way to detect the size of the screen, then go fullscreen (while keeping the aspect ratio).

At the moment, my game looks like this.

When I want it centered and fullscreen (with maybe black lines surrounding it to keep the aspect ratio). Do you (or anyone else reading this) have any ideas on that?


(MaToMaStEr) #18

Probably setting the stage.scaleMode and stage.align properties in your Main?

In my case, my Engine is 480x270 and my project dimensions are 1920x1080 so I’m setting FP.scale = 4 and everything fits perfectly on my TV :slight_smile:


(Andrew) #19

I haven’t gotten the screen size stuff working quite yet, but I’m not sure if I’ll bother now! The game runs far too slow, even when turning it from direct to GPU. I’ll mess around with it some more to see if I can improve the speed, but it’s not looking great.


(Andrew) #20

UPDATE:

I tried porting one of my less intensive games to the OUYA and it works almost flawlessly! Expect to see it on the store soon (for free).

TIPS:

  • Render from the GPU instead of Direct for a great speed boost (though visuals DO take a slight hit, it’s worth it)

  • Use this class made by Terry Cavanagh for joypad stuff: distractionware.com/blog/2013/07/free-to/

  • Use this code to fit the game to the TV screen while keeping the aspect ratio, and center it:

      	stage.scaleMode = StageScaleMode.SHOW_ALL;
      	stage.align = "";
    

It goes in the init function of your Main file (if that’s your style, that is)

DO NOT use FP.screen.scale, as this will slow down your game considerably.

I still have a few kinks to work out, but it’s looking very good. I’m going to go back to my other game and try to simplify the code a bit to make it run better on OUYA as it’s the perfect fit for the console.

JUST ONE THING:

The biggest problem I face right now is that the game doesn’t seem to pause when I go back to the system menu. The music keeps playing in the background. Does anyone know how to deal with this sort of thing in AIR?