[Multiplayer Discussion]Dedicated Server/Peer and Client?

0 favourites
  • 14 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • Hoping to generate some discussion, I would like to ask if anyone who has messed with the idea of using the Multiplayer Plugin to create a dedicated peer/server and client peer who has any information and experiences to share.

    Essentially, instead of trying to use unsupported WebSocket plugins (and/or just to get the basic hang of multiplayer game creation), I would like to create a game that utilizes C2's Multiplayer plugin to have what is essentially a dedicated server and clients.

    I have run into some barriers though, in my idea of a server peer and client peer.

    Because there is currently no way to specify build for a project, a server peer would either have to be implemented as a variation of the client peer, or vice-versa, and grouped according to client-specific functions and client-specific functions, with the release version simply an "events disabled" of one or the other.

    The other way I imagine would be to separate the two into a server peer and client peer project. With this solution, however, all objects, layers, layouts, & etc. would need to be appropriately mirrored between projects. This sounds like a hassle (but could be a tad easier given the use of a repository).

    Then there is also the requirement that the server create new "rooms" autonomously. So say, if a player would like to enter a new, separate instance of a map, the server would have to open a new tab with a room given a unique ID that it then passes to the player to attempt a connection.

    There is also the matter of databasing, and also passing information between room instance... tabs.

    Some of this could be implemented later, however, I'm not sure how to even start a project that uses C2 in such a way.

    Could there also be support some day for build-specific code so that we could separate client/server builds and/or (for other uses) platform specific builds without fracturing a project into multiple varied ones?

    Maybe Ashley can comment on that last idea.

  • The Ghost Shooter Multiplayer demo is hosted by a dedicated server. The server is just a peer running in a browser tab. I make sure the server opens the tab first, the server joins and therefore becomes host, and then the server events are activated. So it's just done as one project and shared events.

    It's difficult to run a dynamic number of rooms with this method. But you could open say 20 tabs and have 20 rooms running on a dedicated server.

  • I appreciate the input. And how reliable would the one-project solution be as the project grows? Or should that matter at all? My primary concern (which I forgot to add) was that of shipping off server code with the client. I mean, minification would certainly help, but isn't shipping off both the client and server to potential players still not a good idea?

    Followup question would be: are disabled events also compiled when a project is exported? Can I just disable all server code in the client version?

    [quote:3k518yix]It's difficult to run a dynamic number of rooms with this method. But you could open say 20 tabs and have 20 rooms running on a dedicated server.

    Ashley yeah I thought about that. I guess it's a sort of interim solution. Keep a list of all available rooms, and shuffle off players as needed.

  • I pretty much do what your wanting to do. It's not that hard. You can also create a tab for each room, but make it graphical less. Just make a special server peer that moves data.

    As for database stuff. I'm pretty sure there are some db plugins being worked on.

    I'm working on a project here and there that does pretty much what your looking into. It's not an MMO, but it is in an open room based point and click adventure engine with persistent gear and leveling... ok not that far, but eh some year.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I had imagined that exportedproject into linux node-webkit and ran it on a server like linode.

  • how reliable would the one-project solution be as the project grows?

    I don't see any reliability issue - it probably works better that way, since there is often a lot of logic in common between the server and the clients.

    [quote:1moj2a8g]My primary concern (which I forgot to add) was that of shipping off server code with the client.

    That should not be a problem - firstly the code is pretty well obfuscated if you minify it, and secondly if you make sure the server is the host then nobody else can host so long as the server is running.

    It might be a useful feature anyway - players can then run their own servers.

    [quote:1moj2a8g]Followup question would be: are disabled events also compiled when a project is exported?

    Yes, but I am still unaware of any case of anyone getting anything even slightly useful out of a minified exported project. The obfuscator is pretty effective.

  • I'm also interested in all the things mentioned in the first post. For security reasons I don't want to upload the server code on a public web server (only the server should handle database inputs) and I've had a lot of problems syncing objects while having two different projects for the client and server.

    If Ashley could add an option to not include some event sheets when exporting that would help a lot!

  • As I said it should not be a problem to ship server code in the game - not only can it serve as a useful feature, there have also been no known cases of anyone being able to reverse engineer it. Since there is so much duplicate logic between the server and client it makes a lot of sense to work with one project anyway.

    If you're that worried you can delete the server group, export, then undo.

  • Thank you Ashley, I am very impressed with the 'minify script' option C2 has. I have one more question about the multiplayer feature and would be happy if you had an answer for it;

    Is it be possible to stop peers from syncing object positions if the object doesn't meet a certain requirement? For example if I want the host to be a dedicated server, instead of relying on tabs to make rooms (that can accidentally close) I can let the host sync all players but the peers would only sync the players in the same room using an instance variable (I believe this could reduce lag for the players if you have a lot of players moving at the same time, correct me if I'm wrong?) or is there a better way?

  • There's no way to do that right now other than use separate tabs.

  • Hi,

    we've had nearly the same discussion a few days ago:

    Maybe we should exchange some ideas?

    Best,

    Benjamin

  • Thanks everyone for the input!

    As I said it should not be a problem to ship server code in the game - not only can it serve as a useful feature, there have also been no known cases of anyone being able to reverse engineer it. Since there is so much duplicate logic between the server and client it makes a lot of sense to work with one project anyway.

    hat's settling to know. I won't worry about it then.

    > how reliable would the one-project solution be as the project grows?

    >

    I don't see any reliability issue - it probably works better that way, since there is often a lot of logic in common between the server and the clients.

    'll give that a shot.

    I had imagined that exported project into linux node-webkit and ran it on a server like linode.

    ood to know!

    Ashley Emy (edit: it's not linking your name?) that idea sounds very useful. Right now, if you use a huge layout, regardless of the distance between players, all objects will be synced, correct? Something to decrease server load such as not syncing movement data between peers farther than X would be nice to have.

    Are there any features in the development queue that might have such a use?

  • As for the mentioned security:

    Why not make 2 separate apps ? A host and a client.

    The host can be stuffed anywhere the public perhaps can not reach, hell even straight from its desktop

    As for a database, I would simply have the host totally abuse the webstorage.

    As for automatically opening dedicated tabs, thats easy, the browser plugin lets you open pages/tabs

    Either have multiple exports of the game in dedicated directories, ie ../gameRoom1/ etc

    Or catch something from the URL to open a room on the newly opened tab: index.html?room=1

  • Is it possible for me to host the game on my linux web server and have all clients connect to my server? For example if they go to mywebsite.com and launch the game they're not creating the host but are peers that are connecting to mywebsite.com.

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