Page 1 of 1

Where to start for a HTML5 Multiplayer game.

Posted: Sun Jan 18, 2015 2:23 pm
by vitinho444
Hey guys, I've been playing in college a little 2d game with my friends, you might know it, Soccer Heads.
Basically it's 2 heads (players), and a foot, and you play soccer with them, it's pretty fun to play.
Long story short, we have a sort of "league" going on, and sometimes we can't be together to play 1vs1 (it's singleplayer and "splitkeyboard" multiplayer). So I was wondering, how hard can it be to make a multiplayer version of this.

You guys know some tutorials, technology that I can learn and create this? I've heard of node.js + socket.io + html5 could do the trick but I just know the latter and javascript canvas control, the multiplayer part is new to me, well not new new, as I've kinda mastered the Network system in Unity3D engine.

Hope you guys can help me out :)

Re: Where to start for a HTML5 Multiplayer game.

Posted: Sun Jan 18, 2015 3:58 pm
by Jackolantern
Here is a nice tutorial that could probably get you started. It is a Phaser + Node + Eureca (an RPC library built on top of Socket.io) multiplayer tank game tutorial.

Here is another tutorial which I believe goes a bit deeper into latency reduction and also more clearly discusses the challenges and solutions to multiplayer games.

Re: Where to start for a HTML5 Multiplayer game.

Posted: Sun Jan 18, 2015 4:26 pm
by vitinho444
Wow thanks a lot Jacko, If that RPC you meant is similar to Unity's then I'm sure I will get it right. RPC concept is so easy and in my opinion makes Multiplayer/Networking a lot easier.

Re: Where to start for a HTML5 Multiplayer game.

Posted: Sun Jan 18, 2015 7:27 pm
by Jackolantern
I am not familiar with Unity's RPC, but RPC means "Remote Procedure Call" and it is basically where you can call client-side functions from the server, and vice versa. If that is familiar, then I bet they are similar.

Re: Where to start for a HTML5 Multiplayer game.

Posted: Sun Jan 18, 2015 8:04 pm
by vitinho444
Yeah that's it.

In Unity you have the client-side objects and you own only your part, the things you own send RPC's to the network copies of themselves on other clients basically. Same with the things you don't own, which receive the RPC's from their owners.

Re: Where to start for a HTML5 Multiplayer game.

Posted: Sun Jan 18, 2015 8:32 pm
by Jackolantern
Yeah, you could do that setup with Eureca. Of course, you could just learn the basics of multiplayer play with the Eureca and then drop down to using Socket.io itself. Really, Socket.io isn't much harder than RPC. It is just a different way of doing things. You could even use my module dispatcher pattern. Node makes network communications easy no matter how you do it!

Re: Where to start for a HTML5 Multiplayer game.

Posted: Sun Jan 18, 2015 8:38 pm
by vitinho444
I will learn it first with Eureca since the tutorial covers that, then we'll see, but thanks :D

Does the server run like normal PHP server? I mean, does it run on every web host?

Re: Where to start for a HTML5 Multiplayer game.

Posted: Sun Jan 18, 2015 11:35 pm
by Jackolantern
In Node.js, your application is the server. So there is no separate server application like Apache for node. However, you need command-line access to run node applications, so either a VPS or node-specific cloud host is required. Shared hosts like those found for PHP don't exist for node.

Re: Where to start for a HTML5 Multiplayer game.

Posted: Mon Jan 19, 2015 10:34 am
by vitinho444
Ah dang it... It will be tough to publish then.. Maybe I can use my raspberry pi as a server for publishing... 8-)

Re: Where to start for a HTML5 Multiplayer game.

Posted: Mon Jan 19, 2015 8:31 pm
by Jackolantern
Why would it be tough to put it out? Or do you mean to something like Kongregate?