• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Choppy animation in android OpenGL Game Loop

 
Ranch Hand
Posts: 55
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all

Really hoping someone can help me out here. I've written an android Open GL ES 2.0 game and my logic update calls and rendering calls are running on the GL Rendering thread. I'm also using a fixed time delta, not variable.

The code for my loop is below. The problem is that the animation just isn't smooth. It will run for a second or 2 smoothly, then it will become 'choppy' for a little while, then return to normal.

The 'choppiness' is present if the sprite is moving fast or slow, but is a lot more noticeable with faster moving sprites.

I have 2 test devices, a Google Nexus 10 running KitKat and an old Samsung Galaxy Ace running Gingerbread. Now, if I change my 'maxFramesSkip' value from 5 to 1 it runs perfectly on my Nexus 10, however, on the Galaxy Ace, it seems to speed up and slow down, so I changed it back to 5. At andvalue other than 1, the animation is choppy.

I've tried interpolation but this has no effect. I've included my code here for that too.

I can't understand why this is happening. I should point out that my rendering takes a maxumum of 14ms to complete and the logic updates take a maximum of 4ms to complete. So there should be no frame skipping. I'm therefore wondering if there is something wrong with my loop? I'v spent literally months trying various things, but nothing produces smoother animation. So i'm hoping someone with a better understanding of game loops can help me out!!

Any help would be apprecated!

Main Game Loop



Interpolation in render()

 
This tiny ad is wafer thin:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic