Making a realtime action game will be difficult when you start to take into account network latency. Specially if you want people to play your game over a 3G or Edge connection.
Your problem might be in the way you are polling for data. If you have a looping thread, it'll hog your CPU and your FPS will suffer. You may be able to counter this using wait() and notify() or a Looper/Handler pattern. There are several ways to solve this, however this is what I did. Decouple the network functions to use a service in a different process. When the services receives network data, we call a callback function in the the main game process. This is quite fast for me using rough measures. However, in your case a simple lock might do the trick since from my experiments, it is much faster than a queue/handler. Again, I suspect that your simply using a bad poll technique in your network thread. On Sun, Apr 18, 2010 at 1:18 AM, croco <[email protected]> wrote: > Hi all, > > I'm developping a simple realtime action game 4 Android. > It works nice. but now i want deal with animation FPS and i'm facing a > big problem i can't solve since couple days now. > > I started from the famous Lunar Android sample using facebook. got > 55-60 frame per second on my G1. > it smelt good for my game i thought ... BUT when i plugged the surface > view in my game i got a poor 6-9 Frame per second making the game > unplayable. > > After debugging removing all content of my doDraw used by the thread > controlling the surface view i found the problem. > > The problem is not the quantity of sprites i displayed but the > concurrency between threads used for receiving my game data over TCP > and the UI thread i use to control surface view. > > If when i start displaying the game i stop the my socket protocol > threads (reader, writer) the game is refreshed at 25 FPS which is not > 50 FPS but large enought to make the game playable. > > So my question is how in realtime game for android i can send / > received data (and not delayed of course) without killing the game > refresh rate. > > Last thing i use canvas and not open gl but i don't need open gl and i > really see the problem comes from the multithreading > > Thanks a Lot for your help. > > Luc > > -- > 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 -- http://diastrofunk.com, http://developingthedream.blogspot.com/, http://www.youtube.com/user/revoltingx, ~Isaiah 55:8-9 -- 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

