Any books or tutorials about phaser + socket.io ??

Recommended Posts

Hello everybody! I can create single player games with phaser and now I want to start making multiplayer games using socket.io + node.js

So unfortunately I haven't found any tutorials about how to create games on phaser with phaser.

I have never had projects with serverpart(so I have no experience in it)

So that's all I could understand and write myself :[


var express = require('express');
var app = express();
var serv = require('http').Server(app);
var counter = 0;
app.get('/', function(req, res)
   res.sendFile(__dirname + '/client/index.html'); 

app.use('/client', express.static('/client'));


console.log('server started');

var io = require('socket.io')(serv);

io.sockets.on('connection', function(socket)
    console.log('connection #' + counter);


            var socket = io();
            var sendInfo = function()
        <button id="btn" onclick="sendInfo();">Appear</button>

Of course that's the simplest thing to create using node + socket.io

So now I want to create multiplayer in games I've already created. But how?!?! I can't find any tutorials. Can you please help me. Server part is too hard for me :(

Share this post

Link to post
Share on other sites

You are not alone. Socket.io does have poor documentation and lacks many good tutorials/explanations. Which is a shame, as it is nice to use when you eventually know how it works...

What are you wanting to use for the gameplay logic on the server? Phaser can be made to run on the server, but it is not elegant. http://www.html5gamedevs.com/topic/7393-running-phaser-on-nodejs-how-i-did-it-and-why-you-shouldnt-do-it/

Also, I would recommend not sending files from a Node server unless you have to, as it is not what Node is designed for. Use a proper CDN. Upload the client files to your web host, so whenever a user goes to the page the game is on, they download the files from there, instead of your Node server sending them.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.