olavim / RoundsWithFriends

ROUNDS multiplayer mod
GNU General Public License v3.0
34 stars 15 forks source link

> 4 player mp? #7

Closed skourismanolis closed 11 months ago

skourismanolis commented 3 years ago

Is there a chance this could work with more than 4 players? Would changing the RoundsWithFriends.cs max players const work?

I'm asking and opening an issue instead of just trying it myself because the first time setup for compiling this project is quite cumbersome, especially if you don't have visual studio and a slow internet connection.

Also would anybody be interested in playing the game with more than 4 players? It could get hectic but it's part of the fun I think.

thanks!

olavim commented 3 years ago

I'm asking and opening an issue instead of just trying it myself because the first time setup for compiling this project is quite cumbersome, especially if you don't have visual studio and a slow internet connection.

Really? I tried making it as easy as possible. If your ROUNDS installation is in the default location, you shouldn't have to do anything except install NuGet dependencies (dotnet restore or similar if you're not using Visual Studio). What did you find cumbersome?

Is there a chance this could work with more than 4 players?

It's possible, but 4 players was much easier to support since the game already included the building blocks for it. I will take a look at some point. Hopefully all that is missing is colors from PlayerSkinBank, but I haven't looked into it yet.

skourismanolis commented 3 years ago

Really? I tried making it as easy as possible. If your ROUNDS installation is in the default location, you shouldn't have to do anything except install NuGet dependencies (dotnet restore or similar if you're not using Visual Studio). What did you find cumbersome?

Honestly I didn't try, I don't have much experience in c# but some time ago I tried to modify a Risk of Rain 2 mod (ror2 mods also used BepinX) and it was iffy, I gave up. What do I need in order to compile this do you reckon? Except from the .NET SDKs. I'd like to avoid visual studio because it takes a lot of time to download. Doesn't it also need Unity installed?

Thanks a lot for the prompt reply!

olavim commented 3 years ago

The ROUNDS installation comes with all the required assemblies (Unity, Photon, etc.), apart from a few extra dependencies which are either included in this repo directly, or as a NuGet dependency. So as long as you have ROUNDS and .NET SDK installed, you should be good to go.

I think all you need to do is run

> dotnet restore
> dotnet build
skourismanolis commented 3 years ago

I do have to point to the assemblies somehow right? I get a bunch of namespace errors which makes sense.

I couldn't find anything relevant in the solution file...

skourismanolis commented 3 years ago

I got it, for future reference you have to change the RoundsWithFriends\RoundsWithFriends.csproj file, to set your ROUNDS directory if you don't have it installed on C

olavim commented 3 years ago

The references are set up against the default ROUNDS installation directory, which is at C:\Program Files (x86)\Steam\steamapps\common\ROUNDS. If your installation directory is different, you need to create a RoundsWithFriends\RoundsWithFriends.csproj.user file with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <RoundsFolder>D:\Path\to\ROUNDS</RoundsFolder>
  </PropertyGroup>
</Project>

I will add this step to the README.

skourismanolis commented 3 years ago

So I found a couple of friends to test with just changing the MaxPlayers variable and ofc it crashed. Here are my findings:

NullReferenceException: Object reference not set to an instance of an object
  at Player.ReadPlayerID () [0x00028] in <6255f42a68d64e88bf33b2aeeea2930f>:0 
  at Player.Start () [0x00012] in <6255f42a68d64e88bf33b2aeeea2930f>:0 

and

Parameter name: index
  at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00029] in <d218254355ef48fc923e09da9dfd401e>:0 
  at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <d218254355ef48fc923e09da9dfd401e>:0 
  at RWF.VersusDisplay.UpdatePlayersCoroutine () [0x00152] in <ebf0b71978df42498e349048d1ba58ae>:0 
  at RWF.VersusDisplay.UpdatePlayers () [0x00008] in <ebf0b71978df42498e349048d1ba58ae>:0 
  at RWF.PrivateRoomHandler.UpdatePlayerDisplay () [0x00101] in <ebf0b71978df42498e349048d1ba58ae>:0 
  at RWF.PrivateRoomHandler.OnPlayerLeftRoom (Photon.Realtime.Player otherPlayer) [0x0000e] in <ebf0b71978df42498e349048d1ba58ae>:0 
  at Photon.Realtime.InRoomCallbacksContainer.OnPlayerLeftRoom (Photon.Realtime.Player otherPlayer) [0x0001b] in <38594b9672fa4b80ab7ded9cf60c8e3f>:0 
  at Photon.Realtime.LoadBalancingClient.OnEvent (ExitGames.Client.Photon.EventData photonEvent) [0x0026f] in <38594b9672fa4b80ab7ded9cf60c8e3f>:0 
  at ExitGames.Client.Photon.PeerBase.DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer stream) [0x002e7] in <55327f06489f4ebdb665a4707c165dbb>:0 
  at ExitGames.Client.Photon.EnetPeer.DispatchIncomingCommands () [0x0039e] in <55327f06489f4ebdb665a4707c165dbb>:0 
  at ExitGames.Client.Photon.PhotonPeer.DispatchIncomingCommands () [0x00034] in <55327f06489f4ebdb665a4707c165dbb>:0 
  at Photon.Pun.PhotonHandler.Dispatch () [0x00020] in <7d9abb1b398c48f6ba230ff85bad16f7>:0 
  at Photon.Pun.PhotonHandler.FixedUpdate () [0x0000c] in <7d9abb1b398c48f6ba230ff85bad16f7>:0 

I tried looking at the code but some of these functions are not in RWF. I assume some of them are internal game functions or related to some dependency. How would one go about looking more into this? Can we have access somehow to the game's source? Could I also connect it with the Unity editor? Do you know of any guide I can use?

Thanks a lot for your help!

pdcook commented 3 years ago

In regards to the game's source. You can decompile it with dnspy. The source is in /path/to/ROUNDS/ROUNDS_data/Managed/Assembly-CSharp.dll

Also in regards to looking more into it, if you compile in Debug mode, then you can open multiple instances of ROUNDS on your computer to simulate an online lobby, instead of getting 4+ friends to help.

LandonPatmore commented 3 years ago

@pdcook How do you have the instances join the game from the same computer? Only way is to invite through steam.

pdcook commented 3 years ago

@LandonPatmore Compile RWF in debug mode (instead of release), make sure you have the BepInEx console enabled, then open one instance through steam, go to online -> invite friend, and you should see a join.us:XXXXXX command pop up in your BepInEx console. Open a second instance of RWF by starting ROUNDS directly from the .exe. In that instance of ROUNDS, on the main menu, open the chat (with Enter) and copy/paste the join.us:XXXX command from before and hit enter.

LandonPatmore commented 3 years ago

Thanks and @pdcook would you know where the crash logs are? Friends and I are trying to find it but the crash logs are not in the BepInEx/LogOutput.log file. And idea?

LandonPatmore commented 3 years ago

@olavim Can you elaborate on what you mean by the game has the "building blocks" to easily work with 4 players? My friends are trying to modify it to work, but we don't have logs to see what the errors are or what could possibly be the root cause?

olavim commented 3 years ago

@LandonPatmore I don't know how far the rabbit hole goes, but at least some assets only include stuff for up to 4 players, for example player colors. So for stuff like that you would need to patch in logic to return correct data for higher player counts as well. So what I mean is that ROUNDS has, for example, some color assets stored in an array colors, and then the game tries to get player color with something like colors[player.playerId], which crashes if player.playerId > 3 (zero-indexed). I don't remember where exactly this logic is so forgive me for the slight vagueness.

There is technical stuff like that, but the local multiplayer lobby UI is also getting very cramped with more than 4 players. The lobby UI would need to be redesigned for >4 players. The way I made the multiplayer lobby also isn't going to like >4 players 😄 The technical stuff just needs to be fixed with anything, but the UI is going to be the real pain in the ass.

LandonPatmore commented 3 years ago

Interesting. Yah I think this rabbit hole goes deep but I am currently black boxing here. Is there a log the game spits out that I can look at and see crashes? I can only find BepInEx's logs, but not the actual game's log. Would you know where it is? @olavim

olavim commented 3 years ago

@LandonPatmore in the ROUNDS root folder, there should be an output_log.txt file.

pdcook commented 2 years ago

@LandonPatmore see PR #16.