-
Notifications
You must be signed in to change notification settings - Fork 16
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
Changes from 20 commits
37eac37
3a3d11b
49b7f43
b8d55a5
a85bd7d
4ed3ee9
ae4e574
f3c10ae
523a10f
73ae4cc
908f271
86bc6c2
82bab20
ba7bcad
9780e3d
0ec081e
23fe6bd
c10dba3
4480d61
3d87f8b
c09d710
d2f1b84
f2a6d0b
5dac860
aecbcf9
e087373
30883c8
4f8fb76
3365158
1d279e3
8576568
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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"; | ||
|
@@ -14,9 +14,45 @@ message Packet { | |
Chat chat = 5; | ||
Scene scene = 6; | ||
Voice voice = 7; | ||
SdkComponent sdk_component = 8; | ||
CustomSignal signal = 9; | ||
} | ||
} | ||
|
||
// custom signal is used to encode any kind of custom signal 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. | ||
// | ||
// It is recommended that signal names are namespaced to avoid collisions. For | ||
// example, a signal to request a profile could be named "decentraland.profile-request.v1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This recommendation is super reasonable. Would it be a good idea to enforce it by having a Edit or maybe specify that there must be at least 1 standardized separator ( |
||
// | ||
// The usage of signals 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 CustomSignal { | ||
string name = 1; | ||
bytes data = 2; | ||
} | ||
|
||
// the SdkComponent 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. | ||
menduz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
message SdkComponent { | ||
uint32 component_id = 1; | ||
bytes data = 2; | ||
uint32 timestamp = 3; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to add some additional description for the |
||
} | ||
|
||
message Position { | ||
// command number | ||
uint32 index = 1; | ||
|
@@ -29,6 +65,8 @@ message Position { | |
float rotation_y = 7; | ||
float rotation_z = 8; | ||
float rotation_w = 9; | ||
// timestamp | ||
float timestamp = 10; // in relative milliseconds | ||
} | ||
|
||
message AnnounceProfileVersion { | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
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. This | ||
menduz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
message PBAvatarCustomization { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The word |
||
decentraland.common.Color3 skin_color = 1; | ||
decentraland.common.Color3 eyes_color = 2; | ||
decentraland.common.Color3 hair_color = 3; | ||
string body_shape_urn = 4; | ||
// TODO: should name be here or in PlayerIdentityData? | ||
menduz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
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; | ||
} |
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 urns = 1; | ||
repeated string emotes = 2; | ||
menduz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
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; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
syntax = "proto3"; | ||
|
||
package decentraland.sdk.components; | ||
|
||
import "decentraland/sdk/components/common/id.proto"; | ||
|
||
option (common.ecs_component_id) = 1101; | ||
|
||
// The Tween component allows you to animate the final transform of an entity. | ||
// The animation is performed time-traveling back in time .duration amount of milliseconds | ||
// and 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. | ||
menduz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
message PBTween { | ||
float duration = 1; // in milliseconds | ||
TweenFunction tween_function = 2; | ||
|
||
// https://easings.net/ | ||
enum TweenFunction { | ||
// 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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't wait to see a demo scene full of things animating with weird accelerations 🎉 |
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may have gone overboard with this comment. Sorry! 😅
I recommend we change the names to
Component
andCustom
.My thoughts:
Rationale for
Component
I think we should avoid having hard references to the SDK at the protocol layer. It's fine for comments, but a variable name feels like conceptually breaking through the layers 👊 .
I don't think the word
Component
needs clarification. The meaning is very established in our terminology, and has been for a long while.While
Sdk
does additionally imply that theComponent
is standard, that's a reasonable assumption of any message in the protocol unless otherwise specified.Rationale for
Custom
The term
Signal
is associated with semantics that don't quite fit here.Custom
, removingSignal
, matches the style of the other names (e.g. we don't haveChatMessage
orVoiceSample
) and is explicit about the purpose of the field: this is for unspecified stuff.I can't think of other places where we'd reuse this concept of
Signal
. If this is going to be the only case, I don't think we should introduce it.