First, thanks Robert... that's going to help a lot. I've not had to use threading before and it looks to be a must on Android for games so I'm making sure I understand the concepts as clearly as possible. I'm quite thankful that Java's tutorials are as good as they are. I was almost thinking of trying to make the game logic wait and just trigger it when the renderer fires. My thought being... things like collision only need to be checked (I'd be checking one frame ahead of course) on a new render. Would that be a terrible idea?
Secondly... hooray that posts (not sure if it's per individual or not) aren't having to wait days to appear... On Dec 14, 10:35 pm, Robert Green <[email protected]> wrote: > If you're using the render-continuously mode, she'll go as fast as she > can go. 60FPS if you're doing easy HW-accel 2D or very basic 3D. > I've never seen over 60FPS. It's probably vsynced to that. > > I like to use a shared object called the World to pass between my > logic thread and renderer thread. Logic updates world, renderers > draws it. Simple! > > I keep a simple boolean isLocked on the World and synchronize the > calls to getLock() and release(). You will want to set a max rate for > your logic thread to run and have it figure out how many MS to sleep > for. I didn't do that the first time and mine would run at 200-300fps > while rendering at 30-60. That was a big waste of CPU cycles :) None > of my code does that anymore. > > On Dec 14, 9:58 pm, Jeremiah Sellars <[email protected]> wrote: > > > I suppose I should add... that my background is homebrew for Nintendo > > DS and coding in C. The game loop would generally just include a call > > to wait for the screen's vertical blank and that was ~1/60th of a > > second. It couldn't be relied upon totally for timing, but as long as > > you weren't running really intense operations it was fine. DS Homebrew > > is substantially closer to the hardware and the combination of > > learning Java, OOP concepts, working with a very large API and > > applying everything to a new platform is causing me to ask some likely > > stupid questions. > > > Anyway, I hope someone can find a moment to help. > > > Thanks again, > > Jeremiah > > > On Dec 14, 3:51 pm, Jeremiah Sellars <[email protected]> wrote: > > > > Hello everyone, > > > > Continuing to tackle a game project, I've learned tons and have tons > > > more to learn. > > > > From what I've picked up, a "proper" game would have at least 3 > > > threads. The main activity thread which would likely double as the UI > > > thread, the GL Renderer thread which is setup automatically with the > > > GLSurfaceView.Renderer and then a Game Logic thread. As I understand > > > it, I'll need to make sure to setup a sleep timing in the game logic > > > thread to have it behave correctly, but what I'm not sure on is at > > > what timing is the Renderer thread working at? Exactly how often is > > > onDrawFrame() being called? > > > > Thanks everyone! > > > Jeremiah -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

