Developing online card game for android
I'm currently developing a multi player card game for android with Google App Engine as my back-end. I'd like to know which protocol should i use to communicate android clients with the server, UDP or TCP? I'm aware of the "dry" differences between them but i'm not sure what is appropriate for me in this case. The game will consist several (10+) roo开发者_如何学编程ms which can populate 4-6 players each.
You should make sure Google App Engine supports everything you'd want to use. There are a few options on ways to go about this, and some options are not available on GAE. You mention that you want several different game rooms, and I assume you want it to be real time. Google App Engine has some restrictions on things like threads and socket servers. These restrictions might make this type of application hard to do in an efficient way (without using "polling").
There are ways to get around this like using Google's Channel API: http://code.google.com/appengine/docs/java/channel/
The API looks quite good but it limits your hosting options to only Google App Engine, which isn't so bad I suppose, and you can always rewrite that part of your app later.
If you want it to work most of the time the best would be using HTTP with JSON. You are more likely to be certain that your users traffic would go through the provider proxies, etc.
I would stay away from UDP over long distances. There is no guarantee for UDP packets to be actually delivered to the clients or servers and you wouldn't even know that they got lost. The only rational case for UDP is if you are developing a game where everybody is on the same network. But then you might just scrape TCP all together and just go with the Bluetooth.
With Google App Engine you can only communicate with HTTP/HTTPS, no UDP/TCP socket communication is allowed.
精彩评论