Is rollback netcode feasible with roblox? (just looking for opinions, you don't need to know rollback to help with this)

Hey all, I’m working on rollback netcode support for my engine so that I may roll back the state of the game. I wanted to know if it was even feasible in the first place to do this the roblox engine or if unaddressable issues would crop up.

For those who don’t know how rollback netcode works, it essentially predicts a player’s action as being what their previous input state was, and if it diverges from this prediction it “rolls back” the state of the game, corrects the input and fast forwards the game to sync back up with what was happening.

In laymen terms, it rewinds time and fast forwards time based on player input.

In order for rollback to work well, I need to make sure that such a rollback feature would even work on roblox. I can synchronize a clock on everyone’s client, then every “tick” of this table save the state of every active entity/object in the game. That stuff is fine. I can clear out the old data in the table so a memory leak doesn’t occur, and input can be communicated across the client/server just fine as well.

Now here’s where I’m unclear:

  • Is it possible, in roblox, to make “corrections” (rewinds and fast forwards) seamless? Ideally you should not notice frame skips when a correction occurs, as they will occur very very frequently.
  • How would you begin to predict non-input based actions? Rollback is often used in 2D fighting games, but the engine is intended to support more traditional 3D roblox games. Predicting keyboard input is simple enough, but predicting other things such as a player’s mouse.Hit sounds way more complicated.

So I’m asking the scripting community as a whole, do you personally reckon rollback is possible from experience with any of the things I’ve listed above? And do you feel like anything should be compromised in order to make it more feasible with roblox?

4 Likes

It is theoretically possible to do this on roblox, however I imagine that you may encounter some frame skipping issues. I’ve noticed that some games have implemented a “mixed” type of rollback netcode, which minimizes frame skipping yet adds a very slight delay between input and action. You can accomplish this by artificially adding a small input delay allowing for the other player’s action to replicate.

2 Likes

I guess the main source of my concern for that is if it’s even possible to execute code before roblox renders a scene as otherwise there will be a frame where things were corrected but the image drawn onscreen is out of date. Ideally I’d like to avoid adding delayed input if possible due to many fighting games implementing “parries” with strict timing windows and delays would force the developer to skew the timing windows to take account of the delay, which I imagine most wouldn’t have thought about.

Are you referring to a game on roblox or just a game in general, by the way? If it’s on roblox I’d like to see it so I can see how they’ve executed it first-hand

2 Likes

A game in general, sorry for being unclear.

2 Likes

Tried researching this for my own game and it might be possible to do rollback netcode, however, I’ve come to the conclusion it’s not worth it.

Most fighting games like Street Fighter, Mortal Kombat, Guilty Gear etc seem to use peer to peer connections I don’t know much about networking and stuff, but I’m pretty sure for rollback netcode or delay netcode a peer to peer connection is used as I think the inputs are sent from the client to the remote client, but obviously, on Roblox, this isn’t possible as it’s client-server based.

Also, Roblox probably already has their own netcode so trying to make one on top of the Roblox one probably won’t be great?

And I think that’s pretty much it. You can definitely still attempt this however I don’t think Roblox has the tools to make it fully possible so you’re probably just gonna end up with a scuffed system lol.

Anyways this is probably unnecessary, but here’s a cool video I found on netcode that might be helpful.

edit: ALSO this might be helpful. I found this demo netcode system on github which was made in Love2D which means it was written with Lua pogu https://github.com/Konjointed/DemoFighterWithNetcode

2 Likes

Roblox’s built in networking wouldn’t be able to affect anything as long as things are done locally, which for the small things like visual effects imo should be done on the client to begin with.

As for players, I’ll probably have them also be entirely client-sided, existing as basic shapes on the server representing the estimated location of a player on the server, essentially like a mob that a player is able to control. That way roblox’s built in rollback should be unable to affect anything.

2 Likes