SubnauticaNitrox / Nitrox

An open-source, multiplayer modification for the game Subnautica.
GNU General Public License v3.0
1.74k stars 1.05k forks source link

[Launcher] Add support for profiles for Nitrox save data and other files #958

Closed Measurity closed 2 years ago

Measurity commented 4 years ago

Right now files are saved left and right. It would be nice to have them in one "nitrox data" folder.

Both client and server should store files into same directory if both are on the same PC/machine. Location of the profiles is likely best stored in App Data but if not, let me know.

The API is best implemented in the "NitroxModel" project so that it can be used anywhere.

Folder structure should be like

"Nitrox data"

Example API (doesn't need to work like this)

var profile = DataProfile.CreateOrLoad("default"); // Ensures folder structure
var serverList = profile.GetServers(); // servers stored in "servers" file or empty list
...
profile.SetServers(servers); // Store servers into its file
profile.GetBaseData(); // Returns an object that's deserialized from base data.
profile.SetBaseData(baseData); // Store base data object to file.

// Delete whole profile folder (could be useful for removing old Nitrox profiles)
profile.Delete();
killzoms commented 4 years ago

Doesnt this run into the issue of there being specific settings for the server that are pointless on the client? wouldnt it be best to separate the client and server data? Yes I can see where keeping them together is nice however it can cause certain issues to crop up in the long run especially when someone wants to put the server files on a separate drive from their client, Say in the event of someone having a specific drive they want their server to be on(Say for speed purposes) but they don't keep their games/programs on that drive.

Measurity commented 4 years ago

We can use the same structure for both client and server with just some files/folders missing. This way we can have the same code for both client and server.

Jannify commented 4 years ago

Will look into that after #1075

Mathew3000 commented 4 years ago

I'll take a look at it. Seems doable :)