On Fri, Jan 9, 2009 at 11:03 PM, Dianne Hackborn <[email protected]> wrote: > The system delivers events as fast as you will process them. This is a > common issue when a game is designed where most of the work is done outside > of the main thread
This makes sense to me. > probably the best solution at this point to to sleep > for some number of milliseconds each time you process an event to throttle > the delivery rate. I do "yield" to the main thread by calling mainActivity.runOnUiThread w/ a no-op (cached) runnable once per second but I guess that's not enough. I'll try increasing that to see if it will make a difference. I'd rather run the game @ 40 fps by losing ~15 fps because of yielding than losing ~30 fps because of touch event throttling. > You could also bump up the priority of your game thread > -slightly- to give it a bit of an edge over the main thread. I'd rather "control" the priority myself :) > > Oh and this is a touch screen. You are never not moving your finger, it is > always moving slightly no matter how still you are. Add in pressure and > size to x and y, and there is something always changing. Right, I did forgot about pressure, thanks for pointing that out! Thanks a bunch Dianne, you've been very helpful! Cheers, Stoyan > > On Fri, Jan 9, 2009 at 8:02 AM, Stoyan Damov <[email protected]> wrote: >> >> OK, I measured how many moves per sec the view gets when I hold my >> finger as still as possible. >> The result is surprising (I expected more and was hoping that's the >> reason for the slow down) and is about 70 moves/second. >> I still don't get why the view gets 70 moves/sec if I'm not moving my >> finger at all :( >> Can anyone shed some light on why touching the device's screen and >> holding the finger on it will decrease the speed of my app as much as >> *twice*? >> >> Thanks! >> >> On Fri, Jan 9, 2009 at 2:40 PM, Stoyan Damov <[email protected]> >> wrote: >> > Hi guys, >> > >> > I'm developing a touch-controlled game and have noticed that when I >> > touch the screen and don't lift my finger off it the game's frame rate >> > drops in *half*. >> > My touch-related code does nothing but record the touch event, that >> > is, setting a few members of an object. No locking, no nothing. >> > >> > I've noticed that a long time ago and wasn't very concerned because >> > even with this unreasonable frame drop the game plays at > 25 fps and >> > is still visually pleasing, but it doesn't look as good as when >> > playing at full fps. >> > I'm wondering if anyone knows (especially guys who have developed or >> > are developing similar games) whether there's something I can do to >> > make this performance problem go away. >> > The only thing I've figured out so far is to disable the long press on >> > the surface view (thinking that Android itself is making something >> > funny if long press is requested) but it didn't make any difference. >> > >> > Thanks! >> > Stoyan >> > >> >> > > > > -- > Dianne Hackborn > Android framework engineer > [email protected] > > Note: please don't send private questions to me, as I don't have time to > provide private support. All such questions should be posted on public > forums, where I and others can see and answer them. > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

