SS2 - Trying to improve the multiplayer

1 Guest is here.
Page: 1/7▶▶
664a45d76aa78
figgisQuote
Hello.

For the past few days I've been trying to make the multiplayer component in SS2 somewhat more palatable.
Unfortunately the bulk of the netcode would be difficult to improve upon without having the source code, but it appears that there are still a few things that can be done, such as fixing 4 (or more) players support. I'm going to list my findings and mods here in case someone finds them useful.
All this applies to NewDark v2.48.
Apologies if it's in the wrong forum section.

Problem 1: The player cap.

Despite the player cap technically being 4, it seems impossible to get a game going with more than 3: whenever the 4th joins, someone else gets kicked out of the lobby. While it defaults to 4, nothing seems to actually be hard-wired to it being 4, so it can be easily changed.

The value can be found at offset 0x2E121 into ss2.exe and changed from 04 to a larger number, such as 0A. The same limit value is at offset 0x2F440 in Thief2MP.exe.

After changing it to 5 I've discovered that now 4 people can get into the lobby and the 5th player joining triggers the same bug described above. I suppose the "solution" is to just set it to N+1, where N is the desired player cap. The same seems to apply to Thief 2.

While I could now get more than 4 people into the lobby ( https://i.imgur.com/UXcuLOh.png ), players 5 and up wouldn't properly spawn in game. This seems to be because the game only has 4 network avatars defined in the object hierarchy ("Default Avatar 1-4"), so unless you add more or force everyone to use net_simple_avatars 1, the game will try to default to "Default Avatar 5" for player 5 and fail. This does not happen in Thief 2 because it defaults to "Garrett" for everyone. With net_simple_avatars I could properly get into a netgame with 5 instances of the game running locally ( https://i.imgur.com/M07DEDS.png ).

Problem 2: Actually getting into the game.

In my experience it is a rare occasion that everyone gets through the character creation sequence and the first "Synchronizing" screen without crashing, freezing or desyncing in the process. This might have to do with the game effectively "pausing" the netcode until medsci1.mis is reached: while you're in earth.mis and station.mis, (most) messages are not sent and (mostly) any messages received are stored for later and their processing is delayed until the load into medsci1. Or it might be that message send timeouts are expiring for messages that arrive while you're in a loading screen.

Either way, it seemed to me that one possible way to make this part more stable is decreasing the amount of loading screens and waiting time involved. To this end I made a small mod that gives you an option to pick your character creation branches using a simple dialog menu at the start of earth.mis ( https://i.imgur.com/m8VQ2RB.png ), which then loads you directly into medsci1.mis. I don't have any statistics to prove that it increases the connection success rate, but it certainly at least helps cut down the waiting time and also works in SP. It is attached to this post.

As for message timeouts, there are two: hard-coded 5 seconds for blocking messages, 60 seconds by default for non-blocking. Interestingly, Thief 2 v1.27 uses 0 (infinite) for both of them. It seemed to me like a good idea to at least increase them.
The former can be increased by changing the 5000 at offset 0x2C7B4 in ss2.exe, the latter by either changing the default value of 60000 at 0x2CAE3 or by adding e.g. net_player_timeout 600000 into your config file. I changed them to 60000 and 600000 respectively.

General gameplay improvements.

As has been mentioned in this thread, multiplayer lacks much difficulty.

One aspect of this is the respawning system. There's virtually no punishment for dying. To address this I made a script that modifies the respawn logic:
  • you can only respawn automatically if the QBRM is active on the map, while you're dead the game checks for that every second (adjustable);
  • reconstructing costs 15 nanites (adjustable): if you don't have them, you can't respawn even when it's active;
  • if another player frobs an already-activated QBRM, all dead players will respawn at it;
  • if the map has no QBRM, you respawn as normal (can be turned off).

Upon moving into a different level all dead players still respawn as normal. Not sure yet if that's possible to override via script.
Said script is part of the ss2_netfixes mod attached to this post.

Another good point made below is that there should be some sort of difficulty scaling depending on player count. I've yet to investigate how this could be implemented.

Problems unresolved.

After doing these things I was able to get a 4-player game with real players going over the Internet using ZeroTier and it was fairly stable, at least as far as SS2 multiplayer goes. However, there are still many problems left to fix:
  • Additional players can't seem join on an existing save, even if they get a copy of someone else's. Perhaps this could be fixed by editing a new avatar and player object into one of the players' existing saves? Could this be done automatically by hooking into the connection procedure and transmitting the save file first?
  • When loading an existing save or level transitioning, existing player states can swap between players or duplicate. They seem to be assigned by player number, so maybe this depends on the order of players in the lobby?
  • Sometimes a remote player can get stuck on geometry and then warp to the proper position after a while. Could this be fixed completely, or at least could the time before warp be reduced?
  • Minimizing the game seems to freeze parts of the networking system. For example, saving will not go through until everyone alt-tabbed out tabs back into the game. Maybe there's already a setting to disable that? Otherwise could probably be patched out by stubbing out some event handlers in the game's WndProc.
  • General instability and crashes. This can be partially worked around by mods (e.g. disabling the Engineering cutscene seems to help).
  • Chat is disabled in NewDark v2.48 for some reason. Could probably be worked around with a mod, but is a fairly low-priority issue.
  • Would be nice to have an option to make the pause menu run on top of the game without pausing it. Not sure if that's possible to do.

As I've said before, my knowledge of SS2 modding and Dark Engine in general is still very limited, so if anyone else has ideas on how these could be approached, it would be nice to know. I will update this post if I figure out solutions to any problems listed. The saving issues are probably the most annoying in my experience and I'm going to look into that next.

Attached files:
  • ss2_quickstart_v2.zip: the quick-start menu mod.
  • ss2_netfixes_v1.zip: alternate respawn logic, additional net avatars and Engineering cutscene skip from SS2 Cutscene Skipper.
  • dark_mp_patched_v1.zip: patched ss2.exe and thief2mp.exe. You can also patch the EXEs manually by editing them with a hex editor as described above.

Thanks to Nameless Voice for NVScript, from which I shamelessly stole the proper level transition procedure, and to RoSoDude for the Alternate Start mod, from which I shamelessly stole the idea of attaching the script to a random light object in the level.
Acknowledged by: Dan
664a45d76ace5
ZylonBaneQuote
SS2:EE is probably going to completely overhaul the multiplayer code, so any attempts to fix it in Old/NewDark would just be wasted effort.
664a45d76afc8
figgisQuote

Quote by ZylonBane:
SS2:EE is probably going to completely overhaul the multiplayer code, so any attempts to fix it in Old/NewDark would just be wasted effort.
I would certainly hope so, but I assume its release is still quite a ways off.
664a45d76b1c9
voodoo47Quote
it's fairly safe to say SS2EE will be out later this year. so yeah, any attempts to improve the MP in Dark games is indeed a wasted effort, especially if we are talking about band aids like hexediting and script-circumventing issues.

also, any MP session with 3 or more players is not worth anything without making the game adjust spawns and AI strength accordingly first - with so many players, there is no challenge left, everything will just succumb to a barrage of wrench hits.

so to make 3+ player MP into something someone would actually want to play and enjoy, you would also have to pretty much overhaul the entire game as well.

do you have a decade and absolutely no life?


that said, we certainly don't want to discourage you from SS2 modding, but directing your efforts at something else would probably be a better choice.
664a45d76b8d5
figgisQuote

Quote by voodoo47:
it's fairly safe to say SS2EE will be out later this year. so yeah, any attempts to improve the MP in Dark games is indeed a wasted effort, especially if we are talking about band aids like hexediting and script-circumventing issues.
I don't personally consider it a waste of my time since I find stuff like this interesting to do. It's understandable that someone else would, though.
My original objective was to fit all my friends that wanted to play into one game session and I figured that someone else might have had the same thought and would find this interesting. Then it got me thinking about how much exactly could be fixed up without completely rewriting the whole thing.


Quote by voodoo47:
so to make 3+ player MP into something someone would actually want to play and enjoy, you would also have to pretty much overhaul the entire game as well.
This is probably a valid point for a lot of people, however I don't think it would have to be that drastic, at least for me. I find it pretty fun even with default difficulty, not to mention there are at least a couple of mods out there that attempt to increase the difficulty of MP, so it could be possible to build on top of them.
Page: 1/7▶▶
Reply

Legal stuff

Privacy Policy & Terms of Service Contact