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.


Messages - acronyte

Pages: [1] 2 3 4
1
TNet 3 Support / Re: SetPlayerSave callback
« on: January 04, 2018, 09:41:02 AM »
I came across this issue in my project.... I ended up use 'if' conditions like so -
  1. private void OnSetPlayerData(Player p, string path, DataNode node)
  2.     {
  3.             if (mycondition1)
  4.             {
  5.                 //do stuff
  6.             }
  7.             if (mycondition2)
  8.             {
  9.                 //do stuff
  10.             }
  11.             if (mycondition3)
  12.             {
  13.                 //do stuff
  14.             }
  15.  

2
Sorry, I was referring to editing the player data file through an ftp software (like filezilla).

I managed to find a work around however..... I decided to use "TNManager.SetPlayerData" in a part of my code that I would just use during development, then remove it when building...

Thanks for the response...


3
If I directly edit a playersave file on the tnet server hosted online (through ftp for example).... When I run my game, rather than the edited file being read, tnet reads the old version of the file....

Why is this?

4
TNet 3 Support / Re: data that all players can access?
« on: November 23, 2017, 05:46:44 AM »
Current version of TNet I'm using for Sightseer explicitly disallows multiple players from using the same save file to avoid this kind of confusion.

SetServerData can be used by admins for important stuff that players should not be able to change - configuration, message of the day, etc.
SetChannelData in a common channel (such as the global chat channel) can be used for player-settable configuration.

Keep in mind that all players have access to all other players' data, as long as they are in the same channel -- so SetPlayerData will work too.

Thank you. I believe 'SetServerData' is the option I'm looking for, however Im not to clear on how to first create an admin.... You mentioned in another thread -
Quote
SetServerData can only be done by the server's administrator. You need to SetAdmin("password") before you use those calls.
....

How do I go about creating an admin? I dont see any admin files on my server :'(

5
TNet 3 Support / Re: Does tnet read .txt files directly from server?
« on: November 23, 2017, 05:34:40 AM »
but each call to TNManager.LoadFile will result in the entire file being sent from the server to the client.

This is basically what I wanted to know. thank you.


6
TNet 3 Support / Does tnet read .txt files directly from server?
« on: November 22, 2017, 07:34:22 AM »
I'm using
  1. TNManager.LoadFile("filename.txt", OnLoadFile);
....for loading data from this file on my server..

What i'd like to know is, Does tnet:
 - read data directly from this file on the server?
 - or does it download the entire file (on start), then read it locally?

I am asking because, the file size will increase over time and concerned on the time taken to read the data...

7
TNet 3 Support / data that all players can access?
« on: October 29, 2017, 08:13:56 AM »
How is this done?

I tried using one file on my server where all players can access, but the file gets rewritten everytime a player uses SetPlayerData.

8
TNet 3 Support / Re: Remove child not working
« on: October 24, 2017, 05:48:47 PM »
Try this:

  1. TNManager.SetPlayerData("data3", null);

This works ...thanks!

9
TNet 3 Support / Remove child not working
« on: October 24, 2017, 03:55:58 PM »
how would i go about deleting a child item from my player data file?
Lets say the file on the server (content below) is save using text (not binary) :

  1. Version 198897
  2.         data1 = "1"
  3.         data2 = "2"
  4.         data3 = "3"
  5.        

How would i remove "data3" from the hierarchy?

I know about "TNManager.playerData.RemoveChild".....but that doesnt work in this case.

10
TNet 3 Support / Re: upload image to server
« on: October 24, 2017, 01:55:01 PM »
I managed to solve getting the "Malformed data packet" error.....

In my code where is says
  1. // Encode texture into PNG
  2.         byte[] bytes = tex.EncodeToPNG();

I changed that to
  1. // Encode texture into JPG
  2.         byte[] bytes = tex.EncodeToJPG(30);

which basically saves as a jpg rather than a png.... The difference between the two save types is a larger resulting file (png larger than jpg)....

The orginal code saved the png at 400kb, while the new code saves as jpg at 20kb...

I can only assume the error was caused by the size of the file?

11
TNet 3 Support / Re: upload image to server
« on: October 22, 2017, 02:03:06 AM »
Im now trying to download that file , and apply it to a texture. All works well, except however, I randomly sometimes receive a "Malformed data packet" when downloading.

  1. public void GetPicture()
  2.     {
  3.         TNManager.LoadFile("filename.bytes", OnLoadFile);
  4.     }
  5.  
  6.     void OnLoadFile(string filename, byte[] data)
  7.     {
  8.         if (data.Length == 0)
  9.         {
  10.  
  11.         }
  12.         else
  13.         {
  14.  
  15.             Debug.Log("download picture a success!");
  16.             Texture2D tex;
  17.             tex = new Texture2D(4, 4, TextureFormat.DXT1, false);
  18.             tex.LoadImage(data);
  19.             tex.Apply();
  20.  
  21.             mytexture.texture = tex;
  22.         }


Unity says the "Malformed data packet" error is coming from 'GetPicture' function.

12
TNet 3 Support / Re: upload image to server
« on: October 20, 2017, 01:13:35 AM »
I managed to get this done using tnet save .... ::)
  1.  IEnumerator ProcessPicture()
  2.     {
  3.         // We should only read the screen after all rendering is complete
  4.         yield return new WaitForEndOfFrame();
  5.  
  6.         // Create a texture the size of the screen, RGB24 format
  7.         int width = Screen.width;
  8.         int height = Screen.height;
  9.         var tex = new Texture2D(width, height, TextureFormat.RGB24, false);
  10.  
  11.         // Read screen contents into the texture
  12.         tex.ReadPixels(new Rect(0, 0, width, height), 0, 0);
  13.         tex.Apply();
  14.  
  15.         // Encode texture into PNG
  16.         byte[] bytes = tex.EncodeToPNG();
  17.         //Destroy(tex);
  18.  
  19.         StartCoroutine(UploadPicture(bytes));
  20.     }
  21.  
  22.  
  23. IEnumerator UploadPicture(byte[] b)
  24.     {
  25.         yield return new WaitForSeconds(1);
  26.  
  27.         TNManager.SaveFile("filename" , b);
  28.  
  29.     }

13
TNet 3 Support / upload image to server
« on: October 19, 2017, 06:02:45 PM »
I know unity has www form to save images to a server through a php or cgi script on the server, but how is this done through tnet? Im thinking it has something to do with saving bytes of a texture and uploading that data to server? I dont know where to begin...

14
TNet 3 Support / Re: Can TNet be used to stream video?
« on: September 13, 2017, 11:37:06 AM »
Thanks for the help and direction cmifwdll..... I'll do a bit more research and post some results on my progress for the sake of how ....if it can be done..

15
TNet 3 Support / Re: Can TNet be used to stream video?
« on: September 13, 2017, 07:35:49 AM »
Thanks for the link....

Can I send the 'data' through RFC like this:
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ExampleClass : MonoBehaviour {
  5.     public WebCamTexture webcamTexture;
  6.     public Color32[] data;
  7.     void Start() {
  8.         webcamTexture = new WebCamTexture();
  9.         webcamTexture.Play();
  10.         data = new Color32[webcamTexture.width * webcamTexture.height];
  11.     }
  12.     void Update() {
  13.         if (webcamTexture.didUpdateThisFrame){
  14.             webcamTexture.GetPixels32(data);
  15. tno.SendQuickly("WebCam",Target.All, data);
  16. }
  17.         }
  18.  
  19. }

Pages: [1] 2 3 4