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 - addebooi

Pages: [1] 2
1
TNet 3 Support / Re: Get list of all players across all channels?
« on: November 28, 2013, 09:30:26 AM »
If you're using the latest verision of Tnet, so coul you use the RFC by sending a broadcast, and then it returns for an example the playerID that you can do whatever that is needed for :) Hope it helped!

2
TNet 3 Support / Re: need some help about channel password
« on: November 12, 2013, 06:20:55 AM »
Could you post the code when the player joins?

3
TNet 3 Support / Re: Change player name in OnNetworkConnect or near.
« on: November 11, 2013, 07:47:43 AM »
I noticed that the tnmanager.playername doesn't change immidiatly as i write. So it changes, just not right away!

4
TNet 3 Support / Change player name in OnNetworkConnect or near.
« on: November 11, 2013, 06:56:10 AM »
Hey! i got a script so when he connects to the server it calls "OnNetworkConnect", and that works just fine. But then i want to change the player name in that function, and apparently that wont work
  1.  
  2. void OnNetworkConnect(bool succes, string message){
  3.         if(succes){
  4.                 Debug.Log("Playername before: " + TNManager.playerName);
  5.                 TNManager.playerName = "ChangedName";
  6.                 Debug.Log("Playername after: " + TNManager.playerName);
  7.                 loadMenu();
  8.         }
  9.         else{
  10.                 Debug.Log("there was an error: " + message);
  11.                 onFailedConnection();
  12.         }
  13. }
  14.  
The name is both Guest before and after the change.
Ive also tested making the name change upon start in the menu that loads
  1.  
  2. void Start(){
  3.         Debug.Log(TNManager.playerName);
  4.         TNManager.playerName = "ChangedName";
  5.         Debug.Log(TNManager.playerName);
  6. }
  7.  
And both here returns Guest.
Then i tested making an Coroutine with a delay by 0.1 seconds, then change the name(in the start function of the menu), Then it works just fine! Is it really neccisary to have a delay for changing name of the player?

5
TNet 3 Support / Are the clients sharing OnNetworkJoinChannel?
« on: November 09, 2013, 07:20:56 PM »
Hey! ive got a small problem here... When i call the "OnNetworkJoinChannel(bool succes, string message)"

What i do in this function is: listOfPlayerInLobby = TNManager.players; which mean when I(the client who joined), joines the channel, get all the players currently in there and put it in a list.
Apparently, every time i call this when a players joins, it sets the list on everyone connected insteed on only himself, which is a wierd behaviur. Ive done debug.logs in there, but when a player joins so doesn't it write anything.

6
TNet 3 Support / Re: Can't get RFC working
« on: November 09, 2013, 05:57:22 PM »
I just solved similiar problem myself, if the "gameObject" is in the scene from the begining(not instantiated by tnManager) so should you preset and ID for the tnObject, example 10

7
TNet 3 Support / Re: Trying to retriew channels, but crashes sometimes
« on: November 09, 2013, 11:17:06 AM »
Thanks alot, worked like a charm! :),
Somehow this code doesn't work
  1. Debug.Log(TNManager.playerID);
  2. tno.Send(10,Target.All, TNManager.playerID);
  3.  
  4.  
It does log the playerID, but it doesn't seem to send the message through the net
  1. [RFC(10)]
  2. public void sendInformationToChannel(int playerID){
  3.         Debug.Log("ading player!");
  4.         listOfPlayerInLobby.Add(TNManager.GetPlayer(playerID));
  5. }
  6.  
But it dosn't log the "adding player" part doens't log... It's the same object with a TNobject script attached to it, and there's no other RFC function in that script




Edit: I also tried to make a new script here that would kick all users from the current channel:
  1. tno.Send(11,Target.All);
  2.  
  3. [RFC(11)]
  4.         public void kickPlayer(){
  5.                 TNManager.LeaveChannel();
  6.         }
  7.  

And that code doesn't work aswell... SOmething must be wrong here, no errors att all... It just wont work ^^

apparently i got this working by setting the "menu" objects id to something else than 0, why is that?

8
TNet 3 Support / Re: Trying to retriew channels, but crashes sometimes
« on: November 09, 2013, 09:12:45 AM »
Thanks you so much Aren! It works perfectly fine now, just one last question: Where do i put the "data" for the channel, can it be "set" somewhere?

And i also found the main reason for the net crash.. It wasn't on "Run in background ^^".

9
TNet 3 Support / Trying to retriew channels, but crashes sometimes
« on: November 09, 2013, 05:41:39 AM »
So what ive done is that ive looked on previusly forums and tried to make some kind off menu off it:
  1. TNManager.BeginSend(Packet.RequestChannelList);
  2. TNManager.client.packetHandlers[(byte)Packet.ResponseChannelList] = OnChannelList;
  3. TNManager.EndSend();
  4.  
This is the code i run to retriew my "list" that would say
  1. listOfCurrentlyLobby = new List<menuJoinChanelClass>();
  2.                 int count = reader.ReadInt32();
  3.                 int channelIDD = 0;
  4.                 int playerCount = 0;
  5.                 bool hasPassword = false;
  6.                 bool isPersistent = false;
  7.                 string levelName = "";
  8.                
  9.                 for(int i = 0; i<count;i++){
  10.                        
  11.                         channelIDD = reader.ReadInt32();
  12.                         playerCount = reader.ReadInt32();
  13.                         hasPassword = reader.ReadBoolean();
  14.                         isPersistent = reader.ReadBoolean();
  15.                         levelName = reader.ReadString();
  16.                         listOfCurrentlyLobby.Add(new menuJoinChanelClass(channelIDD,playerCount,hasPassword,isPersistent,levelName));
  17.                 }
  18.  

And that's pretty much all code ive written to retriew a list for the client, sometimes it pretty much works, the client retriews a channel with id's and such, but mostly both keeps getting dced and i don't onestly know why, it ain't coming up and errorss in unity, But in tnServeri keep getting: "Timed out". Any help would be appriciated, don't really know what ive done wrong! :)

10
TNet 3 Support / Re: Best techniques for my game and TNet questions
« on: October 24, 2013, 06:28:16 PM »
My tips for you is looking around in the forum.
One post that helped me alot was " http://www.tasharen.com/forum/index.php?topic=5882.0 " You should deffently check it out.

11
TNet 3 Support / Re: Best techniques for my game and TNet questions
« on: October 24, 2013, 05:53:42 AM »
If i was you, sou would i definitely learn Tnet on your local PC before you start to struggle with Amazon thingy. just a tip..

12
TNet 3 Support / Re: How i can attach player's name on a 3D text ?
« on: October 16, 2013, 04:35:53 PM »
You could eather use the "OnNetworkPlayerJoin (player)" and send an RFC to the player who joined to change to the current text. Or so could you only send it manually to the other players with RFC's when you change it. Example:
  1.  tno.Send(1, Target.Others, "text1", "text2");
  2.  
  3. //function
  4. [RFC(1)]
  5. public void changeText(string text1, string text2){
  6.      objectText1 = text1;
  7.      objectText2 = text2;
  8. }
  9.  

13
TNet 3 Support / Re: Animation RFC
« on: October 15, 2013, 04:56:19 PM »
1. You could as well write something similar outside the tno.IsMine "controller.Move(moveDirection * Time.deltaTime)", Then just send the RFC and sets the moveDirection on the object as wanted and let the other clients to calculate where to move. And because of the "delay" so will you all so have to set the position/rotation like 4 times a second as i mentioned earlier. Ohh yeah. Why your own character twists can be because you are sending the RFC to all. You shouldn't do that, Use the Target.Others for transmitting your position and your moveDirection. And if you want your characters movespeed do be diffrent sometimes so should you calculate the moveDirections * speed or whatever before you transmite it over the network.

2. As understand: When other players "move" the move animations only plays for the first person who joined the channel?

14
TNet 3 Support / Re: Animation RFC
« on: October 15, 2013, 12:21:49 PM »
1. You shouldent send the position of the player every frame, you should be sending the positioning 4-8 times every seconds and then send the vector the player is moving at abit more often, let's say 20-25 times. There on you should let the client who recieved the vectores for the movement making the calculation how the player should move(less data send). And then the client checks what kind of thing the other players are doing according to their movements, and if you want them to die or hit or something similiar so should you send that in a diffrent pakage(my opinion).

2. should you really set the moveStatus to idle everytime it runs through the script?
Otherwise so couldn't I see any problems with your script.

15
TNet 3 Support / Re: Animation RFC
« on: October 15, 2013, 10:45:43 AM »
Where does it say that the other players play the animation sent to them? You should write the "switch(moveStatus)" outside the tno.IsMine

Pages: [1] 2