2

I have just started HTML5 game development, I made a couple of games using the canvas, accessing it with Javascript.

I wonder, though, about how I can make multiplayer online games. Do I necessarily need to use server side stuff for this?

I've heard of HTML5 Sockets, are there other alternatives?

Thank you.

EDIT: Any simple example or links are very much appreciated.

3

1 Answer 1

4

You need a server, P2P doesn't work yet between browsers. See: Do I need a server to use HTML5's WebSockets?

Websocket (HTML5 sockets) is a way to have a bi-directional open connection between the browser and your server. Otherwise you'll have to work using XHR (aka Ajax) which is pull only. Mozilla wrote a great article explaining how they built: BrowserQuest (or just play it: http://browserquest.mozilla.org/)

Alternatives are generally based on Flash XMLSocket!

3
  • I do have a server, FTP server where I host my files, I'm guessing that's enough, right? Apr 22, 2012 at 20:32
  • you have to run a command in a console to start a socket.io server as far as I know.
    – 19greg96
    Apr 22, 2012 at 20:33
  • @user996056 nope, you need a specific web server. One that can accept web sockets (en.wikipedia.org/wiki/Comparison_of_WebSocket_implementations)
    – greut
    Apr 22, 2012 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.