I might do some tutorials on building servers for multiplayer games. Just wondering what people here prefer to build servers in. NodeJS or C#?
I would say that since most of the scripts here are written in JS, NodeJS should be the first choice for tutorial.
Personally for myself I would like to know how to do it at PHP/Apache server (shared hosting or VPS) with NodeJS.
Good idea! Never made a MP server, but NodeJS would allow server-side Babylon.js, right? So I think that would be the most useful for us folks.
As a language C# is better, classic syntax, better oop, better markup, propper use of typed variables private, public etc.
But it’s right tool right job, so node would be better for certain things over c# and visa versa (sockets, real time connections, state persistence etc).
As for rendering on the server, maybe complex scene stills or render to file (mp4) but again wouldn’t like to load that on the main server, so that would need to be load balanced on render servers. But this would be a feature / server side component that could be installed on windows & linux servers with ffmpeg etc to get that job done so any serverside language should be able to handle that php, c#, node, py etc.
I’m a fan of the C#, Java & AS3 etc style languages, they have the syntax, oop, structure etc pretty much locked down and are consistent between them (AS3 being a obsolete now and a bit of a lightweight in comparison). Though I would miss the module exports tree shaking capabilities but I’m sure a packager could quite easily check if any class’s and even their methods have been used and to exclude them if not for build / production.
Typescript was nice for a while, but I’ve found myself just staying in JS these days, ES6 webpack and babel. But when file sizes matter I’m right back into the old ways and just using gulp for quick minification.
One thing for sure is that I’m not a fan of prototype based languages. While JS has evolved, there are features coming which have been done in other languages, tried and tested but they are going to do them differently for no reason. 1 I saw was in google io that private and public vars will come to JS but it will be marking an @ or # before the variable to flag it as private or public, like wtf! why not just use private or public, see c#, java or as3 lol.
I use NodeJS but what @Darcey is saying I’d love to see a comparison between C# and NodeJS
Looks like I’ll be starting with nodeJS first.
The server doesn’t do any rendering. That’s all handled by the web front-end. The server just handles communication and storing records of all the players.
The most basic multiplayer server is listening for messages from players, then updating other players with that message. The complexity comes in adding layers of security and optimisations.
@ozRocker multiplayer nodejs game server frameworks:
I come predominantly from a PHP/MySQL background but for current multi-user Babylon.js projects I like Colyseus as it means I can have a single typescript codebase and node.js devops/deploy toolchain for both server and client.
Awesome! I’ll check them out. Do you have any demos using those frameworks?
Sorry, no online demos from me just yet, but other non-BJS games on the Colyseus website.
See also the BJS + Colyseus Boilerplate starter repo although that might need updating to latest Colyseus (I think there’ve been recent breaking changes to API).
I made a player movement demo with Colyseus. It’s basic, all it does is send each client everyone else’s position. Tested on multiple computers with friends. Works well. For fake-prediction when using a physics-controlled camera, telling each client the velocity of everyone else is cheap and dirty.