Identifying Entities Across Worlds (Networking)
See original GitHub issueBackground
Creating multiplayer games is tough with artemis-odb. It’s hard to synchronize two systems. I’ve read an issue #103 of @DaanVanYperen who discussed creating a co-op multiplayer game example, but wasn’t able to find said example.
In that thread, @junkdog mentioned ‘slave-worlds’ and ‘nested-worlds’ but I couldn’t find any documentation with those keywords and didn’t really know what he meant.
Global Entity Identification
I hope to identify entities globally (across worlds) using the following simple structure:
Server -> “master world” assigns entityIDs
Client -> “slave world” uses IdEntityManager
(similar to UuidEntityManager
)
This way, entities are identified using the master world’s entityID assignment.
Can anyone foresee any complications in this setup? Would you agree that this is simpler than having a custom EntityManager
& World
?
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (6 by maintainers)
Top GitHub Comments
Okay so this was what I went with, and it turned out just fine:
On the server, there was a
World
object, which created entities by itself. On the client, there was aWorld
object, which created entities by itself and also assigned the entity another ID - a “server id” using anIdEntityManager
.Here’s the
IdEntityManager
that I used on the client which helped me attach another id to an entity. It’s just a manager (which are now systems), so add it and use it as you would any other System!Hope this helps.
My reasoning for not using UuidEntityManager was that it was too expensive (in terms of bandwidth over a network) to send a whole Java UUID (something like d5628473-e293-4288-8db4-80fc1e5a349e).
This may be feasible for your situation, but my application required sending many packets per second, so I was very bitter about ever bit 😉