I´m working on a racing game, and it´s time to start looking at online multiplayer.
I´ve been doing some research, and it seems that most (all?) Phaser online games use Node in some way or another.
Is this the only way to do it?
It seems like Node and JS is a bad choice for a game server, and being single threaded it will probably struggle to serve many users running their seperate sessions.
Does anone have some experience or knowledge about working with Phaser and other server technologies than Node?
I wonder if I´m wrong about Node/JS being bad for game servers, seeing that there are a whole bunch of different frameworks for it.
Or maybe they pop up like mushrooms because Node is the only backend 95 % of self taught developers know… Even if it is scalable it doesn´t mean it´s effective, and you might spend a lot more money on server power than you would have with a multi threaded language.
Either way I realised it will be very difficult to make an authoritative server using anything else than javascript, since I would have to re-create my game logic and physics in another language, so I will probably be taking the Node-route after all.
Hi there, I work on the Hathora framework and was glad to see it mentioned here!
A number of multiplayer games have been built using Phaser and Hathora, and we think the technologies go well together. Even though node is single threaded, node processes are relatively lightweight and Hathora makes it easy to scale horizontally by adding multiple processes.
I’m actually currently working on making a tutorial on how to make a 2D multiplayer platformer on Hathora using Phaser on the client + server side. If you want a sneak peak and read some code, the tutorial is going to be based on this game that I made for a gamejam: GitHub - hathora/star-jump
If you have any questions about Hathora or want to keep up with updates, I’d recommend joining the discord community.
NodeJS uses V8 to execute JS (same as chromium browsers). It’s very fast JIT based engine that can produce code very close to C/C++ speeds.
Putting aside that actually writing multithreaded code is quite difficult, you can do multithreading in NodeJS using Web Workers. Even real multithreading with shared memory by using SharedArrayBuffer.