Flixel Forums

development => releases => Topic started by: Wing Eraser on Tue, Oct 30, 2012

Title: flixel-android 0.5
Post by: Wing Eraser on Tue, Oct 30, 2012
(http://wingeraser.com/flixelandroid/QRflixelandroid.jpg)
http://wingeraser.com/flixelandroid/flixel-examples-android.apk (http://wingeraser.com/flixelandroid/flixel-examples-android.apk)
Project page: http://code.google.com/p/flixel-android/ (http://code.google.com/p/flixel-android/)



Changelog v0.5

- Loading assets has tob e done by a String: url + pack name.
- FlxAssetCache, manages textures, fonts, sounds and music.
- Stage, replica from Flash. Currently used for mouse events.
- Scaling options, your game wonít be stretched anymore at fullscreen.
- BlendMode, only 5 blend modes works.
- FlxQuadTree, uses object pooling. This improves the performance significance. For more info: http://forums.flixel.org/index.php/topic,6663.msg37508.html
- FlxAnalog, circle drag and multi.

A lot of bug fixes and new implementations. Check the revisions if you want to know them all.

Plugins
B2FlxBox2D, shapes, joints and debug implemented. Works with FlxCamera.

Demos
Blend
Bloom (doesnít work)
Bomberplanet
Box2D


There is a Project GUI for flixel-android created by Thomas. It makes your life easier to setup your flixel-android projects. It will download the required zip files and extract them into the project folders.

If you choose to download the source (0.5-r108), extract the folder on your disk instead importing the zip directly in your Eclipse. Sometimes it doesn't generate the necessary files in the Android project. Please do import...->Select root directory. Also uncheck "Copy project into workspace". This will keep the subfolders (flixel-android-examples) at the same place, and not at the root.

You can also do a checkout to avoid this hassle.

If you need help with the manual setup, please post your message below.

-
flixel-android dev team
Title: Re: flixel-android 0.5
Post by: finalsin on Sat, Nov 10, 2012
Hey, F-A team!

I'm not on the new release yet (I don't want to change anything as I'm at a bit of a critical point in my work) but I've run into a huge error.

I develop on Mac, where everything works fine. However, once I export to Windows, any code that changes the size of a FlxText causes a fatal error that shuts the game down instantly. Before the text even renders, necessarily. Here's more details on the exact error: http://stackoverflow.com/questions/13322921/execution-protection-violation-when-running-jar-in-windows-7

Do you have any idea what might be causing this? This is a bit of a worry for me now...
Title: Re: flixel-android 0.5
Post by: Wing Eraser on Sat, Nov 10, 2012
Someone has already replied on your message at stackoverflow. And he's right. You've to use Java 6. Change it in the settings in your eclipse.
Title: Re: flixel-android 0.5
Post by: finalsin on Sat, Nov 10, 2012
Sorry, the reply hadn't appeared when I posted!

The developer machine is using Java 6, it's the target machine that uses Java 7. I assume this means there's no way around it?
Title: Re: flixel-android 0.5
Post by: Wing Eraser on Sat, Nov 10, 2012
Delete Java 7 from the machine and reinstall 6 is the only way I think.
Title: Re: flixel-android 0.5
Post by: finalsin on Sat, Nov 10, 2012
Okay, thanks for the quick update. I'll report back if I find any way around it, but it's not looking likely.

EDIT - Is this specific to Flixel-Android? And would upgrading to the latest version fix this?
Title: Re: flixel-android 0.5
Post by: Wing Eraser on Sat, Nov 10, 2012
I don't know if this is a flixel-android issue, because I haven't got this error before.
What does your code do to get the error? If you can place a code snippet then I'll try to run it.
Title: Re: flixel-android 0.5
Post by: finalsin on Sat, Nov 10, 2012
Creates a FlxText and adjusts the size of the text. It doesn't even add it to the stage. I'm pretty sure it's just any rendering code at all, and is actually a problem with Java 7 interacting with LibGDX. I just wanted to be sure.

Don't worry about running a test - if you haven't encountered the error I imagine it's on my end.
Title: Re: flixel-android 0.5
Post by: Wing Eraser on Sat, Nov 10, 2012
There's a BitmapfontDemo which uses FlxText with different sizes. It doesn't produce your error. I'm afraid you need to do something about Java 7.
Title: Re: flixel-android 0.5
Post by: finalsin on Sat, Nov 10, 2012
Thanks for checking. LibGDX forums seem adamant it has nothing to do with Java 7 but I'm really not so sure. I'll keep poking at it.

Game still running beautifully on Android though, so thanks!
Title: Re: flixel-android 0.5
Post by: finalsin on Sat, Nov 10, 2012
Upgrading everything to the latest version has fixed it. I've also taken a peek at the new API and it's looking really nice! Lots of changes that I really like a lot.

Congrats, and thanks for helping me out.
Title: Re: flixel-android 0.5
Post by: finalsin on Mon, Nov 26, 2012
Hey,

Thanks again - the new version is really nice, and I like the String-based resource names.

I'm having a weird bug I wanted to ask you about, in case it had come up before. Jumping works in the desktop version, which uses a isTouching(FlxObject.FLOOR) check before letting the player jump. In the Android version, though, the same check returns false. Have you ever encountered any bugs with isTouching?
Title: Re: flixel-android 0.5
Post by: Wing Eraser on Tue, Nov 27, 2012
I haven't encountered the bug you mentioned before. Mode and FlxCollision demo 1 give the correct value back when touching the floor. I'm not sure if it's your code or if it has something to do with flixel-android.
Title: Re: flixel-android 0.5
Post by: finalsin on Tue, Nov 27, 2012
If in doubt it's more likely it's me. I'll check both demos, and crosscheck the jump code on my Android. I'll let you know.
Title: Re: flixel-android 0.5
Post by: finalsin on Sat, Dec 8, 2012
I just wanted to let you know that next Friday I'll be releasing A Puzzling Present for free on desktop platforms and Android, thanks to flixel-android.

http://www.gamesbyangelina.org/press/sheet.php?p=a_puzzling_present

I'll also post here about the paper I wrote on it when I get the conference reviews back. Can't express my gratitude enough! Will let you know how the release goes.
Title: Re: flixel-android 0.5
Post by: finalsin on Fri, Dec 14, 2012
I'm getting some memory leaks in the game I've developed - I use a bunch of FlxEmitter/FlxParticle systems, do you know if there are any known issues with them, disposing and so on? Does flixel-android handle disposing of the LibGDX memory management stuff (http://code.google.com/p/libgdx/wiki/MemoryManagment) or is this something I should be handling in my own code?

Thanks! The game is now live, incidentally: https://play.google.com/store/apps/details?id=org.gba.pp&feature=search_result#?t=W251bGwsMSwyLDEsIm9yZy5nYmEucHAiXQ.. flixel-android made it happen!
Title: Re: flixel-android 0.5
Post by: Wing Eraser on Sat, Dec 15, 2012
I went to though the list from the link you provided.

AssetManager: not used.
Bitmap: not used.
BitmapFont: used in FlxGame for showing the FPS. Itís not disposed, but this shouldnít give you the problem. It will be disposed when you exit the game.
BitmapFontCache: should be disposed by FlxAssetCache::disposeTextures() when switching state.
CameraGroupStrategy: not used.
DecalBatch: not used.
ETC1Data: not used.
FrameBuffer: not used.
Mesh: not used.
ParticleEffect: not used.
Pixmap: used by FlxSprite for coloring and FlxAssetCache for keeping the context when the game goes to the background (example by call).
PixmapPacker: not used.
ShaderProgram: not used.
Shape: used by FlxBox2D plugin, they are disposed correctly unless you used createFixture and didnít dispose it by yourself. I assumed you didnít use this plugin for your game.
Skin: not used.
SpriteBatch: used by FlxGame. Itís not disposed. Itíll be disposed when you exit the game.
Stage: not used.
SpriteCache: not used.
Texture: used by FlxAssetCache. Itíll be disposed when switching state.
TileAtlas: not used.
TileMapRenderer: not used.
World: used by FlxBox2D, disposed at B2FlxState::destroy().

I do assume you did disposing/nullifying your own objects, used object pooling and not creating new objects during runtime.

Could you update to the latest revision before I install your game on phone. Iíve only adjusted one small thing. And could you tell me when it crashes?
Title: Re: flixel-android 0.5
Post by: finalsin on Sat, Dec 15, 2012
Let me look into some of the things you mention first and I'll get back to you. Thanks for the info!
Title: Re: flixel-android 0.5
Post by: finalsin on Mon, Dec 17, 2012
I still haven't had time to look properly into this - I'm getting a LOT of GC_CONCURRENT calls at runtime, but I also wasn't careful with instantiation so there are some new() calls going on. Even so I think I'm probably not disposing of things properly. I need to look at this more carefully...

Here's another thing: I've had this crash through fifteen different users, but haven't had time to look at it yet. This might be my misuse of stuff or it might be a genuine hardware issue, I'm posting it here in case it's relevant to you but please ignore. If I find a fix I'll let you know:

Code: [Select]
java.lang.NoSuchMethodError: java.lang.String.isEmpty
at org.flixel.system.input.Input.reset(Input.java:59)
at org.flixel.FlxG.resetInput(FlxG.java:668)
at org.flixel.FlxG.reset(FlxG.java:1891)
at org.flixel.FlxGame.step(FlxGame.java:697)
at org.flixel.FlxGame.render(FlxGame.java:626)
at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:449)
at com.badlogic.gdx.backends.android.surfaceview.GLSurfaceViewCupcake$GLThread.guardedRun(GLSurfaceViewCupcake.java:713)
at com.badlogic.gdx.backends.android.surfaceview.GLSurfaceViewCupcake$GLThread.run(GLSurfaceViewCupcake.java:646)

This is being reported on startup, before even playing the game.
Title: Re: flixel-android 0.5
Post by: Wing Eraser on Tue, Dec 18, 2012
Quote
I'm getting a LOT of GC_CONCURRENT calls at runtime, but I also wasn't careful with instantiation so there are some new() calls going on. Even so I think I'm probably not disposing of things properly.

I've never got GC_CONCURRENT. GC stands for Garbage Collection I think. You musn't create new objects during runtime. Create all objects in the create of your state and use object pool pattern. When you switch states, you've to diposed all objects that where created for the state.

The other error is solved at r123. Read this: http://code.google.com/p/flixel-android/issues/detail?id=33&can=1
And star the issue at libGDX tracker. I can't help you with this one. You'll have to wait for libGDX to solve this and he's taking a break for 2 weeks.

Edit: I'm looking at the ARMv6 maybe this cause the problem. I can't compile anything right now, because I modified flixel-core a lot to get things running again.
Title: Re: flixel-android 0.5
Post by: finalsin on Tue, Dec 18, 2012
Excellent. That's really no big deal - it's a very small problem (<0.1% of installs so far) and it can wait, I imagine I wouldn't have time to administer a fix right now anyhow.

I have another question, I'm afraid. If I don't want to use screen-stretching options for the game, is it possible to draw *anything* outside the bounds of the stage? I'd ideally like the gamepad to be at the edge of the screen no matter what aspect ratio we're playing on.

Please don't rush to reply, I know I keep asking things! I really appreciate it.
Title: Re: flixel-android 0.5
Post by: Wing Eraser on Tue, Dec 18, 2012
So you want your game being stretched (making the santa claus even fatter) and let the gamepad stays normal, right?
Well, I need to hook the gamepad to a seperate FlxCamera to make this work. I don't know if this will work. Probably other objects will be drawn again on it. There is no option to ignore a specific camera (I thought). Probably in the next commit I'll have something for you.

No worries about the questions. We are really excited about your game. AFAIK your the first one that actually published game made with flixel-android.
Title: Re: flixel-android 0.5
Post by: finalsin on Tue, Dec 18, 2012
What I want is for the game to appear as it does, normal aspect ratio - kind of like here (https://play.google.com/store/apps/details?id=org.gba.pp&feature=nav_result#?t=W251bGwsMSwyLDNd). But I want the gamepad to extend into the black area. Right now it's constrained to be within the drawn game stage area. Moving it to the black area would be more comfortable, and would take up less screen space for players too.

I'll take a look at FlxCamera, thanks for the tip. Do let me know if you have any ideas.

I'm talking lots about flixel-android! It's mentioned in my paper, and I've also used it for some toy projects here: www.github.com/cutgarnetgames. I just used it for Ludum Dare too! I really like it.

The game's been getting some good press (e.g. http://arstechnica.com/gaming/2012/12/artificial-intelligence-project-builds-a-puzzling-present/) so hopefully people are coming to the site and learning about flixel-android too!
Title: Re: flixel-android 0.5
Post by: Wing Eraser on Tue, Dec 18, 2012
Ok I get it. There's probably a very ugly solution for this.
The default camera should be stretched.
The first camera should draw all your game objects with the option SCALE_X
The 2nd camera should draw the game pad with the option SCALE_X.

This'd slow down your game, because the objects will be drawn on multiple cameras.
Title: Re: flixel-android 0.5
Post by: Wing Eraser on Tue, Dec 18, 2012
Did you updated at least to r118? Thomas added a feature to scale cameras.
Title: Re: flixel-android 0.5
Post by: finalsin on Wed, Dec 19, 2012
Thanks a lot for this. I'll definitely try your solution and see if we get a performance hit. I could always make it an option people can choose between.

Not sure what revision I'm on (I stupidly am not checking out of SVN, I'm installing manually off a download) but I'll let you know. Hopefully I should get some time to work on it tomorrow.
Title: Re: flixel-android 0.5
Post by: moly on Thu, Dec 20, 2012
What I want is for the game to appear as it does, normal aspect ratio - kind of like here (https://play.google.com/store/apps/details?id=org.gba.pp&feature=nav_result#?t=W251bGwsMSwyLDNd). But I want the gamepad to extend into the black area. Right now it's constrained to be within the drawn game stage area. Moving it to the black area would be more comfortable, and would take up less screen space for players too.

I think the easiest way to do this right now is to use scrolling. In your main class set the default scalemode to FILL_X:

Code: [Select]
public TiledMap2Demo()
{
    super(320, 240, PlayState.class, 2, 40, 40, false, FlxCamera.FILL_X);
}

Now in the PlayState, you need to set up your camera like this:

Code: [Select]
private FlxGamePad _pad;

@Override
public void create()
{
    //Background
    FlxG.setBgColor(0xffacbcd7);

    FlxG.width = FlxG.camera.viewportWidth;

    //Scroll the camera to the centre of the screen
    FlxG.camera.scroll.x = -(FlxG.width - FlxG.camera.width) / 2;

    //Set the cameras width to the screen width
    FlxG.camera.width = FlxG.width;

    //Create gamepad and set it to ignore the camera scroll
    pad = new FlxGamePad(FlxGamePad.FULL, FlxGamePad.A_B);
    pad.setAll("scrollFactor", new FlxPoint(0,0));

    //Optional: set FlxG.width back to the original game width if you need to
    FlxG.width = 320;

    add(_level);
    add(_pad);
}

Here's how it looks in the collision demo:

(http://i.imgur.com/aAmFr.png)

I'm going to work on fixing it so that you don't need to mess with FlxG.width, but this should work for now.
Title: Re: flixel-android 0.5
Post by: finalsin on Sat, Dec 22, 2012
Thanks so much for the help, guys! I am struggling to find the time to push the update out before Christmas but either way I will get around to implementing it. I really appreciate this - I'll be using the library more in 2013 for bigger projects!
Title: Re: flixel-android 0.5
Post by: Jeff on Wed, Dec 26, 2012
How does this relate to HaxeFlixel? That should work for iOS at the same time, so that should at least be a perk for that. How about otherwise?
Title: Re: flixel-android 0.5
Post by: Wing Eraser on Wed, Dec 26, 2012
How does this relate to HaxeFlixel? That should work for iOS at the same time, so that should at least be a perk for that. How about otherwise?

flixel-android currently support Desktop and Android. The rendering is done by libGDX and they are currently working on iOS support. Once they release it, we will add that platform to our project.
If you want to support iOS now (and dislike Java), you're better off using HaxeFlixel. I can't tell about the differents in performance. The performance of flixel-android is pretty good as far I know.

Plugins: they got far more plugins. Most plugins are ported from the contributors of flixel-as3.
Title: Re: flixel-android 0.5
Post by: curzonbar on Tue, Jan 8, 2013
This port is really cool. I'm really glad that you are working on this. Good work.

I might be doing this wrong, but I have noticed something... My game switches states quite a lot, but there seems to be quite a lag in switching from one to another new state. It's only noticeable on the Android device, not in eclipse.

eg
Code: [Select]
FlxG.switchState(new GamePlayState());
The states are very light code-wise.

Any ideas on how I could speed that up?
Title: Re: flixel-android 0.5
Post by: Wing Eraser on Wed, Jan 9, 2013
This port is really cool. I'm really glad that you are working on this. Good work.

I might be doing this wrong, but I have noticed something... My game switches states quite a lot, but there seems to be quite a lag in switching from one to another new state. It's only noticeable on the Android device, not in eclipse.

eg
Code: [Select]
FlxG.switchState(new GamePlayState());
The states are very light code-wise.

Any ideas on how I could speed that up?

Android devices aren't that fast as a desktop. Welcome to the world of mobile. When you do a switchstate, the old state will be destroyed and garbage collector (should) be kicked in. Creating a new state also takes time.

Options to solve this.
1. I don't know what kind of game you're creating that needs the swap states a lot. You can put the states in a stack. I don't recommend it to use it in large states, because it will consume to much memory.

2. It can't do any harm to let the user know the game is loading just before you call FlxG::switchState().

3. Create groups and render those when need it and freeze the rest.

To be at better service I need a little more info what those states are and why you need to switch a lot.
Title: Re: flixel-android 0.5
Post by: finalsin on Mon, Jan 14, 2013
Hey Wing and the f-a team!

I just wanted to apologise for going dark for the last few weeks. I really appreciate all the help I got in December from you guys - I couldn't have done it all without you. Unfortunately work has dragged me in another direction temporarily and I am spending January filling in exciting forms... >_>

I just wanted to let you know of a few things. First, I talked about my game and flixel-android on Reddit, and it got a great reception!

http://www.reddit.com/r/gamedev/comments/16hqi7/the_code_and_art_for_my_very_simple/
http://www.reddit.com/r/OneGameAMonth/comments/16hqy3/for_any_flixel_users_wanting_to_get_into_java_my/

Second, if you go to those links you'll see I've open sourced two small games, and my Christmas game, including the artwork. The license is entirely open, for re-use, commercial use, modification, etc. without attribution. Please feel free to chop up the project as you wish if any of it is helpful.

I'll be in touch again in the future but for now, thank you so much.

Mike
Title: Re: flixel-android 0.5
Post by: Wing Eraser on Mon, Jan 14, 2013
Wow, it seems people are excited about libGDX and flixel-android. Thanks for making nice words at reddit.
We look forward to your games in the future.
Title: Re: flixel-android 0.5
Post by: finalsin on Fri, May 3, 2013
Just wanted to let you know I'm still loving flixel-android. I made my Ludum Dare game in it: http://www.ludumdare.com/compo/ludum-dare-26/?action=preview&uid=12174

I wondered what the status of HTML5 compatibility was? I seem to remember it was an issue higher up in LibGDX itself that was causing the problem. Is that still the case?
Title: Re: flixel-android 0.5
Post by: Wing Eraser on Sat, May 11, 2013
Just wanted to let you know I'm still loving flixel-android. I made my Ludum Dare game in it: http://www.ludumdare.com/compo/ludum-dare-26/?action=preview&uid=12174

I wondered what the status of HTML5 compatibility was? I seem to remember it was an issue higher up in LibGDX itself that was causing the problem. Is that still the case?

Hmmm I should visit the forum regularly....
Cool, another game from you. flixel-gdx has currently no html5 support. libgdx is planning to add a new Reflection API in the next version or they have plans for Dart compiler.  We'll need to wait for them.

Looking forward to your projects.