[Multiplayer Discussion]Dedicated Server/Peer and Client?

Discussion and feedback on Construct 2

Post » Tue Jan 13, 2015 7:24 pm

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.
ImageImageImageImage
B
62
S
19
G
51
Posts: 633
Reputation: 30,826

Post » Tue Jan 13, 2015 8:25 pm

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.
Scirra Founder
B
397
S
236
G
88
Posts: 24,392
Reputation: 194,454

Post » Tue Jan 13, 2015 9:16 pm

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?

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.
ImageImageImageImage
B
62
S
19
G
51
Posts: 633
Reputation: 30,826

Post » Wed Jan 14, 2015 8:38 am

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.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Post » Wed Jan 14, 2015 9:16 am

I had imagined that exportedproject into linux node-webkit and ran it on a server like linode.
B
108
S
26
G
271
Posts: 4,471
Reputation: 151,777

Post » Wed Jan 14, 2015 12:59 pm

DatapawWolf wrote: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.

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.

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.
Scirra Founder
B
397
S
236
G
88
Posts: 24,392
Reputation: 194,454

Post » Wed Jan 14, 2015 4:14 pm

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!
B
18
S
4
Posts: 22
Reputation: 994

Post » Wed Jan 14, 2015 4:46 pm

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.
Scirra Founder
B
397
S
236
G
88
Posts: 24,392
Reputation: 194,454

Post » Thu Jan 15, 2015 2:45 pm

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?
B
18
S
4
Posts: 22
Reputation: 994

Post » Thu Jan 15, 2015 3:20 pm

There's no way to do that right now other than use separate tabs.
Scirra Founder
B
397
S
236
G
88
Posts: 24,392
Reputation: 194,454

Next

Return to Construct 2 General

Who is online

Users browsing this forum: mickeyboy and 9 guests