Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 command 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.

like image 485
mattsven Avatar asked May 16 '11 19:05

mattsven


People also ask

Can you make a mobile app with HTML CSS and JavaScript?

Native app development from the ground up necessitates particular technologies for both platforms. HTML, CSS, and JavaScript are all that are required for a PWA.

Can I create a website using HTML and CSS?

The good news is that you too can use them freely when creating a website with HTML and CSS. Quite frankly, you can customize any tag you add to your page's structure by assigning any number of classes to it. If you want to see the complete list of the classes available, you can open the main creative.

Can I make Android app using HTML?

The Short answer: Yes, you can develop apps using HTML / CSS / Javascript.

What can you do with HTML CSS and JavaScript?

HTML provides the basic structure of sites, which is enhanced and modified by other technologies like CSS and JavaScript. CSS is used to control presentation, formatting, and layout. JavaScript is used to control the behavior of different elements.


1 Answers

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 comet 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 accomplished 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 accomplish 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.org/wiki/Comet_%28programming%29

http://www.nodejs.org/

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

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

like image 91
Brandon Boone Avatar answered Sep 30 '22 13:09

Brandon Boone