Where to start for a HTML5 Multiplayer game.
- vitinho444
- Posts: 2819
- Joined: Mon Mar 21, 2011 4:54 pm
Where to start for a HTML5 Multiplayer game.
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
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
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Where to start for a HTML5 Multiplayer game.
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.
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
- vitinho444
- Posts: 2819
- Joined: Mon Mar 21, 2011 4:54 pm
Re: Where to start for a HTML5 Multiplayer game.
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.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Where to start for a HTML5 Multiplayer game.
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
- vitinho444
- Posts: 2819
- Joined: Mon Mar 21, 2011 4:54 pm
Re: Where to start for a HTML5 Multiplayer game.
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.
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.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Where to start for a HTML5 Multiplayer game.
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
- vitinho444
- Posts: 2819
- Joined: Mon Mar 21, 2011 4:54 pm
Re: Where to start for a HTML5 Multiplayer game.
I will learn it first with Eureca since the tutorial covers that, then we'll see, but thanks
Does the server run like normal PHP server? I mean, does it run on every web host?
Does the server run like normal PHP server? I mean, does it run on every web host?
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Where to start for a HTML5 Multiplayer game.
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
- vitinho444
- Posts: 2819
- Joined: Mon Mar 21, 2011 4:54 pm
Re: Where to start for a HTML5 Multiplayer game.
Ah dang it... It will be tough to publish then.. Maybe I can use my raspberry pi as a server for publishing...
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Where to start for a HTML5 Multiplayer game.
Why would it be tough to put it out? Or do you mean to something like Kongregate?
The indelible lord of tl;dr