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

Pages: [1]
1
TNet 3 Support / Best Approach
« on: April 29, 2014, 09:57:27 PM »
Hey again :)

Im just wondering, what would be the best approaching for having a sort of pre-match lobby for a server. So there would be a global list of servers, the player would choose one and connect, this would load up a match settings area (think RTS games) where teams can be setup, player colour, etc. Or where the admin can choose the map and map size, etc.

What would be the best way to approach a situation like this? Would it be best to say have a JoinChannel(1, "matchsettings") and then when the game begins do something like
JoinChannel(2, "game")? Or is there a better way to do this. Also, when everyone leaves a a channel does it clean itself up or do I have to close it manually, etc.

Or alternatively can I stay on the same Channel but change the map?

Cheers!

2
TNet 3 Support / Networking Initialization
« on: April 18, 2014, 06:03:47 AM »
Hey there, is there a way to know when all game objects have been instantiated onto the client on first join?
I have a function that needs to be run on the client but it requires that all objects already exist in the scene. I currently have it being called at Start() but this seems to call it before the objects are created due to the delay caused by packets in transit.

Cheers.

3
TNet 3 Support / Best way to send object reference?
« on: April 15, 2014, 10:46:44 PM »
Hey there, I need to send an object to my CreateEx function, but Transforms and GameObjects don't serialize, so what's the best way to send an object reference so I can look it up locally?

4
TNet 3 Support / UDP Lobby Server
« on: October 04, 2013, 09:08:56 PM »
I modified the standalone server example to just run an external UDP lobby server. However when clients start a server, their internal IP address is shown rather than their external.
I'm just using the example menu for hosting servers inside of Unity.

How can I get it to show the external IP?

5
TNet 3 Support / Networking Physics Discussion
« on: September 13, 2013, 05:27:29 AM »
Networking reliable physics is quite a hefty and challenging task to undergo. Depending on how you design your game, you could be looking at designing systems like interpolation, extrapolation and client-side prediction. Each of which have their own pro's and con's associated. A great article to read, which I found helped me a lot, is Valve's Multiplayer Networking.

https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking

However, some of the methods described in here may not be ideal for your game, it all depends on what you are trying to achieve.

I am trying to make a physics-heavy sandbox game (much like Garrysmod). Initially I thought a full authoritative approach would work best, however I quickly ran into problems with client-side prediction. As it so turns out, CLSP seems almost impossible in the current version of Unity, without sacrificing a lot of freedom, or by implementing some sort of 3rd party physics library. In terms of sacrificing freedoms, you could alternatively make your own Rigidbody class and use straight line motion formulas to predict movement and correct errors, and then use a CharacterController.Move command to get instant collison feedback. The downside of this being that all your predicted objects cannot be anything other than capsule colliders. And for the sakes and purposes of my game, I couldn't do this.

So I had to scrap the idea of CLSP and with it a fully authoritative approach. My next point of option was semi-authoritative. Where the client takes care of his own position and relays it to the server, which then relays it to the other connected clients. In order to prevent jittery movement I implemented an interpolation system which delays the players view back 100ms. Based heavily off the default networking script and this one here: http://wiki.unity3d.com/index.php?title=NetworkView_Position_Sync
However I found that players often moved around with slightly jitter movement. Not too bad, but noticeable enough to look unnatural. It seemed that the players would move at a much lower framerate. I synched packets at ~ 20 times per second, is this too much? Is this not enough?.

In my game, players also have the option to spawn in and manipulate objects, rotating, dragging them around, etc. My current implementation uses a semi-authoritative approach. The server is authoritative of all entities until a client picks one up, then the client tells the server where the object moves and interpolates between (once again slightly jittery). The downside I have yet to resolve is that once the player lets go of the object, and the server assumes control again, there is a noticeable jump as the server is not fully up to date with what the client was prior to exchanging ownership. Something I have also yet to fix.

Another thought occurred to me that perhaps I just let the individual players simulate their own physics, and let the server send out a heartbeat every once and awhile to correct errors, however I quickly found out that things went out of sync very fast and the correction of errors was far to noticeable to allow for any smooth sort of gameplay.

After weeks of networking and prototyping I'm becoming ever frustrated with approaches on how I can solve these issues.

What do you guys thinks?

EDIT: I noticed that with a lot of the examples here, that the colliders get updated to server position straight away, and the renders lag behind. Is this a better method than what I currently have? What would be the drawbacks, etc from using this over interpolating everything.

6
TNet 3 Support / Network.Time - info.timestamp
« on: September 08, 2013, 02:53:34 AM »
Under recent testing I noticed that my interpolation script was throwing back somewhat jittery movements and I've nailed it down to my interpolation time calculations.

In the default unity networking,
  1. Network.Time - info.timestamp
would bring back the time in transit. It also states that info.timestamp is relative to Network.Time. How can I achieve this in Tnet?

Thanks.

7
TNet 3 Support / RFC Call Bug
« on: July 27, 2013, 08:08:40 AM »
I've noticed that putting a script that calls an RFC, and also having the same script on either the parent or any other children. Will cause RFC callbacks on every script in every child/parent to be called in the whole gameobject, rather than just the one script that calls it.

I have a custom interpolator script that exists on both the parent gameobject and it's child.
If the child calls it's RFC, then the parent's RFC also gets called.

8
TNet 3 Support / Specify Targets
« on: July 25, 2013, 01:04:19 AM »
Hello,

How may I specify which players will recieve my packet?
Right now I'm sending UDP packets from the authoritative client with:

  1. tno.SendQuickly(1, Target.Others, data)

But now I need to make it so the owner of the object doesn't get the data as well as the authoritative client not getting the data.

9
TNet 3 Support / Transmitting Custom Types
« on: July 03, 2013, 07:36:14 AM »
Hey, I'm wondering if it's possible to use the tno.Send command to send custom types.
I currently have this:

  1. using UnityEngine;
  2.  
  3. // Data buffer struct for client and server.
  4. public class State : System.Object
  5. {
  6.         public float timestamp {get; set;}
  7.         public Vector3 pos {get; set;}
  8.         public Vector3 rot {get; set;}
  9.         public Vector3 velocity {get; set;}
  10.         public Vector3 angularVelocity {get; set;}
  11. }
  12.  

Now, initially I got an error in the TNUnityTools.cs, and it was here that I found the list of types. I added my case in the ReadObject function and WriteObject function.
This seemed to resolve all issues there, but now I'm getting this exception from TNObject.cs:

  1. Exception has been thrown by the target of an invocation.
  2. RigidbodyHandler.HandleSync (State)
  3. UnityEngine.Debug:LogError(Object)
  4.  


10
TNet 3 Support / Network.Time
« on: July 03, 2013, 03:51:11 AM »
Hey everyone.

Does Tnet have a synchronized time value for all clients?
(Like Network.Time in Unity Networking)

11
NGUI 3 Support / Scaling entire Window
« on: July 02, 2013, 10:34:10 AM »
Hey.
Firstly I'd like to say how great NGUI is, it's an incredibly useful tool and definitely worth the money.
I'm pretty new to NGUI and while I know some aspects, I'm no guru in it.. and I have seem to ran into a dilemma.

I'm creating an in-game inventory-type menu (seen below).


This is the reference that I built in photoshop. So I know where to place the individual controls, etc. Ultimately this should be the final product inside of unity.
Now, I want the entire window itself with all the controls to scale accordingly to the screen resolution. I tried putting a UIStretch on the Panel object, but when I put objects into the panel they scaled into a ridiculously huge amount and went completely off screen.

How can I approach this so that the entire window is scalable to the current screen resolution?
Do I need to put an anchor and a UIStrech on each individual control? Or is there an easier way?

Any help is greatly appreciated :)

Pages: [1]