Resource icon

[Reusable] SRB2NetPlus 2.2.4-v4: Play without control lag!

This thread contains content that may be reused, modified, or ported by anyone.

LXShadow

Member
Latest update: 2.2.4 is now supported.

MOUSE ERRORS: I'm aware there may be issues with mouse input in this build. This may affect Software mode, but OpenGL mode seems to be fine. I'll investigate a fix when I can.

SRB2NetPlus is a networking-enhancing mod for SRB2 2.2. Its key objective is to reduce or eliminate control lag. You can join regular 2.2 servers using it, and it works best on small maps in match/CTF/tag/circuit race modes. It is not guaranteed to work with all .wads and .pk3s.

SRB2NetPlus reduces control lag by predicting the future game state before the server tells it. This is great for race and ringslinger modes, although ringslinger modes have a slight caveat: other players can shoot faster than you, and your shots' accuracy will depend on the configuration you choose. They may also jump around as they change directions, because the game can't predict what the players will decide do. Check out what you can do about this in 'ways to play'. :)

When set up correctly, this mod is the definitive way to play SRB2 in online modes. Have fun!

This is an alpha proof-of-concept and doesn't tend to behave well in co-op maps. See Known Issues. However, there is something in there for everyone -- even if it's just autotimefudge. Don't host servers with this mod though, you don't need to!

Key features

  • Reduce or remove control lag!
  • Use autotimefudge to remove jitter!
  • Compatible with regular 2.2 servers!
Updates
2.2.4-v4
* 2.2.4 now supported!
* Due to more changes in the official save/load code, stability may be reduced, but my hour of testing in tag modes has worked well so give it a shot!



2.2.2-v3
* 2.2.2 now supported!
* Stability isn't guaranteed, but I've run a few tests and it seems to work. Give it a try!



2.2.1-v2
* 2.2.1 now supported!

* Added simcull. This speeds up the game in larger maps.

* This version is more resistent to desynchs. However, if a desynch is reoccurring it is recommended to rejoin the game.


Ways to play
Note: With all game modes, it is advised to run autotimefudge if the game feels jumpy. Try and do it when the game isn't spike-lagging. A good time fudge can make the frame rate feel much smoother!

No control lag, predicted players (default)
In this configuration, control lag is minimised and your shots are instant. However, other players' movements are predicted based on their last controls, and they might not reflect their realtime positions. They can look very jumpy, and your shots may sometimes miss when they look like they should hit. To play like this, do the following:

simsteadyplayers 0

No control lag, steady players, delayed ring slings
In this configuration, control lag is minimised, and other players don't jump around too much. When you see your ring hit someone, it is usually accurate. However, there is a delay when you throw rings.

simsteadyplayers max
simslingdelay Yes


No control lag, steady players, predicted shots
In this configuration, control lag is minimised, and other players don't jump around. Your shots are also instant. However, the game is internally trying to predict your shots for you. This may cause inaccuracies, but could be useful for some play styles.

simsteadyplayers max
simslingdelay No


Some control lag, steadier players
In configurations like this, you can tweak the amount of control lag you'll have. More control lag means the game doesn't need to predict other players' actions as much, making them less jumpy. If you do this:

simtics 3
simsteadyplayers 0


...then the game will simulate 3 frames into the future, meaning you have 3 frames less control lag than you would in the normal version.

Console vars
sim Enables simulation. Default: On
simtics The maximum number of tics the game will simulate locally. This means *how many tics of control lag are cancelled out*. 200 ms, for example, is about 7 tics. Default: MAX
simsteadyplayers The maximum number of tics that other players will be steadied. Instead of trying to predict where other players will go, the game will put them slightly in the past, closer to the location we last received from the server. A max value will put players at their last known position from the server, i.e. no prediction at all. A value of 2 will mostly predict the player, except for the latest 2 frames. When this is enabled and netslingdelay is disabled, the game will try and predict your ring shots when it sends them to the server. Default: 0
simslingdelay This works in combination with netsteadyplayers. If enabled, the game delays your ring shots by as much as netsteadyplayers, instead of trying to predict them as mentioned above. If this is enabled and steadyplayers is max, your rings will have the same delay as you would have control lag in a normal game. Default: Off
simtrails Optionally specifies the length and lifetime of player trails. These can be generated when players make large jumps due to prediction inaccuracy. They can help you see other players' motion. Default: 5
simcullWhen set, objects will only simulate when you are within a certain distance to them. If you get severe frame rate lag, try this. The smaller the distance, the faster the game will run, but the closer objects will be deactivated. 1000-9999 is a good starting value. This is great for co-op maps (if they work ^^;), but not ideal for competitive games. If your game is running smoothly, keep it disabled. Default: Min (disabled)

timefudge This is a percentage 'nudge' of your game tic timer. This can reduce frame jutter (see illustration). You can set this manually if you like, but autotimefudge will usually do the trick. Default: 0
autotimefudge This does the hard work for you and finds a good time fudge. You can occasionally use this if the game becomes jumpy, as network conditions can change, and the server and client timers become out of sync over time.
netsimstat View all the juicy debug information! Default: Off

Known Issues

  • Many co-op maps, enemies, etc may cause desynchs
  • Enemies can cause desynchs
  • Large maps may lag. See simcull for a possible solution.
  • Some maps may outright crash (RIP CEZ1)
  • Sometimes you may synch fail outright. If this happens, restart your game before rejoining.
  • Precipitation (rain, snow, etc) may cause stability problems. Consider disabling precipitation entirely when using this mod.
  • If these issues prevent the game from playing adequately, you could still rejoin and play with sim off. This will reintroduce control lag, but you can still use autotimefudge to smoothen your experience!
Source code
The source code is available at: https://github.com/LXShades/SRB2/tree/netplus
 

Attachments

  • srb2netplus.zip
    1.7 MB · Views: 1,545
Last edited:

MellowJacket

The unreliable judge
Judge
NetPlus is not something I expected to come back for 2.2 after we didn't get a version of it for 2.1, but this is a very nice surprise indeed. But this works out just fine after testing it in a CTF netgame so it's good for releases!
 

softchassis

Call me Nadia
So this is essentially (or similar to?) the kind of rollback-based netcode you see with things like GGPO? That's awesome. I'll have to give this a go.
 

LXShadow

Member
So this is essentially (or similar to?) the kind of rollback-based netcode you see with things like GGPO? That's awesome. I'll have to give this a go.

Yep, that's exactly it!

do not try to run on a computer with a bad cpu, it will lag extremely hard

It requires significantly more processing, and on many co-op maps it will lag even for extremely decent CPUs. SRB2NetPlus doesn't support co-op at this time, and it's not on my radar currently, but I encourage developers to look into that if they're interested.

If you're experiencing frame drops even on ringslinger maps, consider reducing simulatetics to a level where the frame rate is steady. If the frame rate is not steady it will introduce a lot of jutter.

For any developers who are interested (as I'm unlikely to have the time to develop this much further), it's worth looking into adding distance culling for objects during simulated frames, e.g. only tic objects that are within a certain distance of the players during simulated frames. This would make massive maps more tolerable as there aren't a bunch of scenery and enemy objects being ticced when they're not needed.

A bigger priority is fixing the desynchs and polyobjects mind ^^;
 

SCOTT0852

Member
Nobody ever puts 64-bit builds up, so I compiled one myself. Commit 9c1fee91de (Snarky timefudge message should now only appear in the correct cond…), probably the same one as the 32-bit version.
 

Attachments

  • srb2netplus-x64.zip
    1.9 MB · Views: 250

Chromatian

KartKrew™
Sonic Team Junior
Kart Krew™️
It requires significantly more processing, and on many co-op maps it will lag even for extremely decent CPUs. SRB2NetPlus doesn't support co-op at this time, and it's not on my radar currently,

This is a deal breaker for most of the new players to SRB2. Many of them came for Sonic, not First-Person-Shooter with ghetto balancing. 2.2 has barely touched what is left of Ringslinging gametypes, and they seem to be heading out of the door in the future.

I remember you working on client-side experiment for 2.0. Would that be more stable with Singleplayer levels?
 

LXShadow

Member
With caveats, yeah. An SRB2CS-style mod wouldn't have sync fails and there would be no control jutter, but it would struggle to synchronise moving platforms and enemies. Server sizes would probably need to be smaller as well.

It's a lot of work to tear down the netcode and re-make it.

Co-op isn't on my radar at the moment because netplus is basically a passion project I pulled together in a week over Christmas (plus eventual tweaks) to see if it was possible to play ringslinger without lag. I agree that most players came here for a platforming game and it would make the most sense to support the co-op and its humungous maps, but the effort-to-return ratio is high, and I'm spending the majority of my time on other projects. I did look into it quite a bit before release and I may take a look at it in the future but I'm just not able to commit to it.

If you're a developer and have any questions about how the mod works so you can have a look at co-op support, feel free to ask me anytime. :)
 
Pretty interesting that x86 Windows build just crashes for me upon joining the network game without any RPT or other dump, but x64 works very-very fine as it is.
I cannot express all of my happiness to see my dream coming true. I've always wanted to play SRB2 online comfortably, and I'm glad that LXShadow made this a reality. Thank you so much!

BTW, I put x64 Arch Linux Build of this mod here for those who doesn't want to mess with compilation. You'll need srb2 data files already installed in your system, though.
To install the package, just extract the zip and run
Code:
sudo pacman -U srb2netplus-2.2.0-1-x86_64.pkg.tar.xz
 

Attachments

  • srb2netplus-2.2.0-1-x86_64.pkg.tar.xz.zip
    1.4 MB · Views: 164

LXShadow

Member
2.2.1 is now supported! And with simcull added, there is potential for eventual co-op and race support. While neither modes are officially supported or stable, it is now possible to play through some of the larger maps without hitches. Enjoy!
 

CobaltBW

Community Noise Maker
Sonic Team Junior
With caveats, yeah. An SRB2CS-style mod wouldn't have sync fails and there would be no control jutter, but it would struggle to synchronise moving platforms and enemies. Server sizes would probably need to be smaller as well.

It's a lot of work to tear down the netcode and re-make it.

Co-op isn't on my radar at the moment because netplus is basically a passion project I pulled together in a week over Christmas (plus eventual tweaks) to see if it was possible to play ringslinger without lag. I agree that most players came here for a platforming game and it would make the most sense to support the co-op and its humungous maps, but the effort-to-return ratio is high, and I'm spending the majority of my time on other projects. I did look into it quite a bit before release and I may take a look at it in the future but I'm just not able to commit to it.

If you're a developer and have any questions about how the mod works so you can have a look at co-op support, feel free to ask me anytime. :)

In fairness, I'm not sure what you could do about co-op anyway. It seems like a lot of the consistency failures that arise from co-op have to do with the fact that the client may not agree with the server on whether a certain mobj exists or whether a sector or polyobject is synched to a certain position, and if movement hinges on that entity, then cfail kicks are guaranteed. I can only imagine this problem is made worse if the client is making its own estimates on player movement relative to the server.

While I'm not an expert at deciphering our netcode, my best educated guess would be some of these problems have to be resolved at the host level and not just the client.
 
2.2.1 is now supported! And with simcull added, there is potential for eventual co-op and race support. While neither modes are officially supported or stable, it is now possible to play through some of the larger maps without hitches. Enjoy!

This could potentially be my go-to client to play SRB2 online for all purposes if you manage to do that :)
 
Last edited:

SCOTT0852

Member
As promised, I've compiled a 64-bit build of NetPlus for 2.2.2. I can't test it since there aren't any ringslinger servers currently up, but it probably works fine.
 

Attachments

  • SRB2 2.2.2 NetPlus x64.zip
    2 MB · Views: 170

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Top