Best Android backend for turn-based game? [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
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 question
I 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.

Related

what is the best way to handle real time notification in php? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to implement real time notifications like in Facebook. There might be a huge number of notifications to be sent for different users, depending on server load time and efficiency of coding. Which is the best approach?
1. using normal AJAX?
2. with node.js and socket programming?
3. something else?
Thanks in advance.
The choice of the proper platform greatly depends on your current architecture, knowledge, and budget.
Your question suggests that it is web based, for which there are only two basic options:
WebSocket: There exists many WebSocket server solutions including compiled executables, PHP based, and Node.js. This approach is greatly gaining in popularity but isn't necessarily accessible to every budget since it usually requires a complete server to run. VPS limitations are usually too important for systems that require so many simultaneous connections.
AJAX: The use of AJAX and its variants is still a very popular solution and, when well implemented, can be almost as efficient as WebSocket without the need to sustain the connections constantly. It doesn't often matter if there is a one second delay, and Facebook chat is usually much slower than that.
For non web-based solution, anything is possible. If you develop a client-server application, you can have real time connections similar to WebSocket which can be even easier to maintain.
Ajax request not real time but you can set timeout and in this case work.
but the ajax request busy your server and try to many connections. this is simple !
If you use socket it's better but you need more time to develop this.
Read the following link can help you :
Ajax vs Socket.io
Nowadays we have two possible solutions. WebSockets and Comet. WebSockets are probably the best solution but they’ve got two mayor problems:
Not all browsers support them.
Not all proxy servers allows the communications with websokets.
Because of that I prefer to use comet (at least now). It’s not as good as websockets but pretty straightforward ant it works (even on IE).
realtimenotifications more details To know more about refer above link.

Disadvantage of PHP file system based chat system [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I want to implement Chat system on my website where users can interact with each other in rooms. This is my first time when I am implementing chat system.
On searching, I found that phpFreeChat is a good option but on going through its introduction I found that it doesn't use DB at all. So I am wondering, how good in its performance and how much is it flexible as compared to any DB-based approach.
Anyone who have used can please give a viewpoint whether I should go for phpFreeChat so after that I can start learning more about. The website has a huge traffic of around 3 million visits per month.
Any pull based chat system (in which the clients will have to actively contact the server to ask for updates) is hugely resource intensive. Every client will make a request every so many seconds; multiply that by the number of clients and you're very soon DDoSing your own server.
A proper system should be push based, in which every client has a persistent connection to the server and the server is able to push messages to all relevant parties in realtime. This is perfectly possible using web sockets or long poll as fallback. A pub/sub protocol like WAMP is perfect for this use, as are more specialised protocols like XMPP.
Writing to a file or database is entirely unnecessary and would only be a secondary feature for the purpose of data persistence. The server just needs to be a message broker, storage is not required.
Depends on what you need - my first chat application was also file based and it was (and still is) pretty quick, but customizing and adding new functions is a pain in the ass. If your only need is to have quick chat without complex functions, go for file based. If you need to make user rights and other complex things, go for database based system.

very high number of queries in a second. [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to design a mobile application which requires a lot of database queries. A lot of means, a peak value can be 1 million in a sec. I dont know which database to use and which backed to use. In client side, i will be using phonegap for android and ios and i will be needing a webinterface for pc also.
My doubts are, i am planning to host the system online and use google cloud message to push data to users.
Can online hostings handle this much traffic?
I am planning to use php as backed. Or python?
the software need not be having a lot of calculation but a lot of queries.
And, which database system to use? Mysql or, google cloud sql?
Also tell me about using hadoop or other technologies like load balancers.
I may be totally wrong about the question itself.
Thank you very much in advance.
From what I understand, if you want to store unstructured data and retrieve it really fast, you should be looking at NoSql segment for storage and try to do a POC using a few of the available solutions in market. I would like to suggest giving a try to Aerospike NoSql DB which has a track record of easily doing 1 Million TPS on a single machine.
Google AppEngine could be the answer, it could be programmed in python or php (or java) and easily support scaling up to millions of requests per second and scaling down to just a few to save the resources (and your money).
they use their own NoSQL db, however there's a possibility to use SQL-based backend (not recommended).

Can php and C++ run on the same server and communicate in a web site? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have a client that wishes to have a website written that involves a fairly simple cms driven website that sorts and displays daily reports. The website will require subscriptions and include membership, free trials, etc...
Originally I was going to write the site in PHP, as none of the requirements are too heavy and I am very experienced in it. However, after speaking with the client, he has worked closely with someone who has a C++ product that offers a workflow that includes the entire process of handling subscriptions, logins, and trials and (apparently) can be used on a web platform.
This throws a wrench into my original plan, because even though I know C++ I have never had to deploy it on a webserver or have it communicate with PHP. I've already written a good deal of the site in PHP, so would prefer not having to re-write.
Can I have the two communicate on the same server? What would be required to do so? Would it be worth my time or should I just decide to scrap PHP and use C++? Or should I tell my client he's nuts?
That's about all the info I have about the project right now. Not sure if I can provide much more info, but will try if it's needed.
Thanks for all answers.
Tel him he is nuts.
The reason is that none of those tasks requires the benefits C++ can offer over PHP. It is heavy maintenance pain. And in the big picture putting those two together is more work (in hours) than writing those things in php.
The only thing that would justify C++ is if there is some heavy math business logic involved in there. And i mean heavy.
For problems. Just think about debugging.
In addition to what Thomas says (which is all true), your hosting company will most likely prohibit running custom binaries. Hosting packages short of virtual private server normally don't allow user-written compiled code on the Web server, only scripts.
VPS hosting is, on average, 5 times as expensive.
You can re-write the C++ code in PHP. You can also convert C++ to Java using a converter and then use the Java virtual machine if your host allows that. You can use the C++ code if your host allows that. You can host the C++ code from a local machine if that is a good idea in your case.
I would tell the client that in case there is no explicit need for the C++ language I would go with implementing PHP. You know, the communication between C++ and PHP adds to server load even if the host allows you to use the C++ module. And in the future you will have a lot of pain maintain

How to 3270 screen-scrape from a Linux-based web app [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
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 5 years ago.
Improve this question
I have a LAMP (PHP) web app which need to interface with programs on an IBM 3270 mainframe (via Microsoft SNA Server). One solution I'm looking at is screen-scraping via 3270. (I'm integrating the present with the past!)
Many years ago, I wrote C code which used HLLAPI as the basis for such a task.
Is HLLAPI still the best way to approach this task?
If so, would I be best off just writing a C app to undertake the work necessary and exec() this C app from php?
Are there any open source HLLAPI providers for Linux? (In the past I used commercial solutions such as Cleo.)
I haven't used it but maybe look at http://x3270.bgp.nu/ which says has a version:
s3270 is a displayless version for
writing screen-scraping scripts
I'm currently trying to do a similar thing but with a command line Python script.
I open a pipe to the s3270 (on Windows the exe name is ws3270) to connect to the server and send all commands.
Read carefully those part of the documentation for scripting:
http://x3270.bgp.nu/wc3270-man.html#Actions
http://x3270.bgp.nu/x3270-script.html#Script-Specific-Actions
While I have no experience with 3270, I would expect that finding and calling on an outside application or library is your best bet. PHP is not an all-purpose tool, hacking into a non-web communications protocols is best left to languages like C or Java that can handle that well.
Screen scraping 3270 applications is a perfectly valid way of getting at data. Many of these applications haven't changed for years, or decades in some cases. Sometimes there is simply no API or other programmatic way of getting at the necessary data.
Nighthawk: You could always learn CORBA, that monstrosity of a system was designed to let C programs talk to remote COBOL systems or random stuff written in PL/I or something.
But seriously, if the old app has no API, 3270 screen scraping is fine. There's a lot of similarities between 3270 screens and HTML forms (unlike character mode terminals).

Categories