SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

Local Prediction

Open shelbyd opened this issue 9 months ago • 2 comments

For better feeling on the local machine, almost every game implements some sort of local prediction about actions sent up to the server. Is there a current approach for doing that with SpacetimeDb? Or are there plans?

It seems to me that the code for most reducers would be fine to include in the client. Then the client sdk could run the reducer against the local view of the db to predict how the db would change in response to that reducer call.

It has some complexity, but solving this well would make this the defacto choice for multiplayer games. It's feasible to build that infrastructure myself, but I think it could be supported natively, probably better than a wrapping framework.

shelbyd avatar Mar 13 '25 01:03 shelbyd

This would likely be done on a case by case basis - the existing SpacetimeDB Unity tutorial has a simple approach for interpolation implemented on the client side. You can find that mentioned in the 3rd part here.

This is super dependent on the game, which is why I think it hasn't been tackled as a core part of the tech. Just my 2 cents.

otdavies avatar Mar 22 '25 23:03 otdavies

Yeah, this is a good callout. It's on our radar to implement! And we'd definitely give the developer control over how it works for specific tables/fields.

bfops avatar Apr 02 '25 17:04 bfops

This HN post mentions some interesting things that should be currently in progress regarding client side prediction.

Is there any issue or place to follow the progress?

https://news.ycombinator.com/item?id=43593913

Considering how many different genres of games this would unlock, its quite exciting

Nikola-Milovic avatar Sep 07 '25 11:09 Nikola-Milovic

Hey @Nikola-Milovic, unfortunately we don't have any public place to keep track of the progress on these roadmap items. We're worried that it would be more noisy than helpful for users, because our priorities are often shifting around as a small company.

bfops avatar Sep 08 '25 18:09 bfops