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

Pages: 1 [2] 3 4 ... 19
TNet 3 Support / Re: SetPlayerSave callback
« on: January 02, 2018, 08:12:32 AM »
OnSetPlayerData *is* the callback :P
If you're only overriding TNEventReceiver you don't need to call the base implementation (it's empty), but other than that everything looks good.

There might be a small bug with TNet regarding this callback though: it's called twice if using TNManager.SetPlayerData while connected to a server. Once during the call and another when the server sends its response. When using SetPlayerSave it's only called when the server sends its response.

Additionally, the callback is used for both SetPlayerData and SetPlayerSave which requires some state management on the user's part to properly handle it, but I wouldn't consider that a bug.

TNet 3 Support / Re: logic GameManager through network
« on: December 15, 2017, 08:00:26 AM »
I'd have GameManager inherit TNEventReceiver then override the OnJoinChannel function. In that, I'd check if we're at the lobby portion of the game and instantiate (via TNManager.Instantiate) a LobbyManager if it doesn't exist. This LobbyManager has the TNObject component with id of 0 and handles all lobby-related RFCs while in the lobby portion of the game.

TNet 3 Support / Re: logic GameManager through network
« on: December 14, 2017, 06:22:40 AM »
I'm having a hard time understanding you. Make whatever networked object you're trying to use a prefab with a TNObject (id of 0) and use TNManager.Instantiate when you join a channel. Everything will work then. I don't know what use case you're trying to make work, so that's the best, most generic advice I can give.

Also, you could refer to the tutorials and the example scenes packaged with the TNet asset to see how certain practical tasks are accomplished.

TNet 3 Support / Re: logic GameManager through network
« on: December 13, 2017, 03:53:16 AM »
You can't network objects without being connected to a network :P you have to join the server and a channel first. After that you can instantiate your networked objects and send RFCs with them. Static TNObject's aren't recommended anymore because of the multi-channel stuff.

To clarify: you can't (shouldn't?) network objects post-connection. They shouldn't exist until you've joined a server and channel.
This thread may be relevant:

TNet 3 Support / Re: logic GameManager through network
« on: December 13, 2017, 03:09:08 AM »
Use TNManager.LoadLevel, it'll load the level for all network clients.
TNManager.LoadScene isn't networked.

edit: TNManager.LoadLevel needs to be called by the host

NGUI 3 Support / Re: [UPDATE] UIDragObject.OnDrag question
« on: December 07, 2017, 03:52:09 AM »
I don't have NGUI but wouldn't you want to be checking the delta arg instead of the transform's position?

TNet 3 Support / Re: Streaming level with multiple channels
« on: December 07, 2017, 03:42:04 AM »
Did you find a solution?

TNet 3 Support / Re: Streaming level with multiple channels
« on: December 03, 2017, 06:07:44 AM »
No the server batches them with the JoinChannel / LoadLevel process.

Do you have TNObjects in the scene you're loading? I think this is why your first case fails (joining channel after loading the level).
If that's the case then there might be some useful info here:

Otherwise, I'd try redesigning the level loading to use TNet's JoinChannel. Oh, TNet doesn't load levels additively by default, so you'll have to override TNManager.onLoadLevel or TNManager.LoadSceneAsync. Could maybe point one of those to your level loader, too, so it all ties together nicely.

TNet 3 Support / Re: Streaming level with multiple channels
« on: December 02, 2017, 08:52:28 PM »
Wouldn't TNManager.JoinChannel(levelToBeLoaded.ChannelID, "Path/To/Level") work?

TNet 3 Support / Re: data that all players can access?
« on: November 23, 2017, 10:02:20 PM »
Yeah, one of the updates caused the admin.txt file to not be created automatically anymore. The reason is that the mAdmin list remains empty and Tools.SaveList deletes the file if list is empty.

You should be able to create it manually in ServerConfig/admin.txt.
Each line is a "password". Blank lines break processing.

TNet 3 Support / Re: Does tnet read .txt files directly from server?
« on: November 22, 2017, 10:10:53 PM »
Don't entirely understand your questions, but each call to TNManager.LoadFile will result in the entire file being sent from the server to the client.
However, on the server, the file is cached so not every call results in file I/O. Calls to SaveFile will update the cache, too, as expected. Client does not cache files.

If you want delta updates you could implement all this behaviour with RFCs instead.

TNet 3 Support / Re: Objects Instantiate with No Owner
« on: November 07, 2017, 11:54:52 PM »
I don't see anything immediately wrong. All my previous suggestions are still valid. Good luck and keep us updated :D

And to expand on ArenMook's advice: TNManager.JoinChannel returns immediately, but that doesn't mean you've joined the channel yet. The TNManager.onJoinChannel callback will fire when the join channel process is complete (whether it's a success or failure). So you may want to move some of your initialization code there (including spawning objects - as you need to be in a channel for TNManager.Instantiate to work).

TNet 3 Support / Re: TNet 3 and Unity 2017
« on: November 07, 2017, 11:47:40 PM »
I make tiny little projects when helping people with issues on here. None of them fully utilize TNet, but all of them are on 2017.1.1 and I haven't ran into any problems yet.

To ArenMook: Unity 2017 comes with a runtime upgrade. Apparently up to .NET 4.6 & C#6.0. The old runtime is still default, though.

TNet 3 Support / Re: Modifying GameServer for an authoritative server
« on: November 07, 2017, 11:36:06 PM »
How will the server set up the world? Will you be running a headless Unity client? Or is your game simple enough that you can perform all the logic without relying on Unity? I guess just answering those questions will give you a good starting point.

The GameServer has an onCustomPacket handler.

TNet 3 Support / Re: Objects Instantiate with No Owner
« on: November 06, 2017, 06:41:53 PM »
I'm not able to reproduce your problem. Do you have any functions that override the TNEventReceiver functions? Maybe one of the overrides is causing the discrepancy. TNEventReceiver definitely shouldn't effect anything in this case.

Is one of the clients hitting an exception in GeneratePlayerCore? You're calling some external functions, so maybe the error is occurring there? Still doesn't explain why TNEventReceiver makes it work (unless there is an override).

Pages: 1 [2] 3 4 ... 19