Can you guys test my android framework? Some questions too.

A place for people with an interest in developing new shmups.
Post Reply
relminator
Posts: 55
Joined: Sat Jun 05, 2010 1:48 pm

Can you guys test my android framework? Some questions too.

Post by relminator »

Hello, I've been learning droid game development this past week and I have some questions I cannot find answers using google. ;*(

First, I've developed my own OpenGL ES 1.x rendering layer by porting some of my old C++(also converted to LWJGL) spritebatching code after reading how to set up openGL from this site: obviam.net

Image

DL(with source):
http://rel.phatcode.net/junk.php?id=141

The framework was slow at first (Samsung galaxy S 2.1) but  after reading this:

http://www.badlogicgames.com/wiki/index ... ut_is_slow

I achieved full speed with 1000 bullets on screen.

I also wasted time to convert my non-interleaved Spritebatcher to an Interleaved one because when the conversion was done, I only get a 1-2 FPS increase on ~1000 entities on screen. ;*(

So my questions...

1) I'm updating entities from inside the onDraw() method.  Is there a better way to update logic?
2) Why does the engine cap at 55 FPS on my 1 ghz samsung and 60 FPS on my 800 mhz LG Optimus E400?  It would still report 55 FPS if even if I only draw 1 entity.
3) What is a good way to support multiple screen sizes?
4) Is there a good Android specific forum I could ask questions aside from here?
5) Can you guys test the apk included in the DL and report your phone model as well as the FPS?


Thanks a bunch!

BTW, how are shmups generally controlled on a smartphone? I mean do I need to make a virtual controller or just do the "follow the touch" option?
User avatar
nasty_wolverine
Posts: 1371
Joined: Sun Oct 09, 2011 11:44 pm

Re: Can you guys test my android framework? Some questions t

Post by nasty_wolverine »

Control on smartphones is crap, but if it has to be on a smartphone, the best implementation i have seen by far is by cave on their android ports..
you can check out danmaku death... the control is pretty good apart from the multi touch to activate bomb part. its free too.

Also:
1) I'm updating entities from inside the onDraw() method. Is there a better way to update logic?
- never mix update and render. eventually you will need to decouple them. sometimes update order and render order will need to be different for some effects. but i dont know how to do this in android.
2) Why does the engine cap at 55 FPS on my 1 ghz samsung and 60 FPS on my 800 mhz LG Optimus E400? It would still report 55 FPS if even if I only draw 1 entity.
- for smartphone, cap your update logic at 30FPS, and let you renderer run at whatever the phone can do. different models may run different FPS but from what i have heard, anything 4.2 jellybean should be locked at 60FPS. lookup semi-fixed timestep.

I will try out the apk later and report my findings :D
Elysian Door - Naraka (my WIP PC STG) in development hell for the moment
relminator
Posts: 55
Joined: Sat Jun 05, 2010 1:48 pm

Re: Can you guys test my android framework? Some questions t

Post by relminator »

nasty_wolverine wrote:Control on smartphones is crap, but if it has to be on a smartphone, the best implementation i have seen by far is by cave on their android ports..
you can check out danmaku death... the control is pretty good apart from the multi touch to activate bomb part. its free too.

Also:
1) I'm updating entities from inside the onDraw() method. Is there a better way to update logic?
- never mix update and render. eventually you will need to decouple them. sometimes update order and render order will need to be different for some effects. but i dont know how to do this in android.
2) Why does the engine cap at 55 FPS on my 1 ghz samsung and 60 FPS on my 800 mhz LG Optimus E400? It would still report 55 FPS if even if I only draw 1 entity.
- for smartphone, cap your update logic at 30FPS, and let you renderer run at whatever the phone can do. different models may run different FPS but from what i have heard, anything 4.2 jellybean should be locked at 60FPS. lookup semi-fixed timestep.

I will try out the apk later and report my findings :D

1. From the looks of it (basing answers on droid people), the onDraw() method is the best way to update logic. ;*(
2. It's easily done (just have to change my fixed timestep to 1/30f) but based from your experience, does a 30 FPS logic feel smooth? I'll try it later when I get to my coding laptop to see how smooth it is.

Thanks!
User avatar
nasty_wolverine
Posts: 1371
Joined: Sun Oct 09, 2011 11:44 pm

Re: Can you guys test my android framework? Some questions t

Post by nasty_wolverine »

So, I ran it on my phone, I ll be honest it looks beautiful, would make a neat live wallpaper by its self :D
Its a HTC Sensation running ICS, it ran at a steady 60FPS.

Also, I did some research. turns out if you want split your render and update, you will have run a separate thread for the update loop.
My general philosophy is dont do threads unless you absolutely need to, but i can imagine the sync issues driving some one mad.
Elysian Door - Naraka (my WIP PC STG) in development hell for the moment
relminator
Posts: 55
Joined: Sat Jun 05, 2010 1:48 pm

Re: Can you guys test my android framework? Some questions t

Post by relminator »

nasty_wolverine wrote:So, I ran it on my phone, I ll be honest it looks beautiful, would make a neat live wallpaper by its self :D
Its a HTC Sensation running ICS, it ran at a steady 60FPS.

Also, I did some research. turns out if you want split your render and update, you will have run a separate thread for the update loop.
My general philosophy is dont do threads unless you absolutely need to, but i can imagine the sync issues driving some one mad.

Thanks a lot buddy!!!

Turns out that making another thread for all updates doesn't give you a performance benefit (in fact, most people say, it slows down your engine). Looks like what I'm doing is the optimal one.


I also did what you suggested (make the logic run at 30 FPS). Well, not really, 30 FPS is a little bit "unsmooth" for my tastes so I made the logic run at 40 FPS and the render at 60 FPS.

http://www.rel.phatcode.net/Temp/Androi ... _40fps.apk
User avatar
nasty_wolverine
Posts: 1371
Joined: Sun Oct 09, 2011 11:44 pm

Re: Can you guys test my android framework? Some questions t

Post by nasty_wolverine »

relminator wrote: I also did what you suggested (make the logic run at 30 FPS). Well, not really, 30 FPS is a little bit "unsmooth" for my tastes so I made the logic run at 40 FPS and the render at 60 FPS.
Try keeping your update steps at factors of 3, like 15,30,45,60 etc...
The reason why standard vsync is 60 is because it has a larger number of factor then something like 50 or 100.
What this means is, at vsync locked refresh rate of 60, update rate of 45 has better syncing with individual frames than 40..
I will try the update once i have some time.
Elysian Door - Naraka (my WIP PC STG) in development hell for the moment
relminator
Posts: 55
Joined: Sat Jun 05, 2010 1:48 pm

Re: Can you guys test my android framework? Some questions t

Post by relminator »

nasty_wolverine wrote:
relminator wrote: I also did what you suggested (make the logic run at 30 FPS). Well, not really, 30 FPS is a little bit "unsmooth" for my tastes so I made the logic run at 40 FPS and the render at 60 FPS.
Try keeping your update steps at factors of 3, like 15,30,45,60 etc...
The reason why standard vsync is 60 is because it has a larger number of factor then something like 50 or 100.
What this means is, at vsync locked refresh rate of 60, update rate of 45 has better syncing with individual frames than 40..
I will try the update once i have some time.
Cool!!!! Will do that.
User avatar
nasty_wolverine
Posts: 1371
Joined: Sun Oct 09, 2011 11:44 pm

Re: Can you guys test my android framework? Some questions t

Post by nasty_wolverine »

Tried the new one.
Game FPS shows at 61
Logic FPS shows at 39/40 (keeps switching)

overall it feels a little jittery...
Elysian Door - Naraka (my WIP PC STG) in development hell for the moment
relminator
Posts: 55
Joined: Sat Jun 05, 2010 1:48 pm

Re: Can you guys test my android framework? Some questions t

Post by relminator »

nasty_wolverine wrote:Tried the new one.
Game FPS shows at 61
Logic FPS shows at 39/40 (keeps switching)

overall it feels a little jittery...
Thanks!

I downloaded danmaku death and the controls rock!


I also imlplemented the same control system and used 45 fps updates like you said.

Tel me if it still jitters.

Apk;

http://www.rel.phatcode.net/Temp/game_framework.apk

Screenshot.
Image


So far the engine has:
3 full screen parallax scrolling
backgrounds.

Can handle more than 1000 bullets
with no slowdowns.

Stereo sounds.

Sorry, I'm writing the post on my
phone.

Thanks.
User avatar
nasty_wolverine
Posts: 1371
Joined: Sun Oct 09, 2011 11:44 pm

Re: Can you guys test my android framework? Some questions t

Post by nasty_wolverine »

Okay, feels definitely smoother than before..
Game FPS shows at 61
Logic FPS shows at 44/45

Also, the controls feel rubberbanded. if i slide my fingers from the top of the visible area to the bottom with the ship right under, the ship doesnt reach the bottom, instead is just off a little. So, the movement is not 1:1 with finger movement. I tried Danmaku Death, its control is also not really 1:1, but a lot tighter, Cave ports are always 1:1 relative positioning.

the trials for the Cave games.
https://play.google.com/store/apps/deta ... rch_result - DDP Resurrection
https://play.google.com/store/apps/deta ... rch_result - EspGaluda

I suggest that if you have buttons for shot and bomb and such, look at how its implemented there. pretty solid control design in my opinion.
Elysian Door - Naraka (my WIP PC STG) in development hell for the moment
Post Reply