How do I modify default plugins?

0 favourites
  • 4 posts
  • Is there a way to modify default plugins?

    I haven't decided between WebRTC or WebSockets for my online game yet using a server programmed outside construct 2, but either options requires some changes to the base plugin.

    Multiplayer plugin seems to only support peer-to-peer, even though WebRTC is capable of following a authoritative server approach. Upside I gain UDP support, downside I lose the entire IE audience.

    Websocket plugin only allows you to send strings which would be a bit inefficient. I'd like to modify it to add ability to send custom datatypes.

  • It appears you have two questions:

    • Should I use WebRTC or WebSockets?
    • How do I modify default plugins?

    For the first question, we need to know what kind of game you're making. If it's a bullet-hell, use WebRTC. If it's a puzzle, use WebSockets. If it's a card game, use simple ajax.

    For the second question, let's go point by point:

    Multiplayer plugin seems to only support peer-to-peer, even though WebRTC is capable of following a authoritative server approach. Upside I gain UDP support, downside I lose the entire IE audience.

    Peer-to-peer can be coerced into "authoritative server" by simply adding special logic that treats some predefined peer as an authoritative server. It's really quite simple, and you get the benefit of also connecting to peers, so you can send them non-authoritative data for a latency boost (and a lower bandwidth fee on your server).

    Websocket plugin only allows you to send strings which would be a bit inefficient. I'd like to modify it to add ability to send custom datatypes.

    Regardless of the datatype you send, it will get converted to strings anyways. Besides, construct doesn't support types other than string/number/bool natively.

    Notice that you don't have to modify the plugins in either case.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It appears you have two questions:

    • Should I use WebRTC or WebSockets?
    • How do I modify default plugins?

    For the first question, we need to know what kind of game you're making. If it's a bullet-hell, use WebRTC. If it's a puzzle, use WebSockets. If it's a card game, use simple ajax.

    For the second question, let's go point by point:

    > Multiplayer plugin seems to only support peer-to-peer, even though WebRTC is capable of following a authoritative server approach. Upside I gain UDP support, downside I lose the entire IE audience.

    >

    Peer-to-peer can be coerced into "authoritative server" by simply adding special logic that treats some predefined peer as an authoritative server. It's really quite simple, and you get the benefit of also connecting to peers, so you can send them non-authoritative data for a latency boost (and a lower bandwidth fee on your server).

    > Websocket plugin only allows you to send strings which would be a bit inefficient. I'd like to modify it to add ability to send custom datatypes.

    >

    Regardless of the datatype you send, it will get converted to strings anyways. Besides, construct doesn't support types other than string/number/bool natively.

    Notice that you don't have to modify the plugins in either case.

    Interesting.

    Do you know of any examples using the mulitplayer plugin with an authoritative server (A non-construct2 server)?

  • We specifically recommend against modifying the built-in plugins and behaviors. If the built-in plugins don't do what you need, it is better to start a new plugin.

    The Multiplayer plugin already implements an authoritative server model: the host peer is the authority on the game. It is only the connections that go peer-to-peer. The multiplayer tutorials describe this in more detail.

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