Thinking about some RPG..Android version.

Started by EgonOlsen, December 17, 2011, 11:42:01 PM

Previous topic - Next topic

EgonOlsen

Edit: This is a split from the topic in the projects section for desktop jPCT. This deals with the Android version, which is most likely the way i'll go...if anything...

I'm still planning to port this thing to Android within this month. To prepare for this, i reduced the polygon count of the terrain (have to do this some more for Android) and reverted from phong shaded terrain and trees to gouraud shaded ones...the visual outcome is very very similar in this case. I also added some additional stuff to jPCT and jPCT-AE to reduce memory usage for cloned objects.

EgonOlsen

The same code straight ported to Android OpenGL ES2.0 but with reduced terrain details and tree count:



On my Nexus S, this "runs" @ around 10 fps with full collision detection and stuff...not very amazing. In addition, it needs quite a lot of memory and i'm not sure if it will run on a 2.x VM this way (i'm on 4.0 now, which has up to 48mb of VM memory available).

Bryan

OH wow, it still looks really great even on the phone. Shame it's only running with 10 frames a second. But still.. ;D

EgonOlsen

It's just a mindless port for now. There's room for improvement...the textures are pretty large for a mobile device, the shaders aren't optimized at all, the view distance is pretty high and maybe rendering these tiny little plants makes no sense at all on such a small display...we'll see.

EgonOlsen

Added some basic controls to the Android version, replaced the sky dome with a sky box, decreased view distance, optimized tree processing...

It now runs with full collision detection @9-13fps, which actually feels better than it sounds. However, there's no game logic except for the plants' visibility processing...which seems to be slower than the collision detection, which is odd. Anyway, this scene renders @ 13fps:


AGP

#5
Very cool, man. You're so good with jpct it's almost as if you wrote it. :-) How many polygons total? Is the  Skybox class not available on Android (why would you have started using a sphere?)? How far is the far plane on Android?

Bryan

Well hey it still looks great man. I am sure that's totally a playable fps, just have to see how it goes with some game logic. Keep us updated! I check this thread everyday lol

EgonOlsen

Tweaked the terrain shader...it's 50% faster now, so that the start scene increases from 13 fps to 19 fps...not bad for changing a single line of code in the shader...

I tested it briefly on a Samsung Galaxy S2 (the one with the Mali 400 GPU). It worked fine and ran fast, albeit the shader accuracy lacks behind PowerVR's.

EgonOlsen

Tweaked the shaders some more (start scene up to 23 fps now), shrunk some textures, replaced some textures, improved collision detection and multi touch controls (multi touch with the Android SDK feels...weird, doesn't it?)...

After all the work was done, i visited the forest:


EgonOlsen

Quote from: AGP on December 21, 2011, 12:50:26 AM
How many polygons total? Is the  Skybox class not available on Android (why would you have started using a sphere?)? How far is the far plane on Android?
Not sure about the polygon count...the terrain has around 7000 IIRC, each tree has ~200. The bushes and houses have...i don't know. The sky is a sky box, the class is available on Android too. I started with a sky dome, because i had one...no particular reason. The far plan is at 5500 for now, distance fog starts at 4000.

Bryan

Wow the graphics remain pretty constant even as you're increasing the frame rate. Nice job

EgonOlsen


EgonOlsen

#12
Added basic support for animated objects, i.e. monsters and NPCs. The world is now populated by one goblin that plays it's idle animation over and over again...i have to dig for my old Android optimized A* algorithm to make him move. Anyway, here he is @ 19fps:



...and with an evil grin on his face...



EgonOlsen

Did some more refactoring to prepare for moving NPCs and tweaked the shaders again. The start scene is now at 27 fps and the bushes (like the trees) are now animated in the vertex shader too. That's actually faster than not doing it, because it reduces the overhead of shader switching between trees and bushes.