best server side product/system?

0 favourites
  • 6 posts
From the Asset Store
Create your own wss server and ws server with ssl and without ssl.
  • The multiplayer plugin is great, but is peer to peer, and I need central server code for my games. The servers will be writing to a database, doing AI logic and bots, calling other systems, having complex game logic and certified RNG etc. In my case I am not doing any server side physics or player movement - more a real time turn based game.

    There are many options, I was wondering if poeple could share what they have used succesfully in conjunction with C2, and if they had to write costom connectors on the client side, or could get away with the stock websocket plugin? Not having to write any C2 custom js plugin code for a propriatary client connector would be a big advantage.

    Here is my guess at pros/cons of some technologoes, assuming:

    1. runs on linux AND windows (linux for the production sever, windows for testing on your pc)

    2. easy to learn.

    3. plenty of documentation

    4. database support

    5. backoffice application (UI) support.

    6. Ideally free or free up to a certain number of concurrent users.

    Dedicated game servers:

    1. Smart fox Server

    a) purpose built for games

    b) very popular (for flash games at least)

    c) can use websockets.

    d) uses java

    e) free version and paid versions is not expensive.

    f) basic database access, but ORM of choise can be added in theory (such as hibernate)

    g) The Client api (Which is much higher level than websockets) must be integrated with C2 (unfortuatenly) which is a big job.

    h) all their examples are flash based, nothing for the websocket api.

    2. electro-server

    a) now defunct

    3. Photon Engine https://www.photonengine.com/en-US/Photon

    a) windows only, not suitable for linux servers.

    4. Union server http://www.unionplatform.com

    a) seems to be dead by the forum activity

    b) cant work out what OS it runs on

    c) seems to be java/javascript

    Generic servers which you can write your server logic and run on any OS:

    1. grails 2.5 + tomcat

    a) can write backoffice UIs in very little code.

    b) GORM/Hibernate does all the DB work for you.

    c) websocket plugin is tricky to use.

    d) version 3.1 is not there yet.

    2. node.js

    a) free & lots of plugins.

    b) uses javascript, which, for me, as a java/C++ dev, is an abomination.

    c) very basic DB support?

    d) no backoffice UI support.

    e) researching this, it seems node is single threaded. Thus critical game timers would wait on the same event queue as incomming messages. Nodes "solution" to this is to cluster addtional forked worker processes. Inter-process communication between these forked processes goes through the parent "master" in the form of messages, which is not scalable. The general solution is to have another layer of servers with the game logic, and use RPC or sockets to connect the "front end" node processes with backend game logic servers. Checkout pomelo for an example of this https://github.com/NetEase/pomelo/wiki/Pomelo-framework-overview

    3. Netty.

    a) java nio server.

    b) easy and free.

    c) game server source available https://github.com/menacher/java-game-server.

    Any others?

  • Why did nobody respond to this? I'm looking into this now as well. Not even sure if I'm using C2 for the project yet, but looking for a server first cause I have more ideas about server logic than graphic design...

    I'm thinking of using something like a java websockets based server?

  • Hi nutmix,

    tl;dr: use NodeJS - never ever even think about some other way (incl. services like Photon, etc.; Java, PHP, neighbors cat or whatever comes into mind) to realize a real-time-multiplayer backend! Just don't (speaking of the "state-of-the-art" in 2017)! If you ignore my suggest and do, you'll regret it some day as bad as possible.

    if you have the knowledge and ressources to eigther get a hosting service or host a server yourself (a virtual one, because a dedicated one would be an overkill for this) (think about security, etc.!), then I'ld suggest you in any case the usage of NodeJS.

    Not only, that you can literally do anything with node; its powerful, super fast (heres a comparison with Apache, for example) and scalable untill you go nuts.

    You need a database for your project/Node backend? Download MongoDB (its free), and create a RESTful api (commonly "express" (routing/http middleware) or a CRUD interface will let your backend instantly turn into something dynamic, accepting requests from the outside (clients, ...). Combined with, e.g. "mongoos" (ORM mapped gateway/interface for MongoDB, which makes easy stuff even more easyier - like creating schemes for your tables, etc.), you then will have everything you need, nearly out of the box.

    Great thing about node is, that there are many tutorials... Ild suggest you to start with "best practices" for node in general; this will show you how node works and where you have to pay attention in your code (especially regarding performance and stuff). With some little tweeks, a node server can be a powerfull backend for everything, regardeless if you communicate over http/https or with sockets, etc.

    Colyseus is, for example, a great open source framework (not only for games): http://gamestd.io/colyseus/ (git: https://github.com/gamestdio/colyseus). Theres also a plugin for Construct 2 and a documentation for it (the dev also got a channel on slack, if there are any problems/questions). Btw: I'm also using Colyseus for my current project - its one of the best frameworks (when it comes to real time communication (its based on/using socket.io - https://socket.io/) I've discovered so far.

    Colyseus only offers websocket communications - if you, for example, also need a http-support (or web-frontend in general), you could implement your own middleware or use an another framework (like: total.js (https://docs.totaljs.com/latest/en.html ... %20started) - its also great, fast, open and supports websockets, as well as ajax, etc.)... important (at least I'm really suggesting it): use a socket-based communication for your clients. With the help of a REST api (AJAX), a real-time multiplayer game is also possible, but sockets are mind-blowing fast and easy to use.

    Within the past years Ive nearly forgotten the existence of any other language beside JS, because node is the only thing I'm using - because it covers literally anything (I need).

    2. node.js

    c) very basic DB support?

    NodeJS itself has no DB support, correct. But with a middleware/driver (

    Starting from local plain data files like csv or binary NoSQL (serversided - and clientsided, if you got an api server or something) up to SQL (MSSQL, MySQL,...) and NoSQL (MongoDB, Postgre,...) - or your very own developed database type/server, anything can be connected and used in your NodeJS application/project.

    For example: searching MSSQL interface? Click here: https://www.npmjs.com/search?q=mssql&pa ... ng=optimal

    2. node.js

    d) no backoffice UI support.

    Same as above: NodeJS only got its console by stock, where you can console.log('I am a white line of printed text').

    Depending on what kind of UI you want to have:

    • WebUI: use "express" as middleware for the web; create a login routine for admins/supporter, create your HTML files for admin UI, route them with express (taking care of auth-token or similar within routing) and you got your admin WebUI
    • Want to write your UI in any other language? Then do the same as above, without HTML files, create an api (RESTful, or a CRUD support, etc.) and let anything speak with your backend, anytime, anywhere (need cors? Also no problem, express features it out of the box)
    • Even if you need some other communication between backend (or db, or whatever) and backoffic - I'm sure that there is at least one (simple) way of doing so

    Also, same as above, take a look here: https://www.npmjs.com/search?q=backoffi ... ng=optimal

    2. node.js

    e) researching this, it seems node is single threaded. Thus critical game timers would wait on the same event queue as incomming messages. Nodes "solution" to this is to cluster addtional forked worker processes. Inter-process communication between these forked processes goes through the parent "master" in the form of messages, which is not scalable. The general solution is to have another layer of servers with the game logic, and use RPC or sockets to connect the "front end" node processes with backend game logic servers. Checkout pomelo for an example of this https://github.com/NetEase/pomelo/wiki/ ... k-overview

    Again, same as above (what suprise <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">):

    Vanilla NodeJS is always single threaded. But... (I think you know what follows), there are (more than one) solutions.

    NodeJS already has a built in cluster-feature (docs: https://nodejs.org/api/cluster.html#clu ... w_it_works) with which you can, e.g., create a highly scalable webserver (Tutorial: https://www.sitepoint.com/how-to-create ... your-apps/).

    You could also use development/cli plugins, for, e.g. running multiple instances paralell, which load-balances themselves, etc... there are than enough ways.

    Even the ablity to make JavaScript asynchronious is possible...

    With the depency "pug" you can use the HTML-template engine Jade (do I have to say "out of the box" again?) for your whole Web-frontend (or parts - or just single site or a single url), ...

    How I said earlier: for me, NodeJS covers anything I need - and is the "type of server" I recommended everyone who asked in the past years.

    Hope that I helped you out a bit - if I wrote bullshit on some part (not readable/understandable/unclear) or if you got more questions which I possibly could answer, just answer back here or write me a pm - I'll try my best! <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

    Have a great day,

    Proxy

    Edit: for my current project I created two backend servers, "logic" and "storage", which are communicating together. If a client requests for example something out of the database, the request is routed:

    Client -------request-------> backend(logic) -------request-------> backend(storage) -------request-------> MongoDB

    and the according response is delivered:

    MongoDB ------response-----> backend(storage) ------response-----> Client

    backend(storage) has the chance to talk directly with the client, when backend(logic) also transfered its ID to the backend(storage) - so there is no impact on backend(logic) for DB-related requests - as long as there is no data-processing needed (motion sync, calculating "damage done" after attacks, etc. is routed over the backend(logic) - otherwise there would be no "cheat/inject protection", etc..

    Just for giving you a small example - hopefully its understandable what I wrote (my english isnt the best <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi nutmix,

    tl;dr: use NodeJS - never ever even think about some other way (incl. services like Photon, etc.; Java, PHP, neighbors cat or whatever comes into mind) to realize a real-time-multiplayer backend! Just don't (speaking of the "state-of-the-art" in 2017)! If you ignore my suggest and do, you'll regret it some day as bad as possible.

    Brilliant, thanks for the detailed and informative reply!

    I have actually gone down the node.js route for the game engine prototype and its working nicely. For the backoffice probably ill use a separate grails based system + mysql as you can develop an enitre backoffice in half a day, and mysql is a better option for finanical transactions due to its referential integrety.

    Node is good, and with the ECMAscript 6 editions (classes, let, template literales etc) js is almost bearable!

    The only issue I have found, without a solution yet, is now to have a clustered multiplayer object on a single server. I.e. if you use the node cluster feature, it creates multuple node child processes using fork. If I have a player connected with a socket in one child process, he cant access the mulitplayer game instance running on another child process.

    I have seen some solutions to this, e.g.

    1. Using another layer of sockets (ugh)

    2. communicating throught he parent process ( See this post: https://60devs.com/performance-of-inter-process-communications-in-nodejs.htmlfor performance measurement of child.send())

    3. Using redis. I am not sure about this one - it implies that one process can read/write to another process's socket, which I dont think is possible....

    4. clever load balancing which sends traffic intelligently to a spefic process in a cluster, so that all players get funneled intot he same process untill a threshold is reached, then uses the next etc. I havent resarched if it is possible (e.g. each clustered process be on a different port or similar). I saw there is actually a node based load balancer when you can implmenet clever logic.

    I have decided to ignore this for now, and only have a single node process. If/when this goes into production, I can alwosy switch to smarFox which has clustered multiplayer built in (and java has inter-thread comunication). The problem with smartfox is I would have to write a plugin for it for C2, as it has quite an extensive client library and complex protocol. I tried writing plugins for C2 once - it was not easy.

    However, Ill checkout colyseus first - nice one!

  • If it's turn based you could try Firebase, or Parse.

  • Brilliant, thanks for the detailed and informative reply!

    No prob, helping out, whenever I can <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

    For the backoffice probably ill use a separate grails based system + mysql as you can develop an enitre backoffice in half a day, and mysql is a better option for finanical transactions due to its referential integrety.

    You can also make usage of multiple databases (and even use SQL and NoSQL together); there are many plugins for that.

    The only issue I have found, without a solution yet, is now to have a clustered multiplayer object on a single server. I.e. if you use the node cluster feature, it creates multuple node child processes using fork. If I have a player connected with a socket in one child process, he cant access the mulitplayer game instance running on another child process.

    Thanks for explaining me a problem, I never encountered before (never needed to pass handshakes before). A quick research at the plugin of my trusts docs:

    1. Get pm2 asap (a great process manager for node), if not already done: http://pm2.keymetrics.io

    2. Learn its usage (done in 5 minutes): http://pm2.keymetrics.io/docs/usage/quick-start/#usage

    3. Just start your node server again clustered, with using pm2

    Some reported, that it works (when they got problems without using pm2, like you had), some still have issues (https://github.com/Unitech/pm2/issues/389).

    Since I'll encounter this problem too, at some point, I'll investigate it later. Since my current project has at least 2 different backends, I possibly could (if no solution fits) make a 3th one, which is exclusively used for communication between clients and servers and simply forwards over data between backends.

    However, Ill checkout colyseus first - nice one!

    It's a great product, but lacks on documentation somewhat. By downloading it, there arent really things like broadcasts (to all clients) included on its node side (you have to implement those by yourself) - if you need help or have questions about it, feel free to ask.

    Have a great day,

    Proxy

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)