Can I use host for multiplayer game with 2 player?

Get help using Construct 2

Post » Sun Apr 16, 2017 11:24 am

Hi,

i am trying to create game like clash royal, normally if i set a host and peer for game, when host disconnect form internet, the game can not continue without it.

is there any chance to create host for this? i mean the host do nothing , just sync the peer action . ( sorry for english)
B
10
S
3
Posts: 180
Reputation: 1,212

Post » Sun Apr 16, 2017 6:18 pm

any idea please?
B
10
S
3
Posts: 180
Reputation: 1,212

Post » Tue Apr 25, 2017 1:51 pm

You can create a system where the peer becomes the host if the current host leaves.
you just need to make sure all the details of the game states are preserved on the peer end.


Mind you, these approaches are quite advanced.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592

Post » Tue Apr 25, 2017 6:00 pm

thank you @lennaert

i have some idea for this, by your help on another post witch you answer me.

can you write more about " you just need to make sure all the details of the game states are preserved on the peer end. " ??
B
10
S
3
Posts: 180
Reputation: 1,212

Post » Tue Apr 25, 2017 8:49 pm

I think u need a dedicated server, try look photon.
https://www.facebook.com/TeslaPCgames

https://www.twitter.com/TeslaPCGames

[email protected]

http://www.synergy-studios.net
B
46
S
21
G
58
Posts: 113
Reputation: 32,452

Post » Tue Apr 25, 2017 11:04 pm

You can reconnect to the room when the host disconnects, and become host; if you kept track of the peerids you can swap out the game state variables after the previous host reconnects as peer.

If the previous host got a new ID but was able to reconnect to the previous room ending up with the same peer (which is now host) it can inform the new host of its presence and they can swap out game states and the new host can update the peerids on the objects of the previous host. (This assuming the previous host also preserved game state of various objects, such as peerid of the peers.)

You can keep track of objects and states in various ways, like saving an objects state asJson in an array or other variable, and build a new object based on that info after successful reconnecting with the known peer.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 21 guests