Jump to content

  • Log In with Google      Sign In   
  • Create Account


Making WebGL game multiplayer


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 españa   Members   -  Reputation: 127

Like
0Likes
Like

Posted 17 February 2014 - 05:11 PM

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.



Sponsor:

#2 Ravyne   Crossbones+   -  Reputation: 6992

Like
2Likes
Like

Posted 17 February 2014 - 06:48 PM

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.



#3 MathieuDSTP   Members   -  Reputation: 135

Like
2Likes
Like

Posted 17 February 2014 - 06:51 PM

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.


Edited by MathieuDSTP, 17 February 2014 - 06:55 PM.


#4 españa   Members   -  Reputation: 127

Like
0Likes
Like

Posted 18 February 2014 - 08:49 AM

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? 



#5 Karsten_   Members   -  Reputation: 1559

Like
2Likes
Like

Posted 18 February 2014 - 09:53 AM

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.


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


#6 españa   Members   -  Reputation: 127

Like
0Likes
Like

Posted 21 February 2014 - 07:38 PM

That was a wonderful response thank you karsten.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS