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]
16
TNet 3 Support / Make the server host
« on: October 15, 2013, 09:09:54 AM »
Is there anyway to make the server computer host for any channel that is created?

17
TNet 3 Support / using linq with TNet
« on: October 11, 2013, 05:16:09 PM »
I came up with a problem here. i want to use a Linq allgorithm to find a specifik item in a Tnet list. But apparently Linq don't support the Tnet list.. How do i come by this?
If there is no way for coming by this: how do i make a similiar for list.find(x=>x.item == item)? or something like that

18
TNet 3 Support / TnObjects
« on: October 11, 2013, 02:57:49 AM »
Hey, i was considering creating an object named "hostManager" and preset it in the scene with a don't destory on load. The only problem is that it can't send "tno.send". Is that becouse it has the ID 0 becouse it's static or something? becouse other players aint receiving RFC from that objec when sent it.
So my question is: Do i have to spawn the object through tnmanager.Create for beeing able to use the tno.Send??

19
TNet 3 Support / Re: TNet Logic
« on: October 11, 2013, 01:40:09 AM »
I'm not exactly the admin here.
Quote
1. Do i need to have 50 "servers" running ?
No, you only need one server.
Quote
2. How do i say that player 1 plays with player 3 and player 2 plays with player 4, and so on?
You have to make channels for each one to join. Let's say player 1 is in channel 1, then player 3 would have to join channel 1 and so on, then you could be in the same scene at the same server.
TNManager.JoinChannel(); will make the channel(if not allready created)

20
TNet 3 Support / Re: Ping player & setting host
« on: October 09, 2013, 02:50:17 PM »
Havent tried this yet, but would there be something like this: like every 10 seconds the host requires the ping from all players. That would be the host sends RFC to all players in the channel, then from that RFC function it sends the players ping and which player who sent it to the host in a RFC. The host stores it in a list and then compares it. If that would work, how do i appoint leader for the host? Is it just for the host to call TNManager.SetHost(player);? and then done?

21
TNet 3 Support / Ping player & setting host
« on: October 09, 2013, 12:26:29 PM »
Hello! I was thinking a a system that when a player join so call the "OnNetworkPlayerJoin" which takes a parameter "Player". so when the player joins so will the current host check with every client currently conencted to the current channel for their Ping and if someone has a better ping so will he be the new "host".
Why i want to do that is becouse if someone with a bad ping is host for around 20 players, and the host is sending RPC and all from the AI so will the game be slower for the rest of the players.
Was checking around the unity forum and came along this: http://docs.unity3d.com/Documentation/ScriptReference/Network.GetAveragePing.html , and apparently the TNET.player and the Unitys Network player aint the same. So is their any way for checking theirs ping and or determine a new host for a channel

22
TNet 3 Support / Re: Joining channel, stay in same position
« on: October 08, 2013, 01:57:15 AM »
1. Ive set an object with the script "TNAutoCreate" in the level. which spawns the player, and when i join an empty chanel nothing happens(as wanted). But when i join a channel with a
player the script is called again, even though it's destroyed(not wanted). And i don't really know why that's happening becouse the script that instatiates the gameobject is destoroyed. That Gameobject is only "preset" in the level.

In this script i describe what happens when a player joins the network. He get's the position and the rotation from all GameObjects(players gameobjects) in that channel.
  1. [RFC(254)]
  2.         public void getPositionAndRotation(Vector3 pos, Quaternion rotation){
  3.                 rotateTo = rotation;
  4.                 transform.position = pos;
  5.         }
  6.        
  7.         void OnNetworkPlayerJoin(Player p){
  8.                 Debug.Log("Player joined channel");
  9.                 tno.Send(254,p,transform.position, transform.rotation);
  10.         }
So the only thing that goes pretty much wrong here is that he is "re instatiated" everytime he joins the channel with players.

2. And can i somehow get all the gameobjects that are instatiated through the network?

23
TNet 3 Support / Joining channel, stay in same position
« on: October 07, 2013, 05:09:37 PM »
Ive noticed some buggs when i try to make a "channal" changeing script. It's 2 clients who are in the same channel and scene. then theres a script that looks like this:
  1. public class changeChannel : MonoBehaviour {
  2.        
  3.         void OnGUI(){
  4.                 if(GUI.Button(new Rect(20,20,100,40),"1")){
  5.                         joinChannel(1);
  6.                 }
  7.                 if(GUI.Button(new Rect(20,80,100,40),"2")){
  8.                         joinChannel(2);
  9.                 }
  10.         }
  11.        
  12.         void joinChannel(int channelID){
  13.                 TNManager.JoinChannel(channelID,null);
  14.         }
  15. }
verry simple, i make the joinchannel level to null so you don't have to respawn at a new position everytime i join that channal, I wan't to make so everyone loads me in when i join the channel and the same thing goes for me, when i join the channel: load every objects in that channel. The reason why i dont wan't to load a level is becouse you should be able to walk
into zones and keep your current position while entering a new channel
What happens when i change the channel:
1. The player who presses change channel still have the old game objects "may be a reason for none level load.. I dunno".
2. THe player that pressed channel change dissapears for the rest of the players in the old channel.
3. The player that leaves the old channel and joins an empty can walk around and wont respawn(as wanted), but when the player enters the channel with players on it so will he respawn.
I'm using the script TNAutoCreate and then the player is inside it

24
TNet 3 Support / Re: Charactercontroller movement
« on: October 07, 2013, 04:10:23 AM »
Thanks alot :)! and thanks for the fast reply, but got another problem now.. Somehow the latest person who joins the game can controll both of the object meanwhile the first one can't controll anyone. I thought the "TNManager.isThisMyObject" would solve it, i'm using the "TNAutoCreate" to create the player that will say. Both objects gets the same moveDirection
  1. CharacterController controller;
  2.         public static Movement instance;
  3.         private float speed = 6.0f;
  4.         private float jumpSpeed = 8.0f;
  5.         private float Gravity = 20.0f;
  6.        
  7.        
  8.         Vector3 moveDirection = Vector3.zero;
  9.        
  10.         // Use this for initialization
  11.         void Awake(){
  12.                 controller = GetComponent<CharacterController>();
  13.                 if(TNManager.isThisMyObject){
  14.                         instance = this;
  15.                 }
  16.                
  17.         }
  18.        
  19.         void Update() {
  20.                
  21.                 if(TNManager.isThisMyObject){
  22.                         if (controller.isGrounded) {
  23.                                 // We are grounded, so recalculate
  24.                                 // move direction directly from axes
  25.                                 moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0,
  26.                                                         Input.GetAxis("Vertical"));
  27.                                 moveDirection = transform.TransformDirection(moveDirection);
  28.                                 moveDirection *= speed;
  29.                                
  30.                                 if (Input.GetButton ("Jump")) {
  31.                                         moveDirection.y = jumpSpeed;
  32.                                 }
  33.                         }
  34.                         else{
  35.                                 moveDirection.y -= Gravity * Time.deltaTime;
  36.                         }
  37.                        
  38.                         if(moveDirection != Vector3.zero){
  39.                                 tno.Send(255,Target.AllSaved,moveDirection);
  40.                         }
  41.                 }
  42.                
  43.                 // Move the controller
  44.                 if(moveDirection != Vector3.zero)
  45.                         controller.Move(moveDirection * Time.deltaTime);
  46.         }
  47.         [RFC(255)]
  48.         public void updatePlayersMoveDirection(Vector3 moveDirr){
  49.                 moveDirection = moveDirr;
  50.         }
  51.  

For anyone who got the same problem so did i just solve this problem by changing the TNManager.isThisMyObject with tno.ismine

25
TNet 3 Support / Re: Charactercontroller movement
« on: October 07, 2013, 02:37:14 AM »
Sooo.... every time the character makes a movement, send RFC to all players in that chanel where the position is?

26
TNet 3 Support / Charactercontroller movement
« on: October 06, 2013, 05:16:06 PM »
Ive been watching your vedeo tutorial for getting started, and ive decided to use the charactercontroller attach to the player object instead and write som script for that. How am i supose to link it's position trhough RFC? In the tutorial you send the destination to the gameobject the player is controlling and in that way the client that recieved the RFC can move that gameobject by itself, but if the player make alot of movements, and the "destination" can't be predicted?
Thanks in forhand :)!

Pages: 1 [2]