Live data from Hacker News

Reflect – Multiplayer web app framework with game-style synchronization

rocicorp.dev

21–30 of 159 posts

Re: Reflect – Multiplayer web app framework with game-style synchronization

#21
People might remember this showing up once or twice before as Replicache. Reflect adds a fully managed, incredibly fast sync server.

The local-first/realtime space is getting busy these days. Replicache/Reflect is well worth checking out for the beautifully simple data model / coding model. I'm very happy with it.

One plus point compared to CRDTs is that you get to decide how you want to deal with conflicts yourself, with simple, sequential code. I'm not up to date with the latest in CRDT-land but I believe it can be complicated to add application specific conflict resolution if the built-in rules don't fit your needs.

Re: Reflect – Multiplayer web app framework with game-style synchronization

#22
post #13

While I do love the simplicity of this approach on the surface. Some of the complexity gets brushed under the rug. Firstly is rebasing these operations in this style of system takes a bigger hit on performance than I expected in my experience. Sure, managing counters and doing integer math can consistently run at 120FPS but more complex operations can really bog down the system when a lot of users are interacting wit…

Hey Matlin, it's true that this approach is harder to implement, but that's a one-time cost, and it's one we take on for our users and they don't have to worry about.

Can you share how y'all made it fast? Obviously it can be made fast because multiplayer online games are living proof but I'm curious what it takes to get there or what's missing in my mental model.

Re: Reflect – Multiplayer web app framework with game-style synchronization

#23

Hey Aaron, cool product! Well done so far. Curious why you think no-one has done TCR before? Also, any insights on why you're bullish on the "multiplayer web"? Will be cool to see example docs / repos as they come out!

The examples and docs are live here: https://hello.reflect.net/

TCR is just a small generalization of what the game industry has been doing for awhile. So in that sense, we are not at all the first.

But I'm honestly not sure why it's not been done on the web yet. To me, it's a really elegant approach. It is harder to implement in a general way (like as a library) because you need to run code on the server. And as others have pointed out, it's harder to make fast.

Perhaps multiplayer is just new enough to the web that there hasn't been time for these approaches to evolve.

I mean, React was also inspired by game techniques that at that time were decades old.

Re: Reflect – Multiplayer web app framework with game-style synchronization

#24
post #15

If you want true concurrency, in an elegant format, with a lot of the common problems abstracted away -- use Erlang. They solved this 30 years ago.

Someone should bring those logics to js and java then. Ehm, please.

What makes Erlang (and Elixir) great isn't just the actor model, it's the language-level commitment to it. Things that would mess with concurrency (say, race conditions on the reading and modification of a global variable) are simply unexpressible in BEAM languages.

Re: Reflect – Multiplayer web app framework with game-style synchronization

#25
post #16

This technique is pretty similar to Operational Transformations, except that it requires an authority for serialization and must re-apply any state which is out of sync.

It's not the same thing. OT works by having a discrete set of operations that are known to the system so that they can be reordered properly server-side. Reflect is based on Server Reconciliation: https://www.gabrielgambetta.com/client-side-prediction-serve... . The critical difference is that Reflect doesn't need to know the operations up front. That is what allows developers to provide their own operations, or as w…

I'm using Replicache in a big project - this simple fact is a big deal. It's basically the same coding model that all the front-end frameworks have gravitated to (central store, unidirectional dataflow, mutators separate from data access) but it all stays in sync across the distributed system.

Re: Reflect – Multiplayer web app framework with game-style synchronization

#26

People might remember this showing up once or twice before as Replicache. Reflect adds a fully managed, incredibly fast sync server. The local-first/realtime space is getting busy these days. Replicache/Reflect is well worth checking out for the beautifully simple data model / coding model. I'm very happy with it. One plus point compared to CRDTs is that you get to decide how you want to deal with conflicts yourself,…

Ah thanks - related past threads:

A JavaScript framework to build offline-first but collaborative webapp - https://news.ycombinator.com/item?id=33269440 - Oct 2022 (2 comments)

Linear clone, with realtime sync and instant UI - built with Replicache - https://news.ycombinator.com/item?id=31331660 - May 2022 (3 comments)

Replicache: Easy Offline-First for Existing Applications - https://news.ycombinator.com/item?id=22173500 - Jan 2020 (22 comments)

Re: Reflect – Multiplayer web app framework with game-style synchronization

#28
post #13

While I do love the simplicity of this approach on the surface. Some of the complexity gets brushed under the rug. Firstly is rebasing these operations in this style of system takes a bigger hit on performance than I expected in my experience. Sure, managing counters and doing integer math can consistently run at 120FPS but more complex operations can really bog down the system when a lot of users are interacting wit…

Hey Matlin, it's true that this approach is harder to implement, but that's a one-time cost, and it's one we take on for our users and they don't have to worry about.

Also just as an FYI we do have this running live at https://reflect.net and https://hello.reflect.net/examples at 120 FPS.

We are targeting 100 concurrent users at 120 FPS. Not completely there, but it is certainly achievable, and we will scale back framerate when we need to.

Re: Reflect – Multiplayer web app framework with game-style synchronization

#29
post #22

Earlier quoted context omitted.

Hey Matlin, it's true that this approach is harder to implement, but that's a one-time cost, and it's one we take on for our users and they don't have to worry about.

Can you share how y'all made it fast? Obviously it can be made fast because multiplayer online games are living proof but I'm curious what it takes to get there or what's missing in my mental model.

Not really any magic, just a lot of careful engineering.
Post reply on HN