I have been working on a script that utilizes a Master Server to find a P2P game server for a game I am working on. First I want to tell Aren Thank you for TNET. So far it has done everything I needed and the parts I wasn't able to figure out you gave enough information so that i was able to figure out what was missing.
I am attaching the script to the file and the directions are both below and in the script file. The file is licensed under the Apache License V2.0. You can use it for both commercial and non commercial as long as you note any change you did to it and the license information in the summary.
Directions
1. Setup TNServer so that it is running as a TCP Lobby server.
2. If you have not already imported TNET do so now.
3. Attach script to an empty object in unity.
4. Make a copy of the TNManager.cs script and name it PingTNManager.cs.
5. In PingTNManager.cs change all references from TNManager to PingTNManager.
6. Attach PingTNManager.cs and PingPingTNManager.cs to the object from step 3.
7. Select your Object and fill in the fields for the ConnectToMasterServer script.
Notes:
1. Some of the fields can be removed as they are just for use in the Unity editor for testing.
2. I am new to C#, Unity, and TNET so there is a high chance that things can be done better.
If you would like to leave constructive criticism or have a change that would be useful
please leave a reply on the thread at
http://www.tasharen.com/forum/index.php?topic=5089.0