StrataSource / Engine

Issue tracker for Strata Source
46 stars 2 forks source link

Hammer: Add Collaborative (Google Docs-style) Editing #128

Open Gocnak opened 3 years ago

Gocnak commented 3 years ago

Original issue (by me): A potential idea could be to host a "lobby" and do simple file synchronization between the lobby on a single map. Changes would be queued with timestamps, conflicts (same object editing) would either be dropped (first-come-first-applied) or resolved somehow.

Steam API allows easy P2P connections on any game (lobbies are Steamworks projects only) so that could be the foundation of the file syncing with no need for port forwarding or server hosting. Not sure if there are any protocols/libraries already in place for file synchronization. Object changes need to be serialized, and "undo"ing them needs to have local priority over network priority.

Could even look into a cloud-based compiling system to build on top of this too, so hefty maps can use your friends' resources, sorta like MPI. But that may be its own feature.

Additional research over the years: Operational transforms could be a great vessel to do this through.

VMF is pretty close to JSON, and there are some OTs for JSON objects and some backends that support doing the actual syncing.

https://ckeditor.com/blog/Lessons-learned-from-creating-a-rich-text-editor-with-real-time-collaboration/

Note from Exactol in discord 04152023: "I was looking into something like this for an open source hammer alternative a while ago, you might want to take a look at CRDTs (conflict free replicated data types). Unlike OT they dont require a central server. Also could open up some features like timelines where you can undo changes in the past without undoing changes that came after it"

Gocnak commented 6 months ago

More info on CRDTs:

https://jakelazaroff.com/words/an-interactive-intro-to-crdts/ https://jakelazaroff.com/words/building-a-collaborative-pixel-art-editor-with-crdts/ https://jakelazaroff.com/words/making-crdts-98-percent-more-efficient/

ozxybox commented 6 months ago

Those are awesome resources! Woah!