Author Topic: Locking a channel  (Read 3324 times)

creativitysquare

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 2
  • Posts: 41
    • View Profile
Locking a channel
« on: December 14, 2014, 05:27:08 PM »
HI All

Imagine you want to make a competition and you accept max 2 players.
When the two players are in the channels you start the competition.

I have two issues:
1) How do I synch so both clients start together? At the moment I let the host set the random parameters, eg. what random level they have to compete against. Once the non-host player joins, he gets these values from the host. Then I start the competition at the same time on both clients. However they are not in synch. If my PC is the host, the PC is ahead of about 1 second. If the iPhone is the host then they are pretty much in synch. Is it a issue related to performance difference between devices (hardware+connection)? Any suggestion to minimize it?

2) If one of the two players leave before completing the level there is one space for somebody that could potentially join. How do I lock the level so once there are two clients nobody else can join until the channel actually "dies" as both clients leave?

Thanks a lot!
Egi

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Locking a channel
« Reply #1 on: December 15, 2014, 01:07:51 PM »
1. You need to use RFCs. Instead of sending values to the newly joined player, they should already be there. So instead of setting some local value like "mySelection = 123;", do it via an RFC:
  1. tno.Send("SetMySelection", Target.AllSaved, 123);
  1. [RFC] protected void SetMySelection (int val) { mySelection = 123; }
This way newly joined players will already have the values set before finishing joining the channel.

2. TNManager.SetPlayerLimit(1);