ARKit and OpenCV

Hi Guys/Gals,

As a matter of learning I have been working on a simple app using ARKit since it works on Android and IOS along with OpenCV to make a Cocos2d-x game that lets you go on a scavenger hunt using everyday objects around you.

But, now I am struggling a bit with design. I feel like I should make my own wrapper classes around ARKit and also ARCore you can literally drop my library and these libraries and just use whatever one you want by calling my libraries API.

Also, I am struggling a bit with building. I think I am going to switch to CMake for all platforms and let CMake build all my deps and my library and also make a demo, the game for each platform and perhaps that lets me spend my time in a text editor versus between XCode, Android Studio, etc.

Does anyone have any advice?

It’s a good idea to switch to using CMake for all platforms. I’m personally finding it so much easier to maintain my project because of this, since I don’t have to keep updating different project files every time I add new source files (*.vcxproj, *.mk files etc…).

What exactly are you asking though? Are you asking how to do it, or are you just wondering if it’s worthwhile (it really is worthwhile!).

For the current project I’m working on, I moved all non-game engine related functionality into a separate library that I link statically to the game when it is built. The reason for this is just in case I need to use that functionality elsewhere (such as using a game engine other than Cocos2d-x).

I previously had a Visual Studio project file for Windows builds, and a separate Android.mk for the Android build, and one for iOS… this is really a nightmare to maintain, and I’d often miss source file entries and only find out about them when I’m building. Switching to a CMakeLists.txt file solved that issue for the most part.

I’m just sort of starting conversation about it and how it might go down.

If you’re going to support both ARKit and ARCore, then perhaps it’s best to create a common interface, with the platform implementation specifics being hidden, so there wouldn’t be a need to add platform specific code every time you create a new game, regardless of which platform you want to run it on.

It does create more work for you, but the end result would be the ability to write a game that works on both platforms using common code, which saves a fair amount of time and effort in the long run.

Exactly my thought and having a common build system will make life easier too.