What I need is to be able to create objects/components and assign them unique IDs in both the server and clients, at the same time (so, client-side prediction), and given that objects are created on multiple worker threads (order of creation is not deterministic) in such a way that the server and clients all agree on this ID.
I want to use the ID to sync the object/component data from the server to the clients, so clearly when a new object is created they all need to (independently) come up with the same ID. But, the fact that these objects are created on multiple threads complicates things, since I cant rely on them being created in any order even within a single frame update.
How is this situation normally handled in existing games? Any ideas on how I can do this? Is there a way that doesnt rely on object IDs at all?
Thanks in advance.