Best Android backend for turn-based game? [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this questionI was wondering if anyone had any good suggestions for the best backend for an android app with play similar to words with friends. Very turn based, sometimes over multiple days.
The first solution that pops into my head is simple PHP/SQL with responses in JSON as it would be quite easy to implement. Although i am just wondering if开发者_运维问答 anyone has any experience with this and can tell me if it has any big down sides. e.g. Poor scaling, few concurrent users, etc.
Is PHP/SQL a good solution? Should i be looking more at a Java server using TCP/IP? Even for these bursts of messages?
Thanks!
I've used both smartFox socket server (quite awhile ago) and PHP/MySQL to handle "multiplayer state synching" on the web (recently)
In my opinion, for a game that's going to have turns that may span days, a database system would be better. A socket server would have to maintain data in memory that may not be in use for hours or days. PHP/MySQL(or SQL) + JSON would probably be a really good fit. Large PHP sites serve pages to thousands of users and may execute multiple queries per page render so I think scaling should be fine.
The advantage of using a database system is that it can be platform agnostic. Your Android game could run on iOS et al via something like PhoneGap.
EDIT: The disadvantage of a database system is Push notification might be harder to rig up. That's out of my realm of expertise.
I would do exactly what you suggested. It doesn't need to be PHP, but basically you will have a web server (could be nginx, apache, etc), and it can be in any language you want.
One of my favorite methods is using a Django MVC setup, using Python on the backend (for awesomeness of Python) and communicate using an HttpClient (or Https even).
I used JSON as the go between (started with XML, but changed to Json as it's lower overhead usually).
You'll probably also want some kind of a PUSH system set up. Either using C2DM, or a third party API. There's an API I used mostly because it was free & pre-C2DM, called Xtify. It's designed to be used as a geolocation tool, but it has PUSH services (and you don't need to use the Geo stuff). Best part, it's free!
That way, you can have the app open, but not wasting battery life with a POLL loop, and just get when the other player's turns end instantaneously.
EDIT: I just looked and it appears that Xtify charges for anything over 300 messages per user per month... so that's probably not the best option for PUSH services anymore.
精彩评论