Need help for AABB Tree native extension

Hello Defold Believers :rofl:

I’m working on AABB Tree native extension for handling broad phase collision detection in my game. Planning to use it for culling of offscreen objects and trigger events. It is just a wrapper of AABB.cc . Also I’m planning to add narrow-phase collision detection into it like swept aabb. I’m not a C++ guy so doing this blindly :slight_smile:

Actively working on it, here is my dev branch: https://github.com/selimanac/DAABBCC/tree/dev

Need help!

1) Windows Build

I need help for building AABB.cc library on Windows. I manage to build it for MacOS and Linux. But unfortunately, I don’t have a “Windoz” box.

I removed unnecessary stuff like python wrapper and docs for Doxygen from original lib. Here is my build/make files: https://github.com/selimanac/aabbcc/tree/defoldWrapper

2) On init solution

Correct flow for lib is;
a- createTree
b- insert aabb’s in the created tree.

But as you can think of it is not possible to creating and inserting at the same time in the init of different scripts.

Script 1:
- Create “balls” tree on Init

Script 2:
- Insert aabb into “balls” on Init

Is there any solution/suggestion for this? Of course sending a message to script 2 is a solution. But I’m curious about if it’s possible to do it on init.

3) More tests needed

Since I have a limited hardware, this lib is definitely need more testing on different device and platforms. I’ll be glad if you can share your results

Any help or suggestion a specially for performance improvement would be most welcome :pray:

3 Likes

In which format do you wish to have the results? What should be measured?

There’s no way to guarantee that the init() function of script 1 has been run before the init() function of script 2. Message passing is probably the way to go.

Nothing serious. Just download and build the project as it is. Profiler is on. You can share the “max frame” and cpu usage with your computer info(cpu, os, ram). That is enough for me.
If you want to burn your cpu, then you can increase the number of balls and speed :slight_smile:

Thank you. It would be nice to have something like Unity’s Awake or OnEnable… Since there is no culling in Defold, OnEnable and OnDisable would be very useful