Making WebGL game multiplayer

Started by
4 comments, last by espa 10 years, 1 month ago

I've been making some progress on a html5 browser game using webgl and am interested in making the game multiplayer (so my friend and I can play simultaneously ). I will not be using a dedicated server at this point of course.

My question is where should I start to begin learning about network programming so I can do this sort of thing? I know there are a lot of books out there on network programming I am just unsure where to start and most of all which will be most relevant for webgl games specifically. Thanks in advance.

Advertisement

At the very least you'll need some kind of lobby server to connect you to your friend, at least to be even moderately convenient.

throw table_exception("(? ???)? ? ???");

In the first place, if there is no centralized server, from which source will you get the list of your peers to connect to?

If your are planning for a private release of your software just between you and your friend you can still hard code both of your ip addresses to connect to each other or you will have no way to find each other.

But even so, if you know the ip address which you want to send a request to you will have to deal with the HTTP Security model on top of which WebSockets are based.

If the cross-domain network communications issues are not a problem for your specfic type of deployment (full public vs inside a business or private network), https://github.com/gimite/web-socket-js#readme may help you with their "HTML5 Web Socket implementation powered by Flash".

Chrome has also a way to let developers ask the user for network permissions by installing your web app as a Chrome app. But you are limited to the Chrome browser user.

Today you cannot host a MMO inside an HTML5 browser without a centralized server because of the security implications of the cross-domain HTTP policy restrictions.

If the choice of WebGL is not as much important for your project, you can be more easily accomodated with Unity with their full network stack.

In the first place, if there is no centralized server, from which source will you get the list of your peers to connect to?

If your are planning for a private release of your software just between you and your friend you can still hard code both of your ip addresses to connect to each other or you will have no way to find each other.

But even so, if you know the ip address which you want to send a request to you will have to deal with the HTTP Security model on top of which WebSockets are based.

If the cross-domain network communications issues are not a problem for your specfic type of deployment (full public vs inside a business or private network), https://github.com/gimite/web-socket-js#readme may help you with their "HTML5 Web Socket implementation powered by Flash".

Chrome has also a way to let developers ask the user for network permissions by installing your web app as a Chrome app. But you are limited to the Chrome browser user.

Today you cannot host a MMO inside an HTML5 browser without a centralized server because of the security implications of the cross-domain HTTP policy restrictions.

If the choice of WebGL is not as much important for your project, you can be more easily accomodated with Unity with their full network stack.

You covered a lot. Looks like I will need a dedicated server to achieve what I'm going for. It's not near the scale of an mmo but I'm eventually going for a similar player interaction experience. I know these kinds of implementations are not easy by any means so do you know where I should begin to learn about setting this up with WebGL/HTML5 once I decide to get a server?

At the moment there is no way for a websocket to "listen" in a web browser which is a bit of a pain for peer to peer games.

If you want to stick to Javascript (to maintain a similar codebase) you can use node.js for this.

Otherwise I recommend http://websocketserver.de. One thing you will notice is that websocket servers are so sodding overengineered and it is almost impossible to find a simple client / server example beyond the handshake (which is actually the easy bit).

As for a list server, I highly recommend using IRC as the system to distribute instance server details. It is barely any bandwidth (so wont annoy other users) and also means you don't need to maintain a central server. Though for websockets to normal sockets to communicate you will still need to set up a websocket proxy.

http://tinyurl.com/shewonyay - Thanks so much for those who voted on my GF's Competition Cosplay Entry for Cosplayzine. She won! I owe you all beers :)

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.

That was a wonderful response thank you karsten.

This topic is closed to new replies.

Advertisement