• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

NodeJs Server

Imperial

Member
Hello Everyone

Is there a guide/tutorial on making/writing a NodeJs Server to add Networking to the game ?

Here's the NodeJs I have so far

Code:
var net = require("net");
var port = 3000;

var server = net.createServer();

server.on("connection",function(socket)
{
    var addr = socket.remoteAddress;
    console.log("New Connection: " + addr);
    socket.write("spawn");

    socket.on("data",function(data)
    {
        console.log("data: " + data);
    });

    socket.once("closed",function()
    {
        console.log("Player Disconnected: " + addr);
    });
});

server.listen(port,function()
{
    console.log("The Server has been Started");
});
so as you can see I'm using the socket.write function to send data to the game maker client

but the Issue I don't want to always send data using string

using the buffer_read(buff,buffer_string);

so Is there any solution

and no I'm not going to use Shocknet https://marketplace.yoyogames.com/assets/6962/shocknet-node-js-multiplayer
 
Top