User Tools

Site Tools


ipacketserializationservice

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
ipacketserializationservice [2026/08/15 07:16] – created divineripacketserializationservice [2026/08/15 07:23] (current) – diviner
Line 1: Line 1:
 ===== IPacketSerializationService ===== ===== IPacketSerializationService =====
  
-This service is responsible for serializing [[IEntity|Entities]] into [[EntityPacket|EntityPackets]] and applying EntityPacket data back onto existing Entities. Component state is serialized through the packet serialization strategy associated with each supported [[IComponent|Component]] type.+This service is responsible for serializing [[IEntity|Entities]] into [[EntityPacket|EntityPackets]] and applying EntityPacket data back onto existing Entities. Component state is serialized through the packet serialization strategy associated with each supported [[IComponent|Component]] type. Only Components that have a registered [[IPacketSerializationStrategy|serialization strategy]] are serialized; Components without a corresponding strategy are ignored and do not contribute data to the EntityPacket.
  
 Component packets may be serialized using either encoded packet identifiers or packet type names. Encoded packets reduce serialized size by replacing type names with numeric identifiers, but depend on the packet registration ordering remaining compatible between serialization and deserialization. Non-encoded packets use packet type names and are therefore more robust when packet types are added or changed. Component packets may be serialized using either encoded packet identifiers or packet type names. Encoded packets reduce serialized size by replacing type names with numeric identifiers, but depend on the packet registration ordering remaining compatible between serialization and deserialization. Non-encoded packets use packet type names and are therefore more robust when packet types are added or changed.
  
 === Methods === === Methods ===
-^Method | [[EntityPacket]] SerializeEntityPacket([[IEntity]] entity, bool encodeComponentPackets, params Type[] componentTypes) | +^Method | [[EntityPacket]] **SerializeEntityPacket**([[IEntity]] entity, bool encodeComponentPackets, params Type[] componentTypes) | 
-^Description | Serializes specified [[IEntity]] into an [[EntityPacket]]. If componentTypes are supplied, only supported Components matching those Types are serialized. If no component Types are supplied, all Components on the Entity that have a registered packet serialization strategy are serialized. The Entity's static data ID is stored in the packet, together with its identifier if it contains an [[IEntityIdentifierComponent]]; otherwise the packet identifier is set to zero. If encodeComponentPackets is true, Component packet types are stored using numeric identifiers instead of their type names. |+^Description | Serializes specified [[IEntity]] into an [[EntityPacket]]. If componentTypes are supplied, only supported Components matching those Types are considered for serialization. If no component Types are supplied, all Components on the Entity are considered. In either case, a Component is only serialized if a packet serialization strategy exists for its Type; Components without a serialization strategy are ignored. The Entity's static data ID is stored in the packet, together with its identifier if it contains an [[IEntityIdentifierComponent]]; otherwise the packet identifier is set to zero. If encodeComponentPackets is true, Component packet types are stored using numeric identifiers instead of their type names. |
  
-^Method | bool DeserializeEntityPacket([[EntityPacket]] entityPacket, [[IEntity]] entity, bool containsEncodedPackets) |+^Method | bool **DeserializeEntityPacket**([[EntityPacket]] entityPacket, [[IEntity]] entity, bool containsEncodedPackets) |
 ^Description | Deserializes the Component packets contained in specified [[EntityPacket]] onto specified [[IEntity]]. The containsEncodedPackets value must match the encoding mode used when the packet was serialized. Component packets whose packet type cannot be resolved or whose corresponding Component does not exist on the Entity are ignored. Returns false if a Component serialization strategy fails to deserialize its packet; otherwise returns true. An EntityPacket containing no Component packets is considered successfully deserialized. | ^Description | Deserializes the Component packets contained in specified [[EntityPacket]] onto specified [[IEntity]]. The containsEncodedPackets value must match the encoding mode used when the packet was serialized. Component packets whose packet type cannot be resolved or whose corresponding Component does not exist on the Entity are ignored. Returns false if a Component serialization strategy fails to deserialize its packet; otherwise returns true. An EntityPacket containing no Component packets is considered successfully deserialized. |
 +
ipacketserializationservice.1786778162.txt.gz · Last modified: by diviner

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki