Networking protocol and utilities for Javelin ECS.
Define schema using specialized data types.
const Body = {
collisionMask: uint8,
position: {
x: float64,
y: float64,
},
}
Serialize ECS operations and data into ArrayBuffer
s for transport from server->client.
const producer = createMessageProducer()
producer.attach(entity, body)
producer.detach(entity, spectate)
socket.send(producer.take())
Deserialize and apply messages on the client.
const handler = createMessageHandler()
world.addSystem(handler.system)
socket.on("message", event => handler.push(event.data))
Read the networking docs to get started.