Rectangle 27 0

In this post we give a quick run-down on what the book covers. The book ships (read: can be downloaded from the publisher's site) with all the source code and a VM with a pre-configured environment for all the hands-on content, including a chat app using XMPP, a rock-paper-scissors game with pub/sub messaging, and VNC over WebSocket.

html5 - Multiplayer Game Architecture - Stack Overflow

html5 node.js multiplayer websocket
Rectangle 27 0

This strongly suggests that you are running the server on one computer and it is not accessible from the other computer clients (the web browsers).

You should ensure that the code you use in the client uses a URL that is accessible by anybody (any client) trying to access the game e.g.

socket = io.connect("http://localhost", {port: 8000, transports: ["websocket"]});

Definitely won't work for anybody other than the person on the computer running the server.

If you update the URL to 192.168.1.4:8000 and that address is accessible to others then it is much more likely to work.

Thanks for pointing out that the URL used by the client shouldn't be localhost. I changed it to "192.168.1.4:8000 but I could not connect from my other computer over my LAN. Then I started apache and I could connect to my previous project from the other computer by visiting 192.168.1.4. Your answer seems to indicate that I'm on the right track. If you or anyone else can shed some more light on this issue I would be grateful.

I found a better tutorial: Real Time Multiplayer in HTML5 from Build New Games. Hopefully I'll have better luck with this more sophisticated tutorial. Thanks.

websocket - Multiplayer HTML5 semi-real-time game, node.js/socket.io -...

node.js websocket socket.io multiplayer
Rectangle 27 0

It supports many different technologies on both the server side and client side, while providing full abstraction over the underlying transport (WebSockets, HTTP Streaming, HTTP Polling, implemented according to the browser). Just give it a try and perhaps go for the totally free edition (called Moderato).

[Disclaimer: I am the CTO of Lightstreamer]

javascript - html5 multiplayer advice - Stack Overflow

javascript html5 websocket socket.io multiplayer
Rectangle 27 0

you shouldn't have to point your browser to the public, the address (depending on where you routed it (if your using express it'll just be /index.html)) http://127.0.0.1:8000 (equivalent to localhost) http://127.0.0.1:8000/index.html

I'm about halfway through my first socket.io game and i'd definitely suggest using a service like nodejitsu for deploying or even testing your game

websocket - Multiplayer HTML5 semi-real-time game, node.js/socket.io -...

node.js websocket socket.io multiplayer
Rectangle 27 0

Best way to do it in real-time would be using HTML5 Websockets. You would need a NodeJS server to handle the websocket connections. I would suggest using the package SocketIO. Look out for chatroom examples or multiplayer game tutorials.

Your display page would opena websocket connection and a room. Also your 2 "remote" pages would join the room and the you would be able to exchange data from one page to another and executre javascript functions.

Pult.io (a web application that you launch on your desktop browser and your phone to communicate between each other) works like this.

php - Can I create a webpage to control another webpage in real time? ...

php javascript html control webpage
Rectangle 27 0

and here is a commented example:

was that what you were looking for?

It is definitely possible to make a multiplayer game, as i also saw a tank game based on node.js

yeah i searched for it and could not find it anywhere anymore too. Pity.

html5 - Multiplayer Game Architecture - Stack Overflow

html5 node.js multiplayer websocket
Rectangle 27 0

Do not drop the multiplayer idea! It's way cooler with multiplayer. :)

Socket.io is a Server-Side JavaScript library. This means that you need Node JS server for it. IE users will be able to talk with Socket.io server, because it uses other protocols if WebSockets are not available. For example: FlashSocket or XHR long-polling. The last technique is available in every browser that supports XHR, but it is inefficient.

The greatest advantage of socket.io is the fallback. You can set it to start with any protocol (like WebSockets) and if the client does not support it, then it tries the others. It is really great, since you can use WebSockets (which will slowly but surely dominate web apps) and still work with browsers which do not support it, like IE or Opera or Safari. I don't know whether there is any other library with this advantage.

I don't know any library for real-time connections for C# (I'm not a C# developer), but it is unlikely that there are none (look at this question). Also note that real-time connections require a bit different server architecture then normal HTTP requests, so probably you will need additional server for handling them.

Also I think that neither nginx nor Apache handle WebSockets (without some hard core tricks) at the moment (but Node JS does!). I'm not sure though.

it does seem that socket.io is the solution to use :) I wanted to avoid writing a server in javascript (im just better and more experienced with c# and could use multi threading etc) but im not against it and my test server supports node already so I guess its time to jump in! Thanks for taking the time to answer :)

@MetalFrog According to wiki: "it (...) has been disabled in Opera 11 until the new version of the protocol is implemented." which actually makes it useless. I do not know the current situation though.

opera:config#Enable%20WebSockets will take care of that.

@MetalFrog You are not a normal user (being a user of stackoverflow is a proof :)) 99% of users are lazy. And most of them would like to have everything ready and working out of the box, especially via browser. After telling them: "install this, install that, add this plugin, configure that, etc." you automatically lose many (sometimes most) of them and make your site less attractive. That's at least what I've seen in projects I worked on.

javascript - html5 multiplayer advice - Stack Overflow

javascript html5 websocket socket.io multiplayer
Rectangle 27 0

There is no reason to lock yourself in platform-wise for something as simple as transport. Support for these things change over time, and you will want to decouple yourself from them as much as possible. You are, after all, making a game, not a network tech demo.

Have a look at Orbited/Orbited2 TCPSocket. You can write your server as standard TCP in whatever manner you like. This also makes life easier if you decide to make a native client.

javascript - html5 multiplayer advice - Stack Overflow

javascript html5 websocket socket.io multiplayer