-
I am developing a multiplayer game that is intended to operate across multiple devices/browsers, as well as in a splitscreen mode within a single device/browser. For splitscreen, I am creating multiple engine instances (possibly related to #2622). Currently, I have to ignore the entity IDs, as they differ for each instance. However, even when running the engines in different browsers, it's possible for the IDs to diverge, for instance, when players navigate to different maps or trigger events in a different order. If the IDs were consistent across every instance, it would simplify data synchronization. At present, ExcaliburJS uses the following logic for IDs: class Entity {
private static _ID = 0;
/**
* The unique identifier for the entity
*/
public id: number = Entity._ID++;
// ...
} To ensure entities have consistent IDs across different ExcaliburJS instances, it seems necessary to set the IDs manually. I am currently considering the best way to implement this. Should I simply add a separate additional ID for each entity?. Or would it be worthwhile to modify ExcaliburJS to, for example, allow adding an ID generator method to the engine that entities would use to generate their ID if one is provided? Or should I perhaps solve this in a completely different way? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Or maybe I just use the name property for this 🤔 |
Beta Was this translation helpful? Give feedback.
Or maybe I just use the name property for this 🤔