Page 6 of 6

Re: ZGameEditor & Android Setting

Posted: Thu Dec 20, 2018 1:21 pm
by Ats
No blending at all. For example the ball in Zpong is white in API 26, but if I add MeshExpression C.A=1; to the BallMesh, it appears red.

Re: ZGameEditor & Android Setting

Posted: Thu Dec 20, 2018 2:35 pm
by Kjell
Hi guys,

Keep in mind that currently when you do the following ..

- Start a new project
- Add a Mesh to App.Content
- Add a MeshBox to the Mesh
- Select the Mesh component

... the Mesh appears red in the preview window ( don't let that fool you ).

Anyway, when you add a MeshExpression ( with VertexColors enabled ) to a Mesh that doesn't contain vertex color data yet, you need to set the color values because otherwise you end up with "junk" values that are currently in memory.

K

Re: ZGameEditor & Android Setting

Posted: Thu Dec 20, 2018 3:04 pm
by VilleK
Based on this I would assume that on Android GL_BLEND is enabled by default somehow?

Can you try adding "glDisable(GL_BLEND);" in OnRender, or in OnLoad?

Re: ZGameEditor & Android Setting

Posted: Thu Dec 20, 2018 3:16 pm
by Kjell
Hej Ville,
VilleK wrote: Thu Dec 20, 2018 3:04 pmBased on this I would assume that on Android GL_BLEND is enabled by default somehow?
That doesn't have anything to do with blending ( vertex colors mix with the material diffuse color without having to use blending ). It's because when you don't explicitly set certain components of the vertex color, it ends up using whatever value is in memory.

K

Re: ZGameEditor & Android Setting

Posted: Thu Dec 20, 2018 8:29 pm
by VilleK
Kjell wrote: Thu Dec 20, 2018 3:16 pm Hej Ville,
VilleK wrote: Thu Dec 20, 2018 3:04 pmBased on this I would assume that on Android GL_BLEND is enabled by default somehow?
That doesn't have anything to do with blending ( vertex colors mix with the material diffuse color without having to use blending ). It's because when you don't explicitly set certain components of the vertex color, it ends up using whatever value is in memory.
Ah, you are right. Ok then indeed Ats you need to set full RGBA values in your MeshExpressions when using vertexcolors.

Re: ZGameEditor & Android Setting

Posted: Mon Jan 07, 2019 8:24 am
by Ats
Happy new year everyone !

So I set the A values on all my models and now everything is almost fine. Now the problem is the framerate:
When exported to API 16, the game runs at a constant 60 fps. But when it is exported to API 26, I get huge drops from time to time (15 fps). I disabled the particles and a lot of things. Maybe it comes from the number of models on screen but I'm not even sure... Do we have some kind of ZGE benchmark project somewhere so I can run tests?

Re: ZGameEditor & Android Setting

Posted: Mon Jan 07, 2019 9:26 am
by VilleK
Thanks for the update, I was wondering about your progress on this.
Ats wrote: Mon Jan 07, 2019 8:24 amWhen exported to API 16, the game runs at a constant 60 fps. But when it is exported to API 26, I get huge drops from time to time (15 fps).
Do you mean this happens when using the same libzgeandroid.so for API 16 and 26? So it cannot be things like Freepascal compilation options that differs?

Maybe check if API 26 has some new manifest options to set higher priority for graphics applications?

Re: ZGameEditor & Android Setting

Posted: Mon Jan 07, 2019 9:53 am
by Ats
It is entirely possible that the problem comes from the Freepascal compilation of libzgeandroid.so since I removed the "-CfVFPv2" parameter...
I'm going to compile libzgeandroid.so for API 16 and see if there is a difference with the one provided with ZGE. I'll try that when I get home.

Also, if I remember the thread correctly, weird problems have started to appear with API 23. So I'm going to compile some libzgeandroid.so for API 22 and 23 and see at what point the problem is showing up.

Edit:
By the way, did you manage to follow my tutorial?
I tried to do it on my home computer but I'm getting stuck at the compilation of libzgeandroid.so, so maybe I forgot one step in the explanations... :roll:

Re: ZGameEditor & Android Setting

Posted: Mon Jan 07, 2019 12:11 pm
by VilleK
Please note that the lib file itself has no dependency to a specific API-level, as far as I know. So you should be able to use the same .so file in a API 16 apk.

Indeed if there is no floating point option set enabled (which is what CfVFPv2 does) then performance will suffer. So you might need to rebuild Fpc for Android with that option set.

No I haven't tried your tutorial yet. Just by looking at it I can tell it will take me too long :). I have to say that the Android platform has lost a bit of its appeal to be. With the first android phones it was still a very small and limited platform and a technical challenge to get anything working (which is what made it interesting to me). These days a modern smartphone is almost like a portable PC and anything can be built for it as long as you can configure the tools correctly.

Re: ZGameEditor & Android Setting

Posted: Mon Jan 07, 2019 4:24 pm
by Ats
So I didn't find much about CfVFPv2... How should I enable this in the line that compiles FPC Android?

Code: Select all

make clean crossall crossinstall OS_TARGET=android CPU_TARGET=arm INSTALL_PREFIX=C:\FPC\trunk
By adding something like CROSSOPT="-CfVFPv2" ?

What about those other options I saw on some random internet page? CROSSOPT="-dANDROID -CpARMv6 -CfVFPv2" ?
Since -dANDROID -CpARMv6 are needed in order to compile libzgeandroid.so ...

Re: ZGameEditor & Android Setting

Posted: Mon Jan 07, 2019 9:29 pm
by Ats
With CfVFPv2 activated, it works perfectly. YES!!! 8)
So I compiled the lib directly and set the manifest so it can run from API 16 to API 28 (Android 9, the latest).
I modified the tutorial accordingly.

I'm going to send the omeganaut apk to the friends I know couldn't play it on their phones to see if everything's fine before sending to Google Play Store and verify if there are a few more bad surprises. I'm so happy :D

Edit:
By the way, shouldn't I opt for CpARMv7 instead? Since there are no devices under CpARMv6 with API>=16...