Hello,
I have a game (following the multiplayer tutorials). When I try to reset the connection after the game (so the players can start over) I get all sorts of errors:
- Sometimes leaving + disconnecting causes the Peer object to be destroyed, and the console shows red errors about RTC errors. Like these:
On the host:
Peer '0OF8' datachannel 'o' error: RTCErrorEvent
dc.onerror peer.js:4
domSide.js:49 [Multiplayer] Peer 'playerHost' (0OF8) error: RTCErrorEvent
_OnPeerError domSide.js:49
peer.js:4 Peer '0OF8' datachannel 'r' error: RTCErrorEvent
dc.onerror peer.js:4
domSide.js:49 [Multiplayer] Peer 'playerHost' (0OF8) error: RTCErrorEvent
_OnPeerError domSide.js:49
peer.js:4 Peer '0OF8' datachannel 'u' error: RTCErrorEvent
dc.onerror peer.js:4
domSide.js:49 [Multiplayer] Peer 'playerHost' (0OF8) error: RTCErrorEvent
_OnPeerError domSide.js:49
On the peer:
Peer 'AYKF' datachannel 'o' error: RTCErrorEvent
dc.onerror editor.construct.net/r234-4/plugins/web/multiplayer/c3runtime/peer.js:4
editor.construct.net/r234-4/plugins/web/multiplayer/c3runtime/domSide.js:49 [Multiplayer] Peer 'playerPeer' (AYKF) error: RTCErrorEvent
_OnPeerError editor.construct.net/r234-4/plugins/web/multiplayer/c3runtime/domSide.js:49
editor.construct.net/r234-4/plugins/web/multiplayer/c3runtime/peer.js:4 Peer 'AYKF' datachannel 'u' error: RTCErrorEvent
dc.onerror editor.construct.net/r234-4/plugins/web/multiplayer/c3runtime/peer.js:4
editor.construct.net/r234-4/plugins/web/multiplayer/c3runtime/domSide.js:49 [Multiplayer] Peer 'playerPeer' (AYKF) error: RTCErrorEvent
_OnPeerError editor.construct.net/r234-4/plugins/web/multiplayer/c3runtime/domSide.js:49
- If the host left the room, the other players get the following:
"Cannot parse off host time from pong response
_OnPong editor.construct.net/r234-4/plugins/web/multiplayer/c3runtime/peer.js:20
_DoOnMessage editor.construct.net/r234-4/plugins/web/multiplayer/c3runtime/peer.js:22
_OnMessage editor.construct.net/r234-4/plugins/web/multiplayer/c3runtime/peer.js:21
dc.onmessage editor.construct.net/r234-4/plugins/web/multiplayer/c3runtime/peer.js:4"
- I tried to print the connection parameters on start of the layout:
--- The first time I run the game, the room name, signaling server name,... are all empty strings.
--- After I connect, play, disconnect and leave, and then restart the layout, the names are still saved in the multiplayer object. Shouldn't leaving erase this data?
- On peers, I destroy the Peer objects at the start of layout (since the host will create them).
In short, what is the proper way to close the connection (including the destruction of Peer objects) so that when I restart the layout and the code runs from the start, it works just fine like the initial time?
I have tried many combinations of leaves/disconnects/destroys..etc, with no avail. Any guidance is appreciated :)
Thanks a lot.