Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplayer shadows #4519

Merged
merged 9 commits into from
Nov 21, 2023
Merged

Multiplayer shadows #4519

merged 9 commits into from
Nov 21, 2023

Conversation

ruggi
Copy link
Contributor

@ruggi ruggi commented Nov 20, 2023

Fix #4525

Problem:

With collaborative editing enabled, it's difficult to understand who is doing what on the screen.

Fix:

This PR introduces collaborative shadows in the editor.
When something is being interacted with via the mouse, a shadow outline is shown to the other participants in the room.

Screen.Recording.2023-11-21.at.2.21.37.PM.mov

Two shadows per element are shown:

  1. a border outline of the original element being moved
  2. a shadow of the current element (live-ish), which also contains a string representing which action is being performed on the element (e.g. move, resize, etc.)

The colors of the outlines match the player colors.

The shadows are returned as either straight frames (where possible, to improve performance), or element paths and their frames get calculated in the multiplayer component when updating the presence.

As usual, this is a basic implementation with not much design work behind it.

Copy link
Contributor

github-actions bot commented Nov 20, 2023

Try me

Copy link

relativeci bot commented Nov 20, 2023

Job #9262: Bundle Size — 65.61MiB (+0.03%).

a7abf18(current) vs 5957b21 master#9260(baseline)

Warning

Bundle contains 67 duplicate packages – View duplicate packages

Bundle metrics  Change 4 changes Regression 2 regressions
                 Current
Job #9262
     Baseline
Job #9260
Regression  Initial JS 47.76MiB(+0.04%) 47.74MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 19.85% 18.33%
No change  Chunks 25 25
No change  Assets 29 29
Change  Modules 4423(+0.05%) 4421
Regression  Duplicate Modules 470(+0.21%) 469
No change  Duplicate Code 30.17% 30.17%
No change  Packages 458 458
No change  Duplicate Packages 67 67
Bundle size by type  Change 1 change Regression 1 regression
                 Current
Job #9262
     Baseline
Job #9260
Regression  JS 65.6MiB (+0.03%) 65.58MiB
Not changed  HTML 11.32KiB 11.32KiB

View job #9262 reportView feat/multiplayer-shadows branch activity

Copy link
Contributor

github-actions bot commented Nov 20, 2023

Performance test results:
(Chart1)
(Chart2)

# Conflicts:
#	editor/liveblocks.config.ts
#	editor/src/components/canvas/multiplayer-cursors.tsx
#	editor/src/components/user-bar.tsx
@ruggi ruggi marked this pull request as ready for review November 21, 2023 13:29
@ruggi ruggi changed the title Multiplayer shadows (WIP) Multiplayer shadows Nov 21, 2023
@@ -263,6 +264,13 @@ export function absoluteResizeBoundingBoxStrategy(
'starting-metadata',
),
queueTrueUpElement(childGroups.map(trueUpGroupElementChanged)),
setActiveFrames([
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selectedElement, newFrame, ..... hmm these are also available in pushIntendedBoundsAndUpdateGroups

the action: 'resize' is the one piece that's missing

actually I wonder if the name pushIntendedBoundsAndUpdateGroups could be changed to setStrategyIntent, so it could store resize, target, frame (even originalFrame). it feels like if a strategy forgets to call pushIntendedBoundsAndUpdateGroups that is a mistake. I wonder if setStrategyIntent could be elevated to the level of StrategyApplicationResult, meaning it would be impossible to return from the apply function without also setting what was the intent

<FollowingOverlay />
<MultiplayerShadows />
<MultiplayerCursors />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file badly needs renaming

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or we have to move the other components to their own files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it absolutely does, but I'd go with a separate PR to not pollute the diff

Copy link
Contributor

@balazsbajorics balazsbajorics left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@ruggi ruggi merged commit 40ccc90 into master Nov 21, 2023
10 checks passed
@ruggi ruggi deleted the feat/multiplayer-shadows branch November 21, 2023 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiplayer shadows
3 participants