Got some problems with coming up with how the state replication mechanics should work in a "entity component system"-design.
I'm using the C++ port of artemis from vinova. No problems there, works great so far. For networking I'm using enet and I have a basic system up and going. I can send a "entity created with these components"-message, and the client creates a new entity which is identified by a unique ID(sent with the "entity created"-message).
All this is good, but the problem comes when I want to synchronize states across the network. How should I implement that on the server? Should there be a system that loops over and creates a packet for all the states that needs syncing? How should I implement this on the client?
My ideas so far;
Since the server only sends states for object close to client I am currently;
Loop over all entites:
1. Check with all players, is the entity close?
1a. If so, does it need syncing?
1b. Yes; send a packet with the new state.
If anyone have some tips, ideas, or could share how they solved this it would be great.