Author Topic: RequestChannelList broken in version 1.6.5  (Read 4556 times)

sunriser

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
RequestChannelList broken in version 1.6.5
« on: March 17, 2013, 12:06:21 PM »
When using version 1.6.0, using the technique described in http://www.tasharen.com/forum/index.php?topic=2925.0  I am able to get an accurate channel list.

Using this code:

  1. int count = reader.ReadInt32();        
  2.         for (int i = 0; i < count; ++i)
  3.         {
  4.             ChannelObject _newChannelObject = new ChannelObject();
  5.             int channelID = reader.ReadInt32();
  6.             NGUIDebug.Log("Reader-Channel ID: " + channelID);
  7.             int playerCount = reader.ReadInt32();
  8.             NGUIDebug.Log("Reader-Player Count: " + playerCount);
  9.             bool password = reader.ReadBoolean();
  10.             NGUIDebug.Log("Reader-Password: " + password);
  11.             bool isPersistent = reader.ReadBoolean();
  12.             NGUIDebug.Log("Reader-Is Persistant: " + isPersistent);
  13.             string level = reader.ReadString();
  14.             NGUIDebug.Log("Reader-Level: " + level);                    
  15.         }
  16.  

I get this result for two channels on my scene:



When, I create new scene, delete TNET folder, and import version 1.6.5 and run the same scene I get this result for the same two channels:



Did something change in version 1.6.5 that will require updating to this Channel List technique?

Thank you!




PerfectPanda

  • Guest
Re: RequestChannelList broken in version 1.6.5
« Reply #1 on: March 17, 2013, 01:04:26 PM »
It is probably the format of the ResponseChannelList package. The current is
  1.         /// List open channels on the server.
  2.         /// int32: number of channels to follow
  3.         /// For each channel:
  4.         /// int32: ID
  5.         /// ushort: Number of players
  6.         /// ushort: Player limit
  7.         /// bool: Has a password
  8.         /// bool: Is persistent
  9.         /// string: Level
  10.         /// string: Custom data
  11.  

so you would typically want to read it with something like this
  1.         int count = reader.ReadInt32();
  2.                 available_channels.Clear();
  3.         for (int i = 0; i < count; ++i)
  4.         {
  5.                         ChannelEntry chan;
  6.                         chan.id = reader.ReadInt32();
  7.                 chan.count = reader.ReadUInt16();
  8.                         chan.limit = reader.ReadUInt16();
  9.                 chan.password = reader.ReadBoolean();
  10.                 chan.persistent = reader.ReadBoolean();
  11.                 chan.level = reader.ReadString();
  12.                         chan.name = reader.ReadString();
  13.  
  14.                         available_channels.Add(chan);
  15.         }
  16.  

(using a suitable definition of ChannelEntry like this)
  1.         private struct ChannelEntry
  2.         {
  3.                 public int id, count, limit;
  4.                 public bool password, persistent;
  5.                 public string level, name;
  6.         }
  7.  

danreid70

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 24
    • View Profile
Re: RequestChannelList broken in version 1.6.5
« Reply #2 on: March 17, 2013, 05:26:55 PM »
This is one area I'd really love to have a good tutorial/sample for. I am also getting weird results, and planned on getting back to it at some point, thinking my own code (derived from samples) was wrong. After seeing this, I'd really love to request that if someone out there has some sample code for creating a channel-list, menu system (with version 1.6.5) - could you post it? I'm about to re-start my in-game menu - but now I'm worried that I'm using a broken sample as my base-code.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: RequestChannelList broken in version 1.6.5
« Reply #3 on: March 17, 2013, 05:31:53 PM »
I make solid use of this functionality in my own game, so I can certainly come up with a solid example for this, but it will have to wait until after GDC. I'm one of the speakers and have a lot to prepare for.

sunriser

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: RequestChannelList broken in version 1.6.5
« Reply #4 on: March 17, 2013, 07:55:58 PM »
PerfectPanda,

That did the trick! Thanks for the fix!

krissebesta

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 20
    • View Profile
Re: RequestChannelList broken in version 1.6.5
« Reply #5 on: March 25, 2013, 03:25:52 AM »
@danreid70, There is a tutorial here. http://www.tasharen.com/forum/index.php?topic=3512.0  Cheers!  Kris

Yarashiel

  • Guest
Re: RequestChannelList broken in version 1.6.5
« Reply #6 on: March 25, 2013, 12:20:02 PM »
I make solid use of this functionality in my own game, so I can certainly come up with a solid example for this, but it will have to wait until after GDC. I'm one of the speakers and have a lot to prepare for.

Oh boy xD ! Good luck !