javascript - Creating a live checkers-like web app with PHP, JS, CSS and HTML? - Stack Overflow

I want to create a live, checkers-like app, which will work like this: There will be multiple iconsava

I want to create a live, checkers-like app, which will work like this: There will be multiple icons/avatars displayed on this checkerboard like surface. I want to have a mand prompt beneath this board, or some other sort of interface, that will allow them to control a certain avatar, and get it to preform actions. Multiple users will be using it at one time, and I will all be able to view the other user's changes/actions to the checkerboard.

What I'm wondering is: what's the best way to do this? I've got my HTML, CSS, and JS approach down, but not my data storage method. I know that, using PHP, I've got the choices to use either: file-based storage, MYSQL, or some other method. I need to know which is better, because I don't want to have server-lag, poor-response time, or some other issue, especially in this case since actions will be preformed every other second 2 or so, by these multiple users.

I've done similar stuff before, but I'm wanting to hear how others would handle it (advice, etc.) from more experienced programmers.

I want to create a live, checkers-like app, which will work like this: There will be multiple icons/avatars displayed on this checkerboard like surface. I want to have a mand prompt beneath this board, or some other sort of interface, that will allow them to control a certain avatar, and get it to preform actions. Multiple users will be using it at one time, and I will all be able to view the other user's changes/actions to the checkerboard.

What I'm wondering is: what's the best way to do this? I've got my HTML, CSS, and JS approach down, but not my data storage method. I know that, using PHP, I've got the choices to use either: file-based storage, MYSQL, or some other method. I need to know which is better, because I don't want to have server-lag, poor-response time, or some other issue, especially in this case since actions will be preformed every other second 2 or so, by these multiple users.

I've done similar stuff before, but I'm wanting to hear how others would handle it (advice, etc.) from more experienced programmers.

Share Improve this question edited Mar 14, 2014 at 15:07 mattsven asked May 16, 2011 at 19:17 mattsvenmattsven 23.3k11 gold badges72 silver badges106 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 7

Sounds like a great project for node.js!

To clarify, node.js is a server-side implementation of javascript. What you'll want is a et based application (a web-based client application that receives server side pushes instead of the client constantly polling the server), which is exactly what node.js is good at.

Traditional ajax calls for your clients to poll the server for data. This creates enormous overhead for both the client and the server. Allowing the server to push requests directly to the client without the client repeatedly asking solves the overhead issue and creates a more responsive interface. This is acplished by holding asynchronous client connections on the server and only returning when the server has something to respond with. Once the server responds with data, another connection is immediately created and held by the server again until data is ready to be sent.

You may be able to acplish the same thing with PHP, but I'm not that familiar with PHP and Comet type applications.

Number of users and hosting costs will play into your file vs DB options. If you're planning on more than a couple of users, I'd stick to the database. There are some NoSQL options available out there, but in my experience MySQL is much faster and more reliable than those options.

Good luck with your project!

http://en.wikipedia/wiki/Comet_%28programming%29

http://www.nodejs/

http://zenmachine.wordpress./2010/01/31/node-js-and-et/

http://socket.io/ - abstracts away the munication layer with your clients based on their capability (LongPolling, WebSockets, etc.)

MySQL and XCache !!!!

Make sure you use predefined statements so MySQL does not need to pile the SQL again. Also memtables could be used to use memory storage

Of course make use of indexes appropriately.

If the 'gamestate' is not that important you can even store everything in XCache. Remember that XCache does not store data persistently (after Apache restart)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745270668a4619726.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信