PolyVox on Android

Following a previous post about PolyVox on iOS, I’ve spent some time over the last few weeks experimenting with RIM’s gameplay engine as a basis for future projects. Naturally this has involved integrating it with PolyVox and today I have some initial results to present. The video below shows gameplay and PolyVox working together on my Samsung Galaxy S Plus:

The voxel world is one of the levels from Voxeliens but this doesn’t necessarily mean we are bringing Voxeliens to mobile (we might, but we’re just experimenting for now). It was basically just the data I had closest to hand, and the volume dimensions are 128x128x32.

To be honest I’m pretty amazed at how well it runs! I’m seeing a steady 40-50 frames per second and this seems to depend on how many pixels are being drawn. I need to do more investigation into the performance bottlenecks though. Also, be aware that this is a debug build as I’m new to Android development and I don’t know how to do release builds yet (it requires some kind of signing I believe).

Getting PolyVox to build on Android was not too difficult. The only problems were complaints about std::function and about throwing exceptions. For now I just cut out the offending pieces of code but we’ll have to come up with a proper solution in the future.

I really like RIMs gameplay engine, and if we do decide to use it for future projects then it opens up a lot of platforms for us. And after all the work we did on Voxeliens it’s great to be getting back to playing with technology again 🙂


13 thoughts on “PolyVox on Android

    • Unfortunatly there’s no simple answer to this question. In the video the frame rate is varying between about 40-50 FPS, and this variation seems to depend on which angle the terrain is viewed from (even though the same number of cubes are being drawn). The performance basically depends on where the bottleneck in the pipeline is (vertex shader, fragment shader, interpolators, etc) and this will depend on the application. I expect we’ll do more experiment in the future though.

  1. Did you by any chance measure how long it takes to extract the volume? I’m curious if the extractor runs fast enough to still have the destructible environment voxeliens has.

    Also, did you choose to play with gameplay (really poor choice for game engine name) because of its platform independence or are there other features that attracted you?

    • I didn’t measure the extraction performance, but it felt fast. I.e. there was only about a second between launching the application and the terrain appearing. Also, if you look at the previous blog post about PolyVox on iOS then you can see it is updating the volume every frame.

      As for the gameplay engine, it was mostly the mobile support that appealed. We’ve also been looking at Panda3D which is nice and a lot more mature – probably better for desktop development. Panda3D also has networking which gameplay seems to miss. But for a voxel game I don’t think we need a complex engine, and with gameplay it’s much easier to dive into the code and see what’s going on.

  2. Very cool. I think it would make a lot of sense to try and get Voxeliens on the mobile platforms. Frankly I think it fits better in that market space than the PC market. I could be wrong of course, but that’s my opinion.

      • I agree that the gameplay matches mobile a lot better – it’s the kind of game you’ll play for 10 minutes while sitting on the bus rather than playing on your PC when you get home from work. I think the controls are solvable, for example your right thumb could control the rotation of the world while your left thumb controls the tank… then just poke it with your nose to shoot.

        I’m mostly concerned about performance, and in particular drawing the large numbers of enemies. Not sure if mobile phones support much in the way of instancing. I need to do a lot of research here.

        We’ve been on Voxeliens for ages and are both looking forward to doing something new… but at the same time we should make the most of all opportunities and we already have the art assets and design for this. At least we’re playing with new tech, and it provides useful test of our next engine. We’ll just have to see where it goes 🙂

  3. Got me looking at the gameplay engine now. I’ve been following polyvox for a little while but integrating it into Unity is a pain (not to mention requiring pro). I started working on a voxel engine for Unity and said to a friend “I’d rather use C++ and Lua so I can use some libraries (like PolyVox)… but the problem is getting them all to compile on the different platforms and mobile.” Along comes your article and I’m giving gameplay a try. So far I like it.

    Did you come across any snags using it with PolyVox? It would be very interesting to see you port Voxeliens to gameplay.

    • It didn’t compile straight out of the box on Android but it wasn’t too hard to get it working. I had to delete some code that was using std::function as the Android compiler didn’t recognise that, and exceptions were also a problem. There may well be compiler flags I was missing to add support for these features though.

      At any rate we’ll keep these issues in mind, and I think we’ll try to make PolyVox more mobile compatible in the future.

  4. Pingback: PolyVox Marching Cubes

  5. Pingback: Where's the next PolyVox release? - Volumes Of Fun

Leave a Reply

Your email address will not be published.