diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-07 21:16:40 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-07 21:16:40 +0100 |
commit | 3d156d75de3852dd36d0eeda33b17a2b6f10aa4a (patch) | |
tree | 4633e5934df9ff2519f422da96b64a045e5f7bb9 /doc | |
parent | d3e2f02f5f75afb6d6c62e77577452224e4a34a4 (diff) | |
download | weareserver-3d156d75de3852dd36d0eeda33b17a2b6f10aa4a.tar weareserver-3d156d75de3852dd36d0eeda33b17a2b6f10aa4a.tar.bz2 weareserver-3d156d75de3852dd36d0eeda33b17a2b6f10aa4a.tar.zst |
new proto doc
Diffstat (limited to 'doc')
-rw-r--r-- | doc/other.md | 10 | ||||
-rw-r--r-- | doc/protocol.md | 36 | ||||
-rw-r--r-- | doc/resources.md | 73 |
3 files changed, 119 insertions, 0 deletions
diff --git a/doc/other.md b/doc/other.md new file mode 100644 index 0000000..76c8c37 --- /dev/null +++ b/doc/other.md @@ -0,0 +1,10 @@ + +## Player tree + +- LowerTorso (2x leg tilt) + - FootL + - FootR + - UpperTorso (2x arm tilt) + - HandL (5x finger, 5x tilt) + - HandR (5x finger, 5x tilt) + - Head (2x brow, 2x eyelid, 2x eye, 3x mouth) diff --git a/doc/protocol.md b/doc/protocol.md new file mode 100644 index 0000000..cd4694e --- /dev/null +++ b/doc/protocol.md @@ -0,0 +1,36 @@ +# Protocol + +Default port is 28555 for TCP and UDP transport. + +For TCP, packets are concatenated to a stream. + +For UDP, game packets are concatenated in groups of at least one to form one UDP +packet. + +## Protocol packets + +All packets are preceeded by its length as u32. The next byte indicates the +type. The following bytes are the parameters. + +`Vec<T>` is stored as u32 element count followed by the elements. `Res<T>` is +used to denote 256-bit resource hash referring to data of type T. `Obj` refers +128-bit game objects IDs. + +```rs +00 connect(identity: u128) +ff disconnect() +01 request_resource(name: Res) +02 respond_resource(data: Vec<u8>) +03 add(id: Obj, prefab: Res<Prefab>) +04 remove(id: Obj) +05 position(id: Obj, pos: Vec3, rot: Vec3) +06 pose(id: Obj, params: Vec<f32>) +07 parent(parent: Obj, child: Obj) +08 sound(id: Obj, data: Vec<u8>) +09 prefab_index(res: Res) +``` + +## Resources + +Resources are reusable things. They are identified by the SHA-256 hash of their +serialized content. See [resources.md](./resources.md) diff --git a/doc/resources.md b/doc/resources.md new file mode 100644 index 0000000..3add075 --- /dev/null +++ b/doc/resources.md @@ -0,0 +1,73 @@ +# Resource formats + +## Dictionary format + +``` +[kkkk vvvv KK... VV...]... + ^ ^ ^ ^ + | | | | value + | | | key + | | 16-bit kalue length + | 16-bit key length +``` + +## PrefabIndex + +| Key | Value Type | +| -------- | ---------- | +| \<Name\> | Resource | + +## Prefab + +| Key | Value Type | | +| ----------- | ----------------------- | --------- | +| mesh | Matrix3, Vec3, Resource | Multi key | +| light | Vec3, Resource | Multi key | +| environment | Resource | | + +## MeshPart + +Combinations of g__, va__ and tex_* are multiplied except normal which is added. +Defaults should be the identity for that operation, so default is 1 / white +except normals are zero. + +| Key | Value Type | | +| ---------------- | ------------- | ------------------ | +| index | Resource | | +| g_metallic | f32 | | +| g_roughness | f32 | | +| g_albedo | Vec3 | | +| g_transmission | f32 | | +| g_emission | Vec3 | | +| va_position | [Resource; 3] | | +| va_normal | [Resource; 3] | | +| va_texcoord | [Resource; 2] | | +| va_roughness | Resource | | +| va_metallic | Resource | | +| va_albedo | [Resource; 3] | | +| va_transmission | Resource | | +| va_emission | Resource | | +| tex_normal | Resource | Use color channels | +| tex_roughness | Resource | Use green channel | +| tex_metallic | Resource | Use blue channel | +| tex_albedo | Resource | Use color channels | +| tex_transmission | Resource | Use alpha channel | +| tex_emission | Resource | Use color channels | + +## LightPart + +| Key | Value Type | +| -------- | ---------- | +| radius | f32 | +| emission | Vec3 | + +## EnvironmentPart + +| Key | Value Type | | +| ------ | ---------- | ---------------- | +| skybox | Resource | | +| sun | Vec3, Vec3 | Direction, Color | + +## Texture + +WebP |