3.0.0 beta (ZGE on Android)

Information and change log about the latest ZGameEditor release.

Moderator: Moderators

Post Reply
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Ville, I tested loading files from /sdcard and its sub-directories and it works as expected, thanks. Now, I can use it to allow users to upload their own levels and settings to apps. like Toyland Shooter, great!
User avatar
jonaspm
Posts: 89
Joined: Fri Jul 06, 2012 3:51 pm
Contact:

Post by jonaspm »

Nice bugfixes and improvements VilleK!
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

I have a suspicion that noise2 and noise3 functions are not working on Android. Is it true? If so, can it be fixed? Thanks.
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

That's odd, I can't test it right now but I'm pretty sure it has been working before because many of my test projects make use of them. Can you make a little project that demonstrates the problem?
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

I tested it again and observed that noise* functions return 0 just for very large numbers used as parameters. For smaller/normal numbers the functions work fine.

I used getSystemTime() as initial value and added ZApplication.Time to get the dynamics. But getSystemTime() on Android returns x*10^9 numbers.

So it is probably matter of FP arithmetic which is probably better on PCs than on ARM processors. Therefore, this is not probably a bug, do no fix anything. I fixed my application. BTW good to know also such limitations.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Ville, the current libzgeandroid.so is built for armeabi ABI, right? I'm asking because I tested ZGEBullet on Nexus 7 and armeabi does not perform well, even on such a relatively good hardware. A version compiled for armeabi-v7a is as fast as on my Windows notebook, really nice, constant 60 FPS. I used an old ZGE version of ZGE we used to test performance of ZGEBullet some time ago. I think you compiled it for armeabi-v7a.

Therefore, to allow some serious physical or computation-intensive applications, ZGE should support also armeabi-v7a. I think to have optimal performance, not only libZGEBullet.so should be compiled for armeabi-v7a, but also libzgeandroid.so, right?

If so, ZGE should have an option (for instance in Settings/Android tab) to allow selection of the target ABI. Android NDK r8 supports just armeabi and armeabi-v7a.
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

As I understand it the ABI is a specification for how functions and libraries call each other (parameter passing etc), not the actual instructions used.

ZGE is built for armabi for best compatibility but with the VFPv2 floating point extension which means it make use of hardware floating point support.

Hardware floating point is what matters most for performance.

I can't find any option in the version of Freepascal I'm using to generate armeabi-v7a binaries, so I'm not sure what I did when I built that special version for you. Do you remember from which forum thread you downloaded it? And are you sure the current ZGE beta + ZGEbullet (built for armeabi-v7a) gives poorer performance (or don't work at all) than the version of ZGE you tested with?
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Hi,

NDK documentation says: ABI influences the CPU instruction set, the endianness of memory stores and loads at runtime, the format of executable binaries, various conventions used to pass data between code and the system, alignment and size constraints for enum types, structure fields and arrays, and the list of function symbols available to machine code. armeabi-v7a enables to use VFP hardware FPU instructions (VFPv3-D16).
VilleK wrote:ZGE is built for armabi for best compatibility but with the VFPv2 floating point extension which means it make use of hardware floating point support.
This would be sufficient for performance and seems to be ideal for compatibility. You are probably using -mfpu=vfpv2 option...
VilleK wrote:Do you remember from which forum thread you downloaded it?
Unfortunately, I do not remember from which forum I downloaded that version. It can also happen that you just started to use support for VFPv2 (?).

Anyway, I tested just to use libZGEBullet.so built for armeabi-v7a with the current libzgeandroid.so and its performance is good. Therefore, I'm going to use this setup for my upcoming projects; if there occur some issues, I'll discuss them case by case. But for now, ZGE does not need to have any special option for selecting ABI, unless you want device-specific optimizations, but this is not probably the goal for now.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Hi, I observed that switching ZApplication.ShowOpsionsDialog on causes crashing of Android application. Would it be possible to ignore this setting for generated apk?
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Rado1 wrote:Hi, I observed that switching ZApplication.ShowOpsionsDialog on causes crashing of Android application. Would it be possible to ignore this setting for generated apk?
Updated today, the above should be fixed.

Also: Added type "byte" for DefineArray to make it easier to work with binary files that are read using the File-component.

And a new function "setBinaryProp" that allows you to set the content of a binary property with the content of a byte array. See attached project for a demo that uses this new functionality to load and display a jpeg file. Note that the loaded jpeg must have the same width/height as the one you replace (in the project it is 512x512) so it is not a general solution.

Updated beta: http://www.zgameeditor.org/files/ZGameEditor_beta.zip
Attachments
loadjpeg_demo.zip
the demo displays an embedded bitmap, when you press space it replaces this bitmap with another that is loaded from file
(226.85 KiB) Downloaded 652 times
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

VilleK wrote:And a new function "setBinaryProp" that allows you to set the content of a binary property with the content of a byte array.
Ville, this is really nice feature. I'll use it for dynamically loaded textures to levels defined in files. Would it be possible to load also meshes if format of the loaded file corresponds to the internal storage of meshes in ZGE?

Another question: would it be possible to have functions for handling on key events? I would like to use e.g. back or menu keys.
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

I've now added a getBinaryProp function too so you can get the content of a binary property, modify it, and then set it again. Attached is a project that modifies an uncompressed bitmap.

Yes it can be used for all binary properties, including meshes. Although the mesh binary format is designed to be compact and not easy to use ;)

Android back and menu keys is on my todo list. I would like the back button to behave like Escape in Windows so you can use the EscapeToQuit property and quit() functions instead if you want your own control. It requires me to write some Java code though so I haven't got around to it yet. Remind me if it doesn't appear.

Updated beta: http://www.zgameeditor.org/files/ZGameEditor_beta.zip
Attachments
GetSetBinaryProp.zgeproj
(73.45 KiB) Downloaded 660 times
airpas
Posts: 48
Joined: Wed Apr 18, 2012 11:50 am

Post by airpas »

there is a compilation error with fpc (2.6)

ZExpressions.pas(314,15) Error: Forward declaration not solved "TExpExternalFuncCall
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

VilleK wrote:I've now added a getBinaryProp function too so you can get the content of a binary property, modify it, and then set it again.
This is really great! As an experiment, I wanted to save an array with internal representation of a mesh into a file and then loaded this file into another ZGE project. My intention is to allow fast and simple dynamic loading of meshes to ZGE applications (my loader of obj files is quite slow). A simple ZGE project allowing to load 3ds mesh and to save it in binary form would treat the purpose of mesh file converter. The problem is that File component does not allow to save bytes, just floats. Therefore each byte of the mesh is followed by three additional zero bytes in the generated file. Here, I would really appreciate if the (binary) File component would allow to save bytes directly. (Maybe also strings, floats, and integers in their memory representation.) See the attached ZGE projects to see what I wanted to achieve.
Attachments
ResourceSaver.zgeproj
Generator of resource (mesh) files.
(9.75 KiB) Downloaded 647 times
ResourceLoader.zgeproj
Loader of resource (mesh) files.
(989 Bytes) Downloaded 628 times
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Rado1: I've changed so that File.TargetArray also works when writing to files. I modified your test project to use this feature and now it works.

airpas: This is fixed now, get the latest sources and try again.

Updated beta: http://www.zgameeditor.org/files/ZGameEditor_beta.zip
Attachments
mesh_loading.zip
Rado1's modified example of save/load meshes
(10.45 KiB) Downloaded 653 times
Post Reply