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

Player components and Comms extensions #144

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
37eac37
add sdk commands for comms
menduz May 4, 2023
3a3d11b
remove unused duplicated file
menduz May 4, 2023
49b7f43
wip
menduz May 4, 2023
b8d55a5
fix id
menduz May 10, 2023
a85bd7d
fix id
menduz May 11, 2023
4ed3ee9
fix color3
menduz May 11, 2023
ae4e574
add more instructions to PR build
menduz May 11, 2023
f3c10ae
feat: add errors in social service response (#145)
agusaldasoro May 11, 2023
523a10f
add skybox textures
menduz May 12, 2023
73ae4cc
refactor: move engine_interface and add components data (#130)
leanmendoza May 12, 2023
908f271
Revert "feat: add errors in social service response (#145)" (#148)
leanmendoza May 15, 2023
86bc6c2
chore: add note for introducing breaking changes (#147)
Julieta11 May 15, 2023
82bab20
chore: nft shape urn update (#146)
pravusjif May 15, 2023
ba7bcad
feat: add errors in social service response (#145) (#149)
leanmendoza May 15, 2023
9780e3d
add info
menduz May 19, 2023
0ec081e
extend comms
menduz May 19, 2023
23fe6bd
Merge branch 'main' into comms
menduz May 19, 2023
c10dba3
add tween component
menduz May 19, 2023
4480d61
add clarifications
menduz May 19, 2023
3d87f8b
wip
menduz May 19, 2023
c09d710
wip
menduz May 19, 2023
d2f1b84
better comments
menduz May 22, 2023
f2a6d0b
fix build
menduz May 22, 2023
5dac860
add comments
menduz May 22, 2023
aecbcf9
update comment
menduz May 22, 2023
e087373
Merge branch 'main' of github.com:decentraland/protocol into comms
menduz May 22, 2023
30883c8
Merge branch 'main' of github.com:decentraland/protocol into comms
menduz May 29, 2023
4f8fb76
Merge branch 'main' into comms
menduz Jun 8, 2023
3365158
Merge branch 'main' of github.com:decentraland/protocol into comms
menduz Jun 28, 2023
1d279e3
Merge branch 'comms' of github.com:decentraland/protocol into comms
menduz Jun 28, 2023
8576568
Merge branch 'main' into comms
leanmendoza Jul 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,9 @@ jobs:
```bash
npm install "${{ steps.url-generator.outputs.body }}"
```
- Update this package to test in the SDK by running
```bash
make update-protocol UPDATE_PROTOCOL_VERSION=${{ steps.url-generator.outputs.body }}
make build update-snapshots
```
edit-mode: replace
47 changes: 46 additions & 1 deletion proto/decentraland/kernel/comms/rfc4/comms.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file maps to the definition in https://rfc.decentraland.org/rfc/RFC-4
// This file maps to the definition in https://adr.decentraland.org/adr/ADR-104
// It is mandatory to also update that RFC when modifying this file

syntax = "proto3";
Expand All @@ -14,9 +14,52 @@ message Packet {
Chat chat = 5;
Scene scene = 6;
Voice voice = 7;
Component sdk_component = 8;
Custom custom = 9;
}
}

// Custom is used to encode any kind of custom signaling that is not part of
// the standard protocol. The name field is used to identify the signal type, and
// the data field contains the serialized signal data.
//
// A concrete example of this is the ping signal, which is used to measure the
// latency of the connection. The name field would be "ping", and the data field
// would contain the serialized Ping message.
// This message is not part of the standard protocol, and is only used to encode
// custom implementation-dependant signals.
//
// The namespace field is used to identify the origin of the signal. For example,
// the SDK could use the "sdk" namespace to send signals that are only relevant
// to the SDK. The namespace field is required to prevent collisions between
// different signals.
//
// The kind field is used to identify the type of signal. For example, the SDK
// could use the "sdk" namespace, and the SdkEnum.Ping kind to identify the ping signal.
//
// The usage of custom messages is discouraged, and should only be used to prototype functionality
// that is not part of the standard protocol. If a signal is used to prototype a feature,
// it should be proposed as a standard protocol message, and the signal should be removed
// once the feature is implemented.
message Custom {
string namespace = 1;
uint32 kind = 2;
bytes data = 3;
}

// the Component message enables sending a custom SDK component over the comms
// channel. The component_id is used to identify the component type, and the data
// field contains the serialized component data. as defined by ADR-117. this message
// only encodes component data for the current player. For example, HandPositionComponent
// could be used to track the position and rotation of both hands of the player. The player
// tracking its hands would send this component over the wire, and other players would
// receive it and render the hands of the player.
message Component {
menduz marked this conversation as resolved.
Show resolved Hide resolved
uint32 component_id = 1;
bytes data = 2;
uint32 timestamp = 3;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to add some additional description for the timestamp field, as with the other two. It's unclear in this context (Components sent over comms) whether this is a Lamport timestamp, a Unix timestamp, or some other time-like value. The same name is used with a float type for milliseconds in Position, and there's a nice comment there 😄


message Position {
// command number
uint32 index = 1;
Expand All @@ -29,6 +72,8 @@ message Position {
float rotation_y = 7;
float rotation_z = 8;
float rotation_w = 9;
// timestamp
float timestamp = 10; // in relative milliseconds
}

message AnnounceProfileVersion {
Expand Down
64 changes: 0 additions & 64 deletions proto/decentraland/kernel/comms/v3/comms.proto

This file was deleted.

13 changes: 13 additions & 0 deletions proto/decentraland/sdk/components/avatar_customization.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";
package decentraland.sdk.components;
import "decentraland/common/colors.proto";
import "decentraland/sdk/components/common/id.proto";
option (common.ecs_component_id) = 1087;

// AvatarCustomizations sets all modifiers over the avatar's apparence.
message PBAvatarCustomization {
Copy link
Contributor

@slezica slezica May 19, 2023

Choose a reason for hiding this comment

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

The word Customization is a little long. How about Mods, for modifiers? I'm not sure, nothing better is coming to mind right now.

decentraland.common.Color3 skin_color = 1;
decentraland.common.Color3 eyes_color = 2;
decentraland.common.Color3 hair_color = 3;
string body_shape_urn = 4;
}
13 changes: 13 additions & 0 deletions proto/decentraland/sdk/components/avatar_emote_command.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";
package decentraland.sdk.components;

import "decentraland/sdk/components/common/id.proto";
option (common.ecs_component_id) = 1088;

// AvatarEmoteCommand is a grow only value set, used to signal the renderer about
// avatar emotes playback.
message PBAvatarEmoteCommand {
string emote_urn = 1;
menduz marked this conversation as resolved.
Show resolved Hide resolved
uint32 timestamp = 2;
bool loop = 3;
}
13 changes: 13 additions & 0 deletions proto/decentraland/sdk/components/avatar_equipped_data.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";
package decentraland.sdk.components;

import "decentraland/sdk/components/common/id.proto";
option (common.ecs_component_id) = 1091;

// AvatarEquipData is used to read the information about the avatar's owneables.
// this component is written by the engine using the communications transports'
// data.
message PBAvatarEquippedData {
repeated string wearable_urns = 1;
repeated string emotes_urns = 2;
}
8 changes: 4 additions & 4 deletions proto/decentraland/sdk/components/avatar_modifier_area.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import "decentraland/sdk/components/common/id.proto";

option (common.ecs_component_id) = 1070;

// The AvatarModifierArea component can be attached to an Entity to define a region of space where
// The AvatarModifierArea component can be attached to an Entity to define a region of space where
// avatar behavior changes.
//
// The Entity's Transform position determines the center-point of the region, while its size is
// given as a vector in the `area` property below. The Transform rotation is applied, but the scale
// The Entity's Transform position determines the center-point of the region, while its size is
// given as a vector in the `area` property below. The Transform rotation is applied, but the scale
// is ignored.
//
// The modifier effect is only applied to avatars inside the region. It does not affect how players
// The modifier effect is only applied to avatars inside the region. It does not affect how players
// standing inside it see avatars on the other side of the boundary.
//
// Note that, while commonly used to delineate a 2D area in a scene (hence the name), the region
Expand Down
32 changes: 32 additions & 0 deletions proto/decentraland/sdk/components/delayed_interpolation.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
syntax = "proto3";

package decentraland.sdk.components;

import "decentraland/sdk/components/common/id.proto";

option (common.ecs_component_id) = 1101;

// https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking#Entity_interpolation
// https://gamedev.stackexchange.com/questions/142427/delayed-linear-interpolation-for-networking
// https://github.com/menduz/Semi-Fixed-Time-Step-Interpolation
//
// The DelayedInterpolation component allows to animate the final transform of an entity.
// The animation is performed time-traveling back in time .duration amount of milliseconds
// and linearly interpolating the values of the transform from the past.
//
// The parameters used for this time-travel are set by the transform component and its
// modifiers like billboard, avatar attachment point, etc.
//
// When an entity changes its parent entity, the tween's time-travel registry will
// automatically reset. Meaning NO tweening will be performed upon reparenting.
//
// Tweens will be calculated AFTER the final position of the entity is calculated,
// and BEFORE the position of the child entities is computed. Effectively applying
// the animation to all its children.
//
// It is important to mention that tweens only apply to the local entity, if a parent entity P
// has a linear tween, and it has a child entity C with another tween, by moving P, only P's tween will apply,
// moving C's frame of reference but NOT animating it.
message PBDelayedInterpolation {
float time_travel_duration = 1; // in milliseconds
}
14 changes: 14 additions & 0 deletions proto/decentraland/sdk/components/player_identity_data.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
syntax = "proto3";
package decentraland.sdk.components;

import "decentraland/sdk/components/common/id.proto";
option (common.ecs_component_id) = 1089;
menduz marked this conversation as resolved.
Show resolved Hide resolved

// PlayerIdentityData is used to read the information about the avatar's identity.
// this component is written by the engine using the communications transports'
// data.
message PBPlayerIdentityData {
string address = 1; // ethereum address of this player
string name = 2;
bool is_guest = 3;
}
66 changes: 66 additions & 0 deletions proto/decentraland/sdk/components/tween.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
syntax = "proto3";

package decentraland.sdk.components;

import "decentraland/sdk/components/common/id.proto";

option (common.ecs_component_id) = 1102;

// The Tween component allows you to animate the final transform of an entity.
// The animation is performed interpolating the previous value of the transform
// and the current value for a .duration amount of milliseconds.
//
// The intended usage for Tween is to animate objects with predictable behaviors
// without having to write a custom system and over-send trivial messages over the CRDT protocol.
// A great example for this is the movement of a character, or the rotation of a door.
//
// When an entity changes its parent entity, the interpolation resets to the current
// value. Performing no animation at all.
//
// Tweens will be calculated AFTER the final position of the entity is calculated,
// and BEFORE the position of the child entities is computed. Effectively applying
// the animation to all its children.
//
// It is important to mention that tweens only apply to the local entity, if a parent entity P
// has a linear tween, and it has a child entity C with another tween, by moving P, only P's tween will apply,
// moving C's frame of reference but NOT animating it.
menduz marked this conversation as resolved.
Show resolved Hide resolved
message PBTween {
float duration = 1; // in milliseconds
EasingFunction tween_function = 2;
}

// https://easings.net/
enum EasingFunction {
// https://github.com/ai/easings.net/blob/master/src/easings/easingsFunctions.ts
TF_LINEAR = 0; // default
TF_EASE_IN_QUAD = 2;
TF_EASE_OUT_QUAD = 3;
TF_EASE_IN_OUT_QUAD = 4;
TF_EASE_IN_CUBIC = 5;
TF_EASE_OUT_CUBIC = 6;
TF_EASE_IN_OUT_CUBIC = 7;
TF_EASE_IN_QUART = 8;
TF_EASE_OUT_QUART = 9;
TF_EASE_IN_OUT_QUART = 10;
TF_EASE_IN_QUINT = 11;
TF_EASE_OUT_QUINT = 12;
TF_EASE_IN_OUT_QUINT = 13;
TF_EASE_IN_SINE = 14;
TF_EASE_OUT_SINE = 15;
TF_EASE_IN_OUT_SINE = 16;
TF_EASE_IN_EXPO = 17;
TF_EASE_OUT_EXPO = 18;
TF_EASE_IN_OUT_EXPO = 19;
TF_EASE_IN_CIRC = 20;
TF_EASE_OUT_CIRC = 21;
TF_EASE_IN_OUT_CIRC = 22;
TF_EASE_IN_BACK = 23;
TF_EASE_OUT_BACK = 24;
TF_EASE_IN_OUT_BACK = 25;
TF_EASE_IN_ELASTIC = 26;
TF_EASE_OUT_ELASTIC = 27;
TF_EASE_IN_OUT_ELASTIC = 28;
TF_EASE_IN_BOUNCE = 29;
TF_EASE_IN_OUT_BOUNCE = 30;
TF_EASE_OUT_BOUNCE = 31;
}
8 changes: 7 additions & 1 deletion public/sdk-components.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,30 @@ import public "decentraland/sdk/components/animator.proto";
import public "decentraland/sdk/components/audio_source.proto";
import public "decentraland/sdk/components/audio_stream.proto";
import public "decentraland/sdk/components/avatar_attach.proto";
import public "decentraland/sdk/components/avatar_customization.proto";
import public "decentraland/sdk/components/avatar_emote_command.proto";
import public "decentraland/sdk/components/avatar_equipped_data.proto";
import public "decentraland/sdk/components/avatar_modifier_area.proto";
import public "decentraland/sdk/components/avatar_shape.proto";
import public "decentraland/sdk/components/billboard.proto";
import public "decentraland/sdk/components/camera_mode_area.proto";
import public "decentraland/sdk/components/camera_mode.proto";
import public "decentraland/sdk/components/delayed_interpolation.proto";
import public "decentraland/sdk/components/engine_info.proto";
import public "decentraland/sdk/components/gltf_container.proto";
import public "decentraland/sdk/components/gltf_container_loading_state.proto";
import public "decentraland/sdk/components/gltf_container.proto";
import public "decentraland/sdk/components/material.proto";
import public "decentraland/sdk/components/mesh_collider.proto";
import public "decentraland/sdk/components/mesh_renderer.proto";
import public "decentraland/sdk/components/nft_shape.proto";
import public "decentraland/sdk/components/player_identity_data.proto";
import public "decentraland/sdk/components/pointer_events_result.proto";
import public "decentraland/sdk/components/pointer_events.proto";
import public "decentraland/sdk/components/pointer_lock.proto";
import public "decentraland/sdk/components/raycast_result.proto";
import public "decentraland/sdk/components/raycast.proto";
import public "decentraland/sdk/components/text_shape.proto";
import public "decentraland/sdk/components/tween.proto";
import public "decentraland/sdk/components/ui_background.proto";
import public "decentraland/sdk/components/ui_dropdown_result.proto";
import public "decentraland/sdk/components/ui_dropdown.proto";
Expand Down
Loading