Terasology / MasterOfOreon

Master the Oreons, or others like them, from the throne-world of the Ancients! A menu command system.
3 stars 12 forks source link

No replication over the server for various component fields #18

Closed Naman-sopho closed 6 years ago

Naman-sopho commented 6 years ago

Due to the absence of implemented TypeHandlers for data types like Queue<EntityRef>, List<EntityRef>etc. the replication of various fields does not take place over the network and thus many crucial systems in MOO do not work as intended in multiplayer. Another side effect of this is no persistence of these across saved game, so all added availableTasks(a Queue) would not be carried forward if you open a saved game. This engine PR addresses this issue . Known component fields with issue :

eviltak commented 6 years ago

Unless your replication/persistence system uses Gson for serialization, MovingBlocks/Terasology#3403 will not solve your problem. Since these queues are being used in a Component which uses default Terasology replication and persistence, you will have to create a custom TypeHandler for Queue and make sure TypeSerializationLibrary.getHandlerFor returns an instance of that type handler when a Queue type is passed to it.

Since Queue is a Collection, the QueueTypeHandler implementation will be more or less equivalent to existing Collection type handlers like SetTypeHandler or ListTypeHandler.

Note that a ListTypeHandler already exists in the engine, so List<EntityRef> instances should be correctly serialized.