Jump to content
  • Advertisement
  • entries
    52
  • comments
    180
  • views
    43474

Android Build

Sign in to follow this  
lawnjelly

933 views

Scrolling

The rewrite is going well .. it was quite tricky to get the scrolling landscape to work with terrain elevation. In the end I had to have not one, but 2 scrolling systems working in parallel (which requires some cleverness to stop them stepping on each other's toes). One to do the terrain ground texture, and one for drawing the actual terrain (and other models and billboards). I did try drawing it all with the second system, but the texture filtering on the ground didn't look good.

jungle_pc.jpg

There is still loads not working, no PCF shadows or proper lighting yet, the terrain is just completely random for testing. But the scrolling landscape can be far bigger than before, I have tested it fine with around 16384x16384 pixel map sizes and lots of vegetation, much better than the 2048x2048 old version.


Android

I should say I had a reasonable idea of the main stuff I needed to get working for the android build, as I had an android build of the previous version of the game. For a start I ran all the OpenGL stuff through the mali OpenGL ES 2.0 emulator on the PC version, so it was 'roughly' right. Then once the android build was compiling and running on a test device I could do the many tweaks to the shaders necessary to get it working.

There is also a small java layer to call the native c++ code of the game, this just does stuff like setup the OpenGL window and pass in touchscreen presses and updates. I just mostly followed tutorials for this as I'm not a java guy.


Android Studio

Android Studio I found was even slower & bloated (and memory hungry, a gig or so) than last time I used it, but at least it was fairly painless to setup compared to the older versions. Adb found my devices okay, and the debugger actually seemed to report some info this time(!). :o

I can't believe anyone actually seriously develops on something like Android Studio though (far too slow), it makes far more sense to develop on PC and keep a build running for other platforms (which is what we used to do with consoles). :lol: Incidentally I preferred to use a real device because android studio plus the googley emulators just made my poor 4gb PC crawl / lockup.

jungle_tv.jpg


Precision and Power of Two Textures


Anyway there was much tweaking to be done, I found that the PC OpenGL ES mali emulator ignored the precision for shaders, whereas on actual devices my medium and low precision variables were screwing up shaders, depending on the device. There was also the dreaded power of 2 requirement, which I wasn't abiding by for my scrolling textures and a few others. I got by this by setting the wrap mode to CLAMP and not using mipmaps, which seems to get them working (I'm not using a variable viewing distance for characters, so mipmaps aren't quite so necessary).

It all seemed to run very well in the end, I had no trouble with frame spikes, and it ran towards 1000fps on my low power PC at 800x480 sizes (so much so that I had to fix my timing code for this lol). And I have a sleep now on the PC version and the Android version and it runs happily at 60fps on android without using much CPU or GPU.

I initially got it working on my Nexus 7 (2012) tablet, then my Cat B15 phone (pretty low end 800x480), then my Android media player (A95X).

jungle_phone.jpg


Still to go

I still have to put in support for keyboard and gamepads as things like tvs have no touchscreen!! :D I may have to buy a bluetooth gamepad for this. And I'll probably do something hugely simplified for the physics as I can't precalculate it with large maps, so I'll probably just have bouncy spheres around the trees etc and calculate it in realtime. I've increased the scale of the models and will probably re-export the sprites bigger as everything looks so god-d** small on these high res devices.

Still have to work out what an Android 'lifecycle' is, and what I need to do to support resuming, lost OpenGL contexts maybe...

Oh and I have to figure out how to maintain an assets file on the device instead of packaging it in the APK everytime I debug.

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!