Schoening
That is somewhat correct, but use this anyway.
socket.on('disconnect', function (data) {
socket.broadcast.emit("message",'D,' + mySelf[0] + ',' + mySelf[1] + ',' + mySelf[2]);
entities[myNumber] = null;
});
—
or anyone that can help.
I've created a server and made it all work. I uploaded it to various different hosts. But they all seem the have the worst connections, with an average ping time of 300 ms.
What would be the best host to host such a server.
i try this solution
socket.on('disconnect', function (data) {
socket.broadcast.emit("message",'D,' + mySelf[0] );
entities[myNumber] = count--;
console.log('D'+ ',' + mySelf[0]+ ',' + 'SCONNESSO');
});
because with your code, the new player can still see the old player who is disconnected.
and for this I put in my layout a LOGOUT button but is the same if you close the browser.
I created a new client, it communicates with another client and enters into aliens, box etc etc, now I have a little problem, when the client aliens that acts as a virtual machine connects sends a connect message, put the aliens on the player client and everything works. the problem is that it also creates a spaceship, perhaps due to the message I, how can I fix this?