How do I modify default plugins?

Just started using Construct 2? Post your questions here

Post » Mon Aug 18, 2014 1:46 pm

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.
B
4
Posts: 2
Reputation: 200

Post » Mon Aug 18, 2014 6:06 pm

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:
Kalagaraz wrote: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).
Kalagaraz wrote: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.
B
36
S
8
G
8
Posts: 532
Reputation: 6,903

Post » Tue Aug 19, 2014 5:53 pm

Fimbul wrote: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:
Kalagaraz wrote: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).
Kalagaraz wrote: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)?
B
4
Posts: 2
Reputation: 200

Post » Tue Aug 19, 2014 9:45 pm

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.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,240


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests