Where to start for a HTML5 Multiplayer game.

For discussions about game development that does not fit in any of the other topics.
Post Reply
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Where to start for a HTML5 Multiplayer game.

Post 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 :)
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Where to start for a HTML5 Multiplayer game.

Post 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.
The indelible lord of tl;dr
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: Where to start for a HTML5 Multiplayer game.

Post 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.
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Where to start for a HTML5 Multiplayer game.

Post 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.
The indelible lord of tl;dr
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: Where to start for a HTML5 Multiplayer game.

Post 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.
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Where to start for a HTML5 Multiplayer game.

Post 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!
The indelible lord of tl;dr
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: Where to start for a HTML5 Multiplayer game.

Post 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?
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Where to start for a HTML5 Multiplayer game.

Post 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.
The indelible lord of tl;dr
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: Where to start for a HTML5 Multiplayer game.

Post 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-)
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Where to start for a HTML5 Multiplayer game.

Post by Jackolantern »

Why would it be tough to put it out? Or do you mean to something like Kongregate?
The indelible lord of tl;dr
Post Reply

Return to “General Development”