Android: Killer Reaxxion

This is my very first android project. It features an ugly gui and a very simple gameplay. Klick on the fields with the blue borders. But be aware that time is against you.

Main reason for this simple project was to test a toolset containing:

Android specific:

-AdMob integration
-Facebook integration (Login, Publish Feeds, Scores for Facebook Games) (Still awaiting authorization from facebook, and its currently disabled)
-Android Savegame management

Game specific:

-Stage/Level management, with requirements to unlock. All very generic to reuse in like every game

So, if you have some minute freetime, and some devices i would be happy if you can test the app

For reporting issues eighter use the google plays issue submission system, or: https://github.com/zzuegg/KillerReaxxion/issues

DOWNLOAD HERE

1 Like

Oh, and regarding the name:

I found out that there exists already a game called reaxxion after i made all the images, so i had to add “Killer”

Also we on irc are speculating that apps containing the word “Killer” or “Murderer” are getting downloaded more often :wink:

Oooo! Nice nice!

Will download as soon as I have had coffee.

I’ll report back with the four devices I can test on for you.

EDIT:
@zzuegg - fun game!

Note 3: Works great
ASUS Transformer: Works great
HannsSpree HannsPad: Works great
Tab 2: Fails to load with IndexOutOfBounds (index 0 size 0) expection in Reaxxion.java line 226 (SafeArrayList if that helps)

Sorry for not reporting where you asked, but I’m tired. I’ll move the report over to there later.

@zzuegg
If you need me to retest on the Tab 2 to help you when fixing the issue, just let me know (This problem will likely show up on the Note 2 and a few other popular devices from Samsung)

Np, fro the wrong report location. Hm, hard to debug, Reaxxion.java does only have 193 lines.

AFAIK SafeArrayList is only used when loading from a savegame. It seems android is really unconsistend when it comes to storage access.

Does the error happen when you start a game, or after you finnished the first level?

I guess:

[java]
levelResults = new SafeArrayList<ReaxxionLevelResult>(ReaxxionLevelResult.class, reader.readSavableArrayList(“LevelResults”, null));
[/java]

is causing the issue.

Whats the most strange thing is, at first startup no savegame should be there, and i am not sure why it even goes trough the loader. And even if, i placed all fileaccess methods in a try{}catch{} to avoid a full fail.

//Add: if you press on the report button after the app fails, it sends me a stacktrace to my google.play account

@zzuegg said: Np, fro the wrong report location. Hm, hard to debug, Reaxxion.java does only have 193 lines.

AFAIK SafeArrayList is only used when loading from a savegame. It seems android is really unconsistend when it comes to storage access.

Does the error happen when you start a game, or after you finnished the first level?

I guess:

[java]
levelResults = new SafeArrayList<ReaxxionLevelResult>(ReaxxionLevelResult.class, reader.readSavableArrayList(“LevelResults”, null));
[/java]

is causing the issue.

Whats the most strange thing is, at first startup no savegame should be there, and i am not sure why it even goes trough the loader. And even if, i placed all fileaccess methods in a try{}catch{} to avoid a full fail.

//Add: if you press on the report button after the app fails, it sends me a stacktrace to my google.play account

Didn’t give me the option of reporting the error =(

Depending on the target version, the save location needs to be:

$lt;User Folder>/data/data/<package name>

(Note the double data directories)

If you are using JME’s SaveGame in any way or using property user.home, this doesn’t write to the correct folder and will have issues on certain devices.

Hey, data/data/ did not work for me, on my s3 it is /data/data/files.

I use Activity.getFilesDir() to get the writable folder as suggested in the android doc.

However i found an error somewhere else, which might solve the issue. Have already uploaded the new apk. Should be on in a few hours

@zzuegg said: Hey, data/data/ did not work for me, on my s3 it is /data/data/files.

I use Activity.getFilesDir() to get the writable folder as suggested in the android doc.

However i found an error somewhere else, which might solve the issue. Have already uploaded the new apk. Should be on in a few hours

Even better!

I’ll check for it.

@zzuegg
Sorry it’s taken me a while to test this again. Been a busy day (wasn’t supposed to be… go figure).

I’m still getting the same error on the Tab 2.

To ensure that it updated properly, I uninstalled/reinstalled with no positive effect.

Let me know when you need me to try again.

If you have a section of source code that isolates the problem area, I could grab those and see if I can narrow down a fix for you. I know how frustrating it can be waiting 2+ hours to find out if a potential fix worked.

Hi there,
This is a nice idea for a game and well done so far.
I am very happy that there is someone else that joined the android development crew… =D

Anyways, back to the game, I tested your game on my Galaxy Note 2 and it works perfectly no problems.

Again just wanted to state the fact that I love this game.

Google (Samsung) Galaxy Nexus with Cyanogen Mod (Android 4.3.1)

Same Index out of bounds as t0n3g0d:

java.lang.IndexOutOfBoundsException: Index:0,Size:0 at
com.jme3.util.SafeArrayList.get:261 at
com.customcod3z.games.android.killerreaxxion.game.Reaxxion.simpleInitApp(Reaxxion.java:181)

Thank you all for testing.

I added a second fallback case for the index out of bounds.

The main problem currently is that:

a) the not working devices returns a not writable path with Activity.getFilesDir().getPath()
(Maybe additional changes are needed on that android version/devices) Don’t know yet
b) some old versions might have created a not vaid savegame.
That issue should be fixed with the new version.

After all that issues i ordered a tab 2 today. As it seems that this is basically the most problematic device it seems to be the best investment.

I will be on holiday the next two week, after that i will release my findings as well as the first 3 tools: SavegameManager, AdMob integration, Facebook integration.

As a preview what you can expect from the tools:

AdMob:

[java]
PluginAdMob.initialize(activity);
PluginAdMob.getAdMob().addTestDevice(“MY TEST DEVICE ID”);
PluginAdMob.getAdMob().addAd(new AdIntersitial(“MainAd”, “MY AD ID”));
PluginAdMob.getAdMob().preloadAd(“MainAd”);

PluginAdMob.getAdMob().showAndPreloadNextAd(“MainAd”);
[/java]

Facebook:
[java]
PluginFacebook.initialize(activity);
PluginFacebook.getPluginFacebook().addPermission(Permission.EMAIL);
PluginFacebook.getPluginFacebook().addPermission(Permission.PUBLISH_ACTION);
PluginFacebook.getPluginFacebook().setAppConfiguration(“MY APP ID”, “MY NAMESPACE”);

PluginFacebook.getPluginFacebook().login();

Feed feed = new Feed.Builder().setMessage(“SOME COOL MESSAGE”).build()
PluginFacebook.getPluginFacebook().publish(feed, false);
[/java]

Not yet fixed the code for the savegame thing, since well, it seems that is causing more and more issues. Android fragmentation can really be hell

1 Like

Maybe related to this: https://code.google.com/p/android/issues/detail?id=8886
where there is a race condition in Android creating the directory for context.getFilesDir() and maybe permission problem.

Following the doc no additional permissions should be required to read/write to that directory. And it seems that function was added at api level 1.

Well, going to see once i get the device

From what I read in the report there seems to be a race between android creating the directory and setting the permissions and when the app tries to use the directory. It was tagged as fixed in 4.4

Or This has nothing to do with it :slight_smile:

Yeah, its just that if this bug existed since api lvl 1, my assumtion would be that you would find more ressources about that on the net.

The good thing is that comment nr 21 on that report says:

By way of a workaround, you can catch the exception and try once more. Once the directory has actually been created (which is the crux of the race condition), subsequent lookups will work fine.

That’s roughly the approach of the fix that was applied: in case of error, recheck the precondition to see whether you’re the victim of a race. <https://android.googlesource.com/platform/frameworks/base/+/cc866da37db53df67e9b324815d6377bbd47d71b&gt;

In that case, assuming i got all the fallback code working correctly, it will just fail to create a savegame at the very try to access that file. However it would be a monitorable issue which could be cleared with a simple “resave”.

Still i have the strange feeling that there must be something else going on.
Unfortunately i also had a bug in the first fallback code which was causing your index out of bounds…

1 Like
@zzuegg said: Thank you all for testing.

I added a second fallback case for the index out of bounds.

The main problem currently is that:

a) the not working devices returns a not writable path with Activity.getFilesDir().getPath()
(Maybe additional changes are needed on that android version/devices) Don’t know yet
b) some old versions might have created a not vaid savegame.
That issue should be fixed with the new version.

After all that issues i ordered a tab 2 today. As it seems that this is basically the most problematic device it seems to be the best investment.

I will be on holiday the next two week, after that i will release my findings as well as the first 3 tools: SavegameManager, AdMob integration, Facebook integration.

As a preview what you can expect from the tools:

AdMob:

[java]
PluginAdMob.initialize(activity);
PluginAdMob.getAdMob().addTestDevice(“MY TEST DEVICE ID”);
PluginAdMob.getAdMob().addAd(new AdIntersitial(“MainAd”, “MY AD ID”));
PluginAdMob.getAdMob().preloadAd(“MainAd”);

PluginAdMob.getAdMob().showAndPreloadNextAd(“MainAd”);
[/java]

Facebook:
[java]
PluginFacebook.initialize(activity);
PluginFacebook.getPluginFacebook().addPermission(Permission.EMAIL);
PluginFacebook.getPluginFacebook().addPermission(Permission.PUBLISH_ACTION);
PluginFacebook.getPluginFacebook().setAppConfiguration(“MY APP ID”, “MY NAMESPACE”);

PluginFacebook.getPluginFacebook().login();

Feed feed = new Feed.Builder().setMessage(“SOME COOL MESSAGE”).build()
PluginFacebook.getPluginFacebook().publish(feed, false);
[/java]

Not yet fixed the code for the savegame thing, since well, it seems that is causing more and more issues. Android fragmentation can really be hell

/drool

I love you =P

I have been putting off Facebook integration for sometime now. Any thoughts of Google Play Services support as well? Every time I think I have time to start on this, I get sidetracked with the gui library. I’m fairly sure I’ll never actually get to implementing this >.<

Play Services covers quite a large area.

Probably i make a small wrapper around the Sign-in/Achievements/Leaderboards/Anti-Piraty API at first. Networking is probably not worth it since you usually want to keep that a bit tight to your game.

And even for the apis above, all i do is to make wrappers so that i can access them as i do with my other plugins.

Anything special you have in mind when it somes to play services?

1 Like
@zzuegg said: Play Services covers quite a large area.

Probably i make a small wrapper around the Sign-in/Achievements/Leaderboards/Anti-Piraty API at first. Networking is probably not worth it since you usually want to keep that a bit tight to your game.

And even for the apis above, all i do is to make wrappers so that i can access them as i do with my other plugins.

Anything special you have in mind when it somes to play services?

You picked all the hotspots. I would be VERY thankful for a plugin like this for sure. Heck, I’d be thrilled with the Facebook one alone!