android project setup

edited May 2013 in Help request
Hello everyone, new user here!

First off, a great big thank you to iarwain, Loki, and the rest of the orx team for creating and maintaining this engine.

I am beginning work on my first independent title, and so for the past few days I have been studying the engine, and have just set-up the Android demo project last night. It worked great, everything connected smoothly.

Here are my impressions from going through as a first timer, and I wanted to share them with you.

1. orx, orxd, orxp - correspond to release, debug, and profiling versions of orx, respectively. The distinction was not immediately obvious, but LOCAL_C_FLAGS gave away their purpose. Maybe add a comment at the top of orx Android.mk to make it clearer?

2. I manually defined __orxAndroid__ in my application .mk, is this intentional?

3. Everything is compiled with LOCAL_ARM_MODE = arm, I was wondering if this is still important since we've got thumb2 now?

4. I ended up defining -lEGL, -llog, etc myself in my application makefile (the other choice would be to include them in orx's Android.mk), is this intentional?

5. It was not clear to me what brings in plugins? Just using their functionality, or is there a minimal set that must always be active?

6. There is a wakelock permission in the manifest, however, as far as I can tell it is not being used. Is this right?

7. I saw a verbose log print saying that libmmparser was not found, is this lib necessary (I could not find any reference to it under extern)?

PS. The demo is really cool, almost good enough to play on its own :woohoo:

Comments

  • edited May 2013
    Hi zokzok and welcome among us!

    First of all, thanks for your appreciation, it's always nice to have new comers that enjoy their orx discovery. :)

    Now for your questions, I'm afraid I can't really answer most of them as I've never used the Android version myself, but I'm sure Loki/lydesik will be able to do so.
    However I know that his internet access is down at the time being and won't be restored before the middle of next week.
    Sorry for the bad timing, but you probably won't have any Android-specific answers before then!

    However, here are a couple of answers for the more general questions.
    1. orx, orxd, orxp - correspond to release, debug, and profiling versions of orx, respectively. The distinction was not immediately obvious, but LOCAL_C_FLAGS gave away their purpose. Maybe add a comment at the top of orx Android.mk to make it clearer?

    I'm pretty sure this can be done. Also, the Release/Profile/Debug are mentioned in the ReadMe file (which is also used for the code repository summary at https://bitbucket.org/orx/orx) with a very quick mention to the suffixes when detailing the preprocessor commands __orxDEBUG__ and __orxPROFILER__ but I should probably make it much more clear. Will do!
    2. I manually defined __orxAndroid__ in my application .mk, is this intentional?

    You shouldn't have to define __orxANDROID__ as it should get defined automatically from within orxDecl.h (which is included as long as you include orx.h).
    This relies on TARGET_OS_ANDROID being defined though.
    5. It was not clear to me what brings in plugins? Just using their functionality, or is there a minimal set that must always be active?

    All the modules (and plugins are mapped to very specific modules) are initialized/de-initialized using a dependency graph.
    For example, the Config module relies on the memory module. So when the config module is getting initialized, we make sure that the memory module has already been initialized before then, and inversely when de-initializing modules.

    The whole graph relies on a root, which is always the "main" module (orxMODULE_ID_MAIN). The dependencies for that module can be defined by the user but they have default values defined in orx.h when the orx_Execute() helper is used:
    static void orxFASTCALL orx_MainSetup()
    {
      /* Adds module dependencies */
      orxModule_AddDependency(orxMODULE_ID_MAIN, orxMODULE_ID_PARAM);
      orxModule_AddDependency(orxMODULE_ID_MAIN, orxMODULE_ID_CLOCK);
      orxModule_AddDependency(orxMODULE_ID_MAIN, orxMODULE_ID_CONFIG);
      orxModule_AddDependency(orxMODULE_ID_MAIN, orxMODULE_ID_INPUT);
      orxModule_AddDependency(orxMODULE_ID_MAIN, orxMODULE_ID_EVENT);
      orxModule_AddDependency(orxMODULE_ID_MAIN, orxMODULE_ID_FILE);
      orxModule_AddDependency(orxMODULE_ID_MAIN, orxMODULE_ID_LOCALE);
      orxModule_AddDependency(orxMODULE_ID_MAIN, orxMODULE_ID_PLUGIN);
      orxModule_AddDependency(orxMODULE_ID_MAIN, orxMODULE_ID_OBJECT);
    
      orxModule_AddOptionalDependency(orxMODULE_ID_MAIN, orxMODULE_ID_CONSOLE);
      orxModule_AddOptionalDependency(orxMODULE_ID_MAIN, orxMODULE_ID_PROFILER);
      orxModule_AddOptionalDependency(orxMODULE_ID_MAIN, orxMODULE_ID_SCREENSHOT);
    }
    

    In embedded mode (ie. when the plugins have been embedded within the executable and not hotloaded at runtime), when the Plugin module gets initialized, all the embedded plugins will get initialized as well.

    If you have any other questions, don't hesitate! :D
  • edited May 2013
    Out of curiosity, which version of Android NDK are you using?
    Also, are you using the 1.4 release of orx or the latest from the mercurial repository?
  • edited May 2013
    I'm pretty sure this can be done. Also, the Release/Profile/Debug are mentioned in the ReadMe file (which is also used for the code repository summary at bitbucket.org/orx/orx) with a very quick mention to the suffixes when detailing the preprocessor commands __orxDEBUG__ and __orxPROFILER__ but I should probably make it much more clear. Will do!
    hehe, I guess it would help to read the README (I was just about to go through it, honest :blush:). __orxANDROID__ is exposed, as are the other such defines. Excellent.
    All the modules (and plugins are mapped to very specific modules) are initialized/de-initialized using a dependency graph.
    For example, the Config module relies on the memory module. So when the config module is getting initialized, we make sure that the memory module has already been initialized before then, and inversely when de-initializing modules.
    I guess I was referring more to the external modules, such as Box2D, which were needed for the demo project. I could tell they were missing from the compiler errors, but I was wondering if there is a place somewhere (not orx.ini, it seems) where one declares which modules will be required.
    Out of curiosity, which version of Android NDK are you using?
    Also, are you using the 1.4 release of orx or the latest from the mercurial repository?
    I am using ndk-r8e (the newest one as of the time of this writing), and using the latest Mercurial get (well maybe not latest, but one of several days ago). I also have the 1.4 release, but I opted for the latest, because it has a custom Java-Native glue, which I consider very important to have (as opposed to using NativeActivity).

    PS. No worries about lydesik's (virtual) absence, just wanted to give you guys some feedback from my first run-through. Thanks again for being active on here!

    PSS. I have what I believe to be a nice Android.mk for the demo project, which removes the necessity to build orx libs in a separate compile/install step. I could send it to you or post here, or whatever, if that would be of interest.
  • edited May 2013
    zokzok wrote:
    hehe, I guess it would help to read the README (I was just about to go through it, honest :blush:). __orxANDROID__ is exposed, as are the other such defines. Excellent.

    I always assumed that no one beside me read REAMEs, so I'm glad I didn't write all that text for nothign. One reader is good enough for me. ;)
    I guess I was referring more to the external modules, such as Box2D, which were needed for the demo project. I could tell they were missing from the compiler errors, but I was wondering if there is a place somewhere (not orx.ini, it seems) where one declares which modules will be required.

    Ah sorry, I misunderstood that part. I believe the README lists the external dependencies as well as the available plugin options too, but it might not be completely up to date with respect to Android. I'll have to check.

    Usually though, we only support one version of plugins ourselves (with the semi-exception of computers).
    On Android the physics plugin uses Box2D (but I think lydesik started writing one based on Bullet), the display plugin uses SOIL (for image loading/saving) and the sound plugin uses Tremor (instead of stb_vorbis used on other platforms).
    I am using ndk-r8e (the newest one as of the time of this writing), and using the latest Mercurial get (well maybe not latest, but one of several days ago). I also have the 1.4 release, but I opted for the latest, because it has a custom Java-Native glue, which I consider very important to have (as opposed to using NativeActivity).

    I recommend using the hg version as well, it's usually fairly stable and orx's development is rather active, with bug fixes as well as improvements and new features.
    Now that we have continuous integration done for all platforms, I should probably make releases more often. :)

    Lastly on that point, if you want to ask questions regarding new features/future developments or just follow what's being said, we recently started a google group and everyone is more than welcome to join.
    PS. No worries about lydesik's (virtual) absence, just wanted to give you guys some feedback from my first run-through. Thanks again for being active on here!

    Thanks for the feedback, it's always appreciated.
    PSS. I have what I believe to be a nice Android.mk for the demo project, which removes the necessity to build orx libs in a separate compile/install step. I could send it to you or post here, or whatever, if that would be of interest.

    Sure, all contributions are interesting, you can either post it here, or submit a pull request via bitbucket.org (after forking orx's repo).
  • edited May 2013
    Hi zokzok, welcome.

    I replied to your pull request.

    I think you skipped the step in the wiki where you have to export the env variable NDK_MODULE_PATH which should point to the /orx/code folder.

    On linux this can be done with "export NKD_MODULE_PATH=/location/to/orx/code", I don't know how to do this on windows.

    The last line of the demo Android.mk include the Android.mk in /orx/code/lib/static/android and this file include the external dependencies Android.mk for Box2D, opensoft-al, Tremo and SOIL.

    Take a look at <ndk>/docs/IMPORT-MODULE.html if you want more details on this.

    Have fun with orx.

    lydesik
Sign In or Register to comment.