Hello there,
First of all, I have to say that TNet is great. It's easy enough to use, yet powerful to delve deeper.
After using it for a while though and implementing it into our game so far with success, I came by a few questions.
Our game by the way, can best be described as your typical coop survival genre (crafting, building etc). Think "The Forest".
- ChannelDataSo, I understand that ServerData is saved in server.dat and PlayerData is saved in player.dat for example, but I am don't really understand where are ChannelData saved. Shouldn't they be saved in a file like the others, or are they rather buffered RFCs ? Shouldn't there be a SetChannelSave similar to how SetPlayerSave exists for example?
What I am after here more or less, is to save the "game" state/data, that is not really tied to either of the players. Such things as the buildings we've build, the common items in our inventory chest, or the resources left on each mine deposit.
I could probably use the hosting player's data, but I thought that ChannelData would be a better (and cleaner) fit for that, or am I misunderstanding something?
- TNObject.Get/SetSimilar question to ChannelData above, are TNObject data, buffered RFCs as well? If so (which I think is true) can they somehow be saved to a file on the server?
- Arbitrary DataNode / JSON FileI see that there exist a very handy TNManager.LoadFile / TNManager.SaveFile already, so I am thinking that I could use a custom DB-like file for saving the game/world state, either in JSON or DataNode format and would probably prefer DataNode so that serialization stays the same to the rest of TNet. In both cases though (JSON/DataNode), I would like to save the file in text format so that they stay human readable and editable. As far as I understand though, using LoadFile/SaveFile is not possible for text format. Is there any other way already provided?
As you can tell, I am after an (as much as possible) data driven approach, where all saved data can be found as editable files on the server. Considering I didn't misunderstood anything about my 1st and 2nd question, using a custom DB-like file, seems to be bypassing some "data persistence" TNet features, but I think that having half data stored as Player DataNode files, while other data simply as buffered calls, will become a bit unmanageable in the long run, and I would much prefer to keep everything in one place.
--
- Bonus Qustion Common ObjectsNow this is a noob question probably, but are there any best practices to handle TNObjects that are neither static IDs, nor are they tied to any specific player. They are rather objects instantiated from one player, but where all players are able to use it the same, like once again for example, a crafted chest of common among player items.
My question mostly concerns data, as per my previous questions, but also any other idea, thing or feature that I should be aware of, is more than welcome
Once again, TNet is really great. I just need to bypass this "data persistence" issue I am facing
Any thoughts, directions or suggestions are very welcome.
Thanks!