summaryrefslogtreecommitdiff
path: root/doc/protocol.md
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-01-07 22:56:34 +0100
committermetamuffin <metamuffin@disroot.org>2025-01-07 22:56:34 +0100
commit02d65e6b7ce7a0e6bae054bd321c68dda1cb0de3 (patch)
tree10362c18bccf2e9690d78844a7ff3ca403f7a126 /doc/protocol.md
parent745c0ff9cfb27381114ce832baed3b57a2e4b4f6 (diff)
downloadweareserver-02d65e6b7ce7a0e6bae054bd321c68dda1cb0de3.tar
weareserver-02d65e6b7ce7a0e6bae054bd321c68dda1cb0de3.tar.bz2
weareserver-02d65e6b7ce7a0e6bae054bd321c68dda1cb0de3.tar.zst
static typing for resources
Diffstat (limited to 'doc/protocol.md')
-rw-r--r--doc/protocol.md26
1 files changed, 14 insertions, 12 deletions
diff --git a/doc/protocol.md b/doc/protocol.md
index cd4694e..bb20a05 100644
--- a/doc/protocol.md
+++ b/doc/protocol.md
@@ -14,20 +14,22 @@ 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.
+128-bit game objects IDs. `String` is stored like `Vec<u8>` but contains UTF-8
+encoded text.
```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)
+0x00 connect(identity: u128)
+0xff disconnect()
+0x01 request_resource(name: Res)
+0x02 respond_resource(data: Vec<u8>)
+0x03 add(id: Obj, prefab: Res<Prefab>)
+0x04 remove(id: Obj)
+0x05 position(id: Obj, pos: Vec3, rot: Vec3)
+0x06 pose(id: Obj, params: Vec<f32>)
+0x07 parent(parent: Obj, child: Obj)
+0x08 sound(id: Obj, data: Vec<u8>)
+0x09 prefab_index(res: Res)
+0x0a prefab_name(res: Res, name: String)
```
## Resources