SubnauticaNitrox / Nitrox

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

Wine Support for Gaming #2146

Open bcw222 opened 3 weeks ago

bcw222 commented 3 weeks ago

Describe the issue

Description

Since Nitrox is based on .NET 4.7.2, it's not easy to port The Launcher to Linux or macOS (maybe by mono? but it'll cause more issue about multi player modification I think), but gaming on these platforms with Wine and Windows version Subnautica seems OK. With Wine I've managed to run Windows version Subnautica on macOS. However, I met problem starting the Launcher. With dotnet472 installed by winetrick, the Launcher raises errors and is unable to start (showing a window of blank). Can anyone figure a workaround about this?

I know running Server is already OK (haven't tried) but I want gaming

Steps to reproduce

  1. Install Steam and Subnautica with Wine (or its wrapper)
  2. Install .NET Framework with winetrick dotnet472
  3. Start Nitrox Launcher

Expected behaviour

Nitrox Launcher works

SavageJayGatsby commented 3 weeks ago

MacOS and Linux is not supported at this time. Feel free to come back and attempt later when we do support it.

NinjaPedroX commented 3 weeks ago

See https://github.com/SubnauticaNitrox/Nitrox/pull/1848

bcw222 commented 3 weeks ago

So, will you add support for macOS (I see the branch is named linux but .NET 7 is cross-platform)? Are there any instruction to build Measurity:linux currently (through I know it's unstable now)?

See #1848

Measurity commented 3 weeks ago

@bcw222 The team wants to support macOS, but we don't have any developers/testers for macOS at the moment.

If you want to build the linux branch you can run this command in the "Nitrox" folder after you run git clone or download from here:

git clean -xdf && dotnet restore && dotnet run --framework net8.0 --project Nitrox.BuildTool && dotnet build -c Release Nitrox.Launcher

Then run Nitrox.Launcher like so:

dotnet Nitrox.Launcher/bin/Release/Nitrox.Launcher.dll
bcw222 commented 2 weeks ago

Well, I have no linux platform so I tried to build it on Windows. But it returns:

Game version is 68598, which is not supported by Nitrox.
Please update your game to the latest version.

This version is actually 71288 and works well with old Launcher. What's the problem?

If you want to build the linux branch you can run this command in the "Nitrox" folder after you run git clone or download from here:

git clean -xdf && dotnet restore && dotnet run --framework net8.0 --project Nitrox.BuildTool && dotnet build -c Release Nitrox.Launcher
Measurity commented 2 weeks ago

Thanks for checking.

I can't reproduce the error on my side. If you have multiple Subnautica installations on your PC that could cause confusion. I've added the path to the version file to that message.

Can you check if the correct version file is used by Nitrox.Launcher?

bcw222 commented 2 weeks ago

It seems like the mistake was mine: I copied the legacy version 68598 (required by the old launcher) and passed it through SUBNAUTICA_INSTALLATION_PATH. However, when I checked the version by directly running Subnautica.exe, it called the Steam installation and returned version 71288.

Now I can build it with the correct version. But it crashes every time I attempt to launch the game or server. Is the linux branch only supports linux currently and expected?

Measurity commented 2 weeks ago

No, not yet. I still need to do a test run for Linux and OSX. It seems supporting them is a bit more involved as Subnautica has different file locations on each platform. I plan to go through that next week.

kylianpl commented 2 weeks ago
[18:42:42.099] [INF] Launching Subnautica in singleplayer mode.
[18:42:42.199] [ERR] Error while starting game in singleplayer mode:
NitroxModel.Platforms.Store.Exceptions.PlatformException: Steam: Steam is not running and could not be found.
   at NitroxModel.Platforms.Store.Steam.StartGameAsync(String pathToGameExe, Int32 steamAppId, String launchArguments) in NitroxModel/Platforms/Store/Steam.cs:line 124
   at Nitrox.Launcher.ViewModels.LaunchGameViewModel.StartSubnauticaAsync() in Nitrox.Launcher/ViewModels/LaunchGameViewModel.cs:line 175
   at Nitrox.Launcher.ViewModels.LaunchGameViewModel.StartSingleplayerAsync() in Nitrox.Launcher/ViewModels/LaunchGameViewModel.cs:line 77
[18:53:53.684] [INF] Launching Subnautica in multiplayer mode.
[18:53:53.729] [ERR] Error while starting game in multiplayer mode:
System.UriFormatException: Invalid URI: The Authority/Host could not be parsed.
   at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
   at System.Uri..ctor(String uriString)
   at NitroxModel.Helper.NitroxUser.get_CurrentExecutablePath() in NitroxModel/Helper/NitroxUser.cs:line 164
   at Nitrox.Launcher.ViewModels.LaunchGameViewModel.<StartMultiplayerAsync>b__12_0() in Nitrox.Launcher/ViewModels/LaunchGameViewModel.cs:line 118
   at Nitrox.Launcher.ViewModels.LaunchGameViewModel.StartMultiplayerAsync() in Nitrox.Launcher/ViewModels/LaunchGameViewModel.cs:line 92

(after starting steam)

[18:53:56.369] [INF] Launching Subnautica in singleplayer mode.
[18:53:56.425] [ERR] Error while starting game in singleplayer mode:
System.ComponentModel.Win32Exception (8): An error occurred trying to start process '/mnt/Jeux/games/steam/steamapps/common/Subnautica/Subnautica.exe' with working directory '/mnt/Jeux/games/steam/steamapps/common/Subnautica'. Exec format error
   at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at NitroxModel.Platforms.Store.Steam.StartGameAsync(String pathToGameExe, Int32 steamAppId, String launchArguments) in NitroxModel/Platforms/Store/Steam.cs:line 154
   at Nitrox.Launcher.ViewModels.LaunchGameViewModel.StartSubnauticaAsync() in Nitrox.Launcher/ViewModels/LaunchGameViewModel.cs:line 175
   at Nitrox.Launcher.ViewModels.LaunchGameViewModel.StartSingleplayerAsync() in Nitrox.Launcher/ViewModels/LaunchGameViewModel.cs:line 77

Is there anything i missed that makes me have errors ? Running arch linux with the steam flatpak. I don't have wine installed because i only use proton. The launcher was started with dotnet 8.0.106 from the arch repos

oliver408i commented 2 weeks ago
[18:42:42.099] [INF] Launching Subnautica in singleplayer mode.
[18:42:42.199] [ERR] Error while starting game in singleplayer mode:
NitroxModel.Platforms.Store.Exceptions.PlatformException: Steam: Steam is not running and could not be found.
   at NitroxModel.Platforms.Store.Steam.StartGameAsync(String pathToGameExe, Int32 steamAppId, String launchArguments) in NitroxModel/Platforms/Store/Steam.cs:line 124
   at Nitrox.Launcher.ViewModels.LaunchGameViewModel.StartSubnauticaAsync() in Nitrox.Launcher/ViewModels/LaunchGameViewModel.cs:line 175
   at Nitrox.Launcher.ViewModels.LaunchGameViewModel.StartSingleplayerAsync() in Nitrox.Launcher/ViewModels/LaunchGameViewModel.cs:line 77
[18:53:53.684] [INF] Launching Subnautica in multiplayer mode.
[18:53:53.729] [ERR] Error while starting game in multiplayer mode:
System.UriFormatException: Invalid URI: The Authority/Host could not be parsed.
   at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
   at System.Uri..ctor(String uriString)
   at NitroxModel.Helper.NitroxUser.get_CurrentExecutablePath() in NitroxModel/Helper/NitroxUser.cs:line 164
   at Nitrox.Launcher.ViewModels.LaunchGameViewModel.<StartMultiplayerAsync>b__12_0() in Nitrox.Launcher/ViewModels/LaunchGameViewModel.cs:line 118
   at Nitrox.Launcher.ViewModels.LaunchGameViewModel.StartMultiplayerAsync() in Nitrox.Launcher/ViewModels/LaunchGameViewModel.cs:line 92

(after starting steam)

[18:53:56.369] [INF] Launching Subnautica in singleplayer mode.
[18:53:56.425] [ERR] Error while starting game in singleplayer mode:
System.ComponentModel.Win32Exception (8): An error occurred trying to start process '/mnt/Jeux/games/steam/steamapps/common/Subnautica/Subnautica.exe' with working directory '/mnt/Jeux/games/steam/steamapps/common/Subnautica'. Exec format error
   at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at NitroxModel.Platforms.Store.Steam.StartGameAsync(String pathToGameExe, Int32 steamAppId, String launchArguments) in NitroxModel/Platforms/Store/Steam.cs:line 154
   at Nitrox.Launcher.ViewModels.LaunchGameViewModel.StartSubnauticaAsync() in Nitrox.Launcher/ViewModels/LaunchGameViewModel.cs:line 175
   at Nitrox.Launcher.ViewModels.LaunchGameViewModel.StartSingleplayerAsync() in Nitrox.Launcher/ViewModels/LaunchGameViewModel.cs:line 77

Is there anything i missed that makes me have errors ? Running arch linux with the steam flatpak. I don't have wine installed because i only use proton. The launcher was started with dotnet 8.0.106 from the arch repos

Subnautica.exe doesn't seem to exist (obviously). I think custom file pathing is required for linux (and Macos). I was helping Meas do some testing on macos yesterday and there's a ton of paths that need changing. Perhaps drop the file tree of subnautica here and the devs can do some changes for linux.

kylianpl commented 2 weeks ago

tree.txt this is the very long tree tree.txt and this is a "trimmed" tree without all the bundles

I can help testing for linux if you need, and there is a Subnautica.exe (the windows version) because it wasn't compiled natively on linux, so steam uses proton (which is wine with modifications) to "adapt" the windows api calls to linux, which mean it can't run directly, it needs be be run with proton, and proton is ran by the linux version of steam (it can also be run without steam, but is more annoying to run).

bcw222 commented 2 weeks ago

The problem I met was building on Windows successfully and starting on windows but crashed when launching the game. The issue's original purpose is to run the launcher in Wine as well so I attempt to do so with launcher built on Windows. It however even does'nt show any windows.

No, not yet. I still need to do a test run for Linux and OSX. It seems supporting them is a bit more involved as Subnautica has different file locations on each platform. I plan to go through that next week.