Some findings running jme3 on Android 2.2

I updated the source found in the src/android directory to make it work with the latest jme3 alpha and Android 2.2.

I've done some testing on a Nexus One and here are some issues I've run across.



  • Drawing text is _really_ slow. In the "9-spheres" test the difference between disabling the StatsView or not is about 40 fps down to 10 fps. (I kept only the FPS text). I suspect the texture switching is not very optimized.

  • OBJLoader takes about 20 minutes to load the Utah teapot in the TestSimpleLighting test. The garbage collector runs furiously during the time. Inspecting the continuous /data/anr/traces.txt dumps I can see it trashes around in the RegEx compiler. The lighting effect is not very impressive either, and for some reason the rotating light source dot is white instead of red.



Any thoughts on this? Anyone else who have done performance investigations or have done Android work.
I'm going to continue working on completing the Android port, adding GL ES 2.0 support as well, since I need it myself.

/bs



I have some more findings that may be of interest:

  • onPause in AndroidHarness.java is always called before onDestroy when the Android app closes down. The inverse is not always true though. If your app just loses focus, most commonly by the screen saver kicking in getting you to the lock screen when trying to resume, you'll just get a call to onPause. All textures are lost when this happens however and you'll just get white primitives when continuing! The code from onDestroy should be moved to onPause to get the same behavior as when you get an orientation change for instance (which is handled correctly).

  • Dalvik (Android VM) has a pretty inefficient garbage collector, and avoiding having it run is almost mandatory to get a smooth experience. JME3 has a tendency to create unnecessary transient garbage objects in certain situations, like when handling input events (MouseMotionEvent etc). To work well on an Android device, some memory profiling will be needed to see where the bottlenecks are.



/bs

Hello,



I am very interested in developing Android apps with jme.



Will you share your port ? or do you in contract with the developers of jme ?

Inno said:

Hello,

I am very interested in developing Android apps with jme.

Will you share your port ? or do you in contract with the developers of jme ?


The source is already on the repository with jME3, you just need to set up your IDE to use the src/android directory on its classpath

The sources do not fit.



for instance



I look via SVN Browser and most of the sources have the old revision 4864. Two has 5192.



When I look into JmeSystem.java the class imports "JmeFormatter" but it uses "G3DFormatter".


Yeah I noticed this as well. Doing processing on the text is slow due to the native buffer access methods (like ByteBuffer.put) being slow.

Inno said:

The sources do not fit.

for instance

I look via SVN Browser and most of the sources have the old revision 4864. Two has 5192.

When I look into JmeSystem.java the class imports "JmeFormatter" but it uses "G3DFormatter".




Yes, there are some discrepancies from the current JME3 implementation. That one seems a bit special though. The developer who contributed the Android code used an class from a package not available on that branch.
You'll find it in on the mf_jme3test branch. Here is the direct link to the only additional source file you need:
http://code.google.com/p/jmonkeyengine/source/browse/branches/mf_jme3test/src/com/g3d/util/G3DFormatter.java

/bs

The JmeFormatter and G3DFormatter classes should essentially be the same afaik, just the name changed. So youshould build agains JmeFormatter and change alle references to that.