Replies: 1 comment
-
Just in the spirit of problem solving: Alternative: 🗜️ tinybufShameless self-plug, 🗜️ tinybuf supports optional values, and is compatible with geckos.io/socket.io. Equivalent code:import { encoder, Type, Optional } from 'tinybuf';
const positionsModel = encoder({
players: [
{
id: Type.UInt,
x: Type.Float32,
y: Optional(Type.Float32),
angle: Optional(Type.Float32)
}
]
});
sockets.raw.emit(PositionsModel.encode(positionsPack)); It also supports Sanity checkYou may might just want to check whether the optional/delta compression you're attempting is worth the effort/overhead. WebRTC data channels packets already have 60-120 bytes of overhead (due to SCTP + DTLS + UDP + IP), so a few bytes here and there may not really make a meaningful impact in the end. Glenn Fiedler has some good advice around compression / delta encoding. See the various gafferongames techniques as examples. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, would it be possible to allow to ignore a value.
Here is an exemple :
For now, if i do that and unpack it to get the real data, the values that are "undefined" get a very little value such as 1.0446119532155781e-40 for exemple. Could it be possible to keep them as undefined on output?
Beta Was this translation helpful? Give feedback.
All reactions