You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// serverconstserverWorld=createWorld()// message componentsconstNetworkMessage={}constIdentityMessage={entityId: []}// id msg setterobserve(serverWorld,onSet(IdentityMessage),(msgEid,value)=>{IdentityMessage.entityId[msgEid]=value})// msgs serialzierconstserializeNetworkMessages=createObserverSerializer(serverWorld,NetworkMessage,[IdentityMessage, ...otherMessageTypes])// new player comes inconstnewPlayer=addEntity(serverWorld)// Add a new msgconstmsg=addEntity(serverWorld)addComponent(serverWorld,msg,NetworkMessage)addComponent(serverWorld,msg,set(IdentityMessage,newPlayer))constserializedData=serializeNetworkMessages();// Remove the msgremoveEntity(serverWorld,msg);
// clientconstclientWorld=createWorld()constdeserializeEvents=createObserverDeserializer(clientWorld,NetworkMessage,[IdentityMessage])// Deserialize the events into clientWorlddeserializeEvents(clientWorld,serializedData)// Process Identity Messagefor(consteidofquery(world,[NetworkMessage,IdentityMessage])){constmyEntity=IdentityMessage.entityId[eid]// process msg, then removeremoveEntity(clientWorld,eid)}
The text was updated successfully, but these errors were encountered:
Our implementation will be based on bitECS v0.4's https://github.com/NateTheGreatt/bitECS/tree/rc-0-4-0/src/serialization
The text was updated successfully, but these errors were encountered: