I the meantime you could launch the executable on your computer and run some tests just connecting to localhost !Yup. Or just hit the "host" button from the example menu. It's really easy to get started. Putting your game server on a cloud is generally the last step :)
What I want to know most is how does it compare to the main existing networking solutions? E.g. Photon, uLink and so.Just different packages. TNet focuses on simplicity of use and elegance of code. It aims to accomplish more with far less code, which generally makes it much easier to work with. I don't want to make anyone jobless... all packages have their use to the right person. :)
You know, those are Fxxx expensive, and yours is so cheap compared to them.
I always hate Photon, uLink this kind of stuff, they are even more expensive than Unity itself! WTF. I really hope you can finish them off and make them jobless.
2. ...set the object's logic in its Awake() script. This is when you should determine who the object belongs to. There is no need for an OnCreate() function. And Awake() gets called right after Instantiate.Ok, yeah. I didn't see the objectOwnerID property (EDIT: or isThisMyObject :) ) so didn't understand your usage of mObjectOwner.
3. You can still append to them afterwards with +=, can't you? This happens in Awake(), meaning as soon as TNManager is created -- so you wouldn't be setting anything before that.Yeah, but my point was more that there's no reason to not use += in TNManager to remove the current limitation of not being able add callbacks in earlier Awake() methods. Awake is generally where I prefer to assign callbacks.
Regarding AutoSync: there is no need to sync anything unless you're actually in a channel playing multi-player, in which case you will get the OnNetworkJoinChannel callback.No, I'm talking about AutoSync's being created at runtime. So the host instantiates one, it's default mCanSync value is false and OnNetworkJoinChannel is not called because it has already been joined. For this instance the AutoSync should be checking whether or not it's already in a channel in its init so it can set mCanSync to true.
I'll change it to +=, but any reason you don't want to just rely on automatic OnNetwork* series of functions?
Well, one thing I don't like doing is changes for the sake of changes. :PSure. It was just a suggestion so it's up to you whether or not you incorporate it into the next version. I don't see an issue with simple changes that have upsides and no down sides though.
TNTcpPlayer, line 60. There is always a host. You can't join a channel without getting that notification.Yeah, but there is still the issue of TNManager.isHosting returning false still occurs in that instance. Just checked again to see why and it's because GameClient.isHosting checks if players.size > 0 and the host is not added to that list so it is 0 until someone else joins. Is there a reason for that condition? I would think isHosting should return true when the player is the host and no clients are connected.
I suggest you use the package, and post if you actually run into issues. Pre-emptive posting won't be helpful much. I am actually making a game with TNet powering its networking right now, and so far it's working flawlessly.Sorry, I don't intend to harass you with these posts, but if you'd bothered to look into it fully you would have seen there was an issue for which I've pointed out what seems to be the cause in my above post.
Nah, please accept my apologies actually. I totally forgot that I fixed something related to that. I should have pushed an update out then and there instead of waiting for the weekend. :)
Well then you should definitely go to IGF in March. ;)
In a script attached to the prefab you're instantiating, you can check in its Awake() function whether you're the one who created this object by checking TNManager.isThisMyObject.
Ah, good point about AutoSync. I've fixed it like so:I'll change it to +=, but any reason you don't want to just rely on automatic OnNetwork* series of functions?
// Only start the coroutine if we wanted to run periodic updates if (updatesPerSecond > 0 && TNManager.isConnected) { // If we're already in a channel, we can now sync this object if (TNManager.isInChannel) mCanSync = true; StartCoroutine(PeriodicSync()); } else enabled = false;
You need to check the "Application runs in background" checkbox.
Unity automatically puts the app to sleep when it loses focus.
Those position updates are sent via UDP, not TCP. Sounds like your UDP packets are getting lost.
NullReferenceException: Object reference not set to an instance of an object
TNet.UdpProtocol.Broadcast (TNet.Buffer buffer, Int32 port) (at Assets/TNet/Common/TNUdpProtocol.cs:199)
TNet.GameClient.EndSend (Int32 port) (at Assets/TNet/Client/TNGameClient.cs:348)
TNManager.EndSend (Int32 port) (at Assets/TNet/Client/TNManager.cs:484)
TNDiscoveryClient.RequestUpdate () (at Assets/TNet/Client/TNDiscoveryClient.cs:105)
TNDiscoveryClient+<PeriodicRequest>c__Iterator2.MoveNext () (at Assets/TNet/Client/TNDiscoveryClient.cs:89)
Exception has been thrown by the target of an invocation.
GameManager.RequestFinishDeployment ()
UnityEngine.Debug:LogError
(Object)
TNObject:Execute(Byte, Object[]) (at
Assets/TNet/Client/TNObject.cs:250)
TNObject:FindAndExecute(UInt32,
Byte, Object[]) (at Assets/TNet/Client/TNObject.cs:320)
TNObject:SendRFC(UInt32, Byte, String, Target, Boolean, Object[])
(at Assets/TNet/Client/TNObject.cs:499)
TNObject:Send(Byte, Target,
Object[]) (at Assets/TNet/Client/TNObject.cs:402)
GameManager:DrawDeploymentButton() (at
Assets/Paul_assets/scripts/Game/GameManager.cs:245)
GameManager:OnGUI() (at
Assets/Paul_assets/scripts/Game/GameManager.cs:173)