Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - phil.atha

Pages: [1]
1
TNet 3 Support / Objects Instantiate with No Owner
« on: October 29, 2017, 10:54:08 PM »
I'm seeing this happen on player objects AFTER I've switched to my 'Game' scene. I'm keeping alive all of the objects that should carry over between scenes, and these objects that don't work (player home bases for an RTS game) do not have any other dependencies tied to them, just a simple dynamic TNObject.

Under what conditions might a TNO instantiate without an owner?

2
TNet 3 Support / Discord Chat
« on: October 25, 2017, 07:48:01 PM »
Querying for interest if anyone would find use in a Discord chat for TNET. I thought it might make sense to have another resource for discussion. The Forge community has one and I've found it useful for general questions.

3
TNet 3 Support / Best Practices: Checking For Player Readiness
« on: August 01, 2017, 11:07:32 PM »
I'd like to get some input from others as far as how they go about tracking user readiness when loading a game that requires global synced events. Currently my host and clients all change the level at the same time, then the host instantiates objects, but once the players are ready the game clock should start and the game begins.

I'm looking for techniques to tell when all the players are ready. So far I have a single IEnumerator on the host side that checks for a ready bool on all the clients, but other than tracking object types in the scene, what are some other creative ideas for checking player states?

4
TNet 3 Support / RFC RCC Parms not getting passed
« on: July 17, 2017, 01:10:45 AM »
Are there any known issues with parameters not getting pass or passed unreliably?

I'm passing a simple int to a function using tno.Send and it doesn't make it over to the function. Sometimes if I call SendQuickly it will work but its unreliable. I could be in an edge-case situation but I can't be sure. In doing my debug tracing I know the value is making it to my GeneratePlanet function just fine but from there it never makes it to the target  class and I can't figure out why. Anything glaringly obvious I'm doing wrong here?

Speaking of debugging, sometimes when attaching VS to Unity I sometimes experience issues with all the TNet functions firing. Does that happen to anyone else?

Code sample is as follows:
  1. class PFactory
  2. {
  3.         IEnumerator GenerateScene()
  4.         {
  5.             GUIManager.instance.SetState(GameState.Loader);
  6.             GameSettings _settings = ReadSettings();
  7.  
  8.             yield return new WaitForSeconds(2);
  9.  
  10.             //Some super secret code here ;p
  11.  
  12.             int perlinSeed = Random.Range(0, 90000);
  13.             TNet.TNManager.Instantiate(GameNetwork.instance.channel.id, "GeneratePlanet", path, true, perlinSeed);
  14.  
  15.             yield return new WaitForSeconds(2); //At least 1 seconds of loading screen
  16.             GameNetwork.instance.isLevelBuilt = true;
  17.         }
  18.  
  19.         [TNet.RCC]
  20.         static GameObject GeneratePlanet(GameObject prefab, int seedVal)
  21.         {
  22.             GameObject _planet = Instantiate(prefab) as GameObject;
  23.  
  24.             PBuilder pbr = _planet.GetComponent<PBuilder>();
  25.             //tns.tno.Send("Generate", TNet.Target.All, seedVal); //Never works
  26.                tns.tno.SendQuickly("Generate", TNet.Target.All, seedVal); //Barely works
  27.            
  28.             //Generate Vegetation
  29.            
  30.             //Cleanup
  31.  
  32.             return _planet;
  33.         }
  34. }
  35.  
  36. class PBuilder
  37. {
  38.         [TNet.RFC]
  39.         public void Generate(int seed)
  40.         {
  41.             perlinSeed = seed; //This value is always 0
  42.             //Magic Happens
  43.         }
  44. }
  45.  

5
TNet 3 Support / Prefabs as Strings
« on: July 01, 2017, 01:22:01 AM »
Q: What is the reason behind RFC prefabs being passed down as strings rather than object references?

I ask because this makes things somewhat difficult where I have a randomly selected environmental prop instantiate on my world. I have to have a big switch statement that keys off of the name to help find out which Prefab subfolder the object is located in. Not the worst thing in the world but it's forcing me into messy code.

6
TNet 3 Support / RFC Calls in Other Classes
« on: June 13, 2017, 05:50:25 PM »
I think I'm misunderstanding the use of the RFC IDs. I had thought that if I tag a function with an ID, I can then call it even if it exists in another script. Is this correct?

  1. public class JoinMenu
  2. {
  3.     public void TogglePlayerReady()
  4.     {
  5.         bool readystate = true;
  6.         tno.Send(1, "PlayerReady", readyState);
  7.     }
  8.  
  9.     [RFC(2)]
  10.     public void SetClockTime(float time)
  11.     {
  12.         countdown.Text = time;
  13.     }
  14.  
  15. }
  16.  
  17. public class HostMenu
  18. {
  19.     [RFC(1)]
  20.     public void PlayerReady()
  21.     {
  22.        //Trigger countdown clock
  23.        tno.Send(2, "SetClockTime", timeValue);
  24.     }
  25. }
This doesnt seem to work however. Is this correct?
The tutorial doc for RFCs is pretty basic and I didn't see the kind of thing I'm doing in the StarLinkUI example.

Pages: [1]