[Behavior] MultiPlayer + online demo

  • Huge thanks for this.

    I've been doing some research into this too in the hope to build a fast multiplayer game...partially using construct 2.

    This article is excellent: buildnewgames.com/optimizing-websockets-bandwidth

    It discusses using binary to send game data which I think is a big consideration in improving the plugins created.

    You also need a way to port code to a server side environment so construct 2 would need a way to export in that way to avoid cheating.

    I look forward to seeing what comes of it in the near future :)

  • mathiaswing

    I'd like to think that this is the closest we've come so far to a multiplayer plugin for C2. There are other plugins which enable multiplaying, but they're lower-level socket plugins.

    Making a multiplayer game still requires server-side coding in JavaScript (or at least modification of my server-side code).

    aceofpack

    Thanks for your thanks! And thanks for the link on optimising WebSockets. My plugin is built on top of NowJS, which puts another layer of abstraction on top of Sockei.IO, so there's plenty of room here for optimisation.

    As for porting code to a server side environment to avoid cheating, there's no way to do that via Construct 2, which is why I've coded a separate server in JavaScript.

  • But is this plugin only made for ppl who have a server, or is this a plugin to connect to a already setup server? If the last instance is the case, would having a server by myself change the opportunities for making a multiplayer plugin? Might be stupid question, but as said before I don't really have a clue on the technical issues of game-creating software. I just want to design a cool game that can be setup for multiplayer features :D

    Thanks in advance

  • Velojet

    No worries, I'm going to explore your code and aim to help you achieve this goal.

    There's good and bad news around this:

    For the non-technical - server software such has node.js has allowed developers to use the same code client and server side. This means that a method of generating code to be inserted server side can be dreamt of. This is what velojet is actually doing here. He's used code from the runtime that he could run on the server.

    However, you need a server for multiplayer.

    Latency and lag needs to be managed effectively with a few methods:

    • The design of your data for the game
    • The amount of players you want on any screen at one time
    • Optimisation to be sent via binary means (this is your data broken down into its component parts with no 'bloat' added)

    Your game needs to design against cheats:

    • Only send a 'request to perform an action' to the server
    • Client makes the move to avoid lag whilst waits for server
    • Server works out where it expects the player should be/what status they are at etc when the message is receivied
    • Client checks if the move is inline with the server when the response comes through and corrects it to the expectation if wildly different

    This is prediction correction. en.wikipedia.org/wiki/Client-side_prediction

    So, there's a few things here that make multi-player not so simple as a plugin. You need to be able to design your game in a way to be optimised for multi-player.

    Cheaters especially need to be quelled if you want to do in-app purchasing developers.google.com/commerce/wallet/digital

    I'm working on all this and like velojet, it's important to get an example working with the steps you take to even think about what elements are needed to give a true multiplayer plugin.

  • What if i use a cocoonJS plugin? Isn't cocoonJS supposed to support multiplayer gaming?

  • Velojet

    No worries, I'm going to explore your code and aim to help you achieve this goal.

    aceofpack

    Great! Very happy to have your interest and involvement!

    ... This means that a method of generating code to be inserted server side can be dreamt of. This is what velojet is actually doing here. He's used code from the runtime that he could run on the server.

    Perhaps I need to clarify this. What happens is that my server code uses NowJS callbacks that are implemented in the C2 runtime. There's no code from the runtime that runs on the server.

    But is this plugin only made for ppl who have a server, or is this a plugin to connect to a already setup server?

    mathiaswing

    Ppl need to set up a server for the C2 runtime to communicate with - but I provide all the code needed to implement that (using the NodeJS and NowJS libraries (see my OP)).

    What if i use a cocoonJS plugin? Isn't cocoonJS supposed to support multiplayer gaming?

    Haven't used CocoonJS myself, but my understanding is that it simply uses WebSockets to support client<->client multiplaying, without the intervention of an authoritative server to manage and arbitrate (and to red-card cheaters).

  • erhaps I need to clarify this. What happens is that my server code uses NowJS callbacks that are implemented in the C2 runtime. There's no code from the runtime that runs on the server.

    Ah yes sorry. This is all bespoke. I see now how this works after delving deeper. I was looking at c2runtime.js to see if there could be a way to lift code from it for the server but there are some serious arrays within arrays in there! Not sure how it's structured.

  • Velotjet: I've just received newsletter from photon that apparently the new javascript for photon cloud is out. Maybe there is hope for C2 for realtime action multiplayer? :D

  • Yung

    Yes, I'm in contact with the Photon developers and am starting work on a C2 behavior/plugin for the Photon Cloud.

  • Hey again. I can say my spesific idea. (might be a bit naiv writing it in a public thread like this, but i don't really mind it, not very revoulutionary idea anyways)

    I would like to make a competetive game where you can search for a random(likely a similar-ranked player) opponent. The game itself is that you get a board or whatever i should call it with a given number of objects that you are meant to destroy(by clicking them, or hitting them if it's a phonedevice game). For instance player 1 gets 10 blue baloons that he wants to crack, and similarly player 2 gets 10 red ones. The objective is to crack all the baloons of you respective color before your opponent. You can misclick and help your opponent by cracking his baloons. Idea is a fastpaced intense competetive game.

    My question is will this be possible to achieve with your plugin/behavior, or will it not be responsive enough to handle a fastpaced game like this?

  • mathiaswing

    I suggest you try my demo game (see my OP) and decide for yourself.

  • UPDATE

    I used NowJS to implement the server<->client communication. Support for NowJS has ceased, as has further development. So the same (reluctantly!) goes for my Multiplayer behavior.

  • Has anybody looked into Chilly Framework, it seems to be a great solution for achieving our goals.

    chillyframework.com

    They have an example project on there and their nodeJs supports NPM modules.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Has there been any updates on a solid multiplayer integration which protects against possible cheaters?

  • The link to test your game in action is off :(

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