How to get all components attached to an entityid

Actually I use a unreal like replication, from server to client, while the client is allowed to use clientside entitys at any time. Eg the keyBindStates of a player are a component that is replicated in the other direction and server read only.

What I do is a sourcecode scanning that generates me a Registry class with all components networkedcompoentes ect listed in simple arrays. Upon initializing the es it has all information available then without further scans. (As I kinda dislike runtime based autowireing, due to its hard to debug stuff)

Another system working like this is my persitence logic. As the ES is pure memory based, I have Persitence module, that scans for entites with SavaNow component, makes a snapshot of them and then writes them with all savealbe components out in the background. (The Idea behind this is to quickle by able to change the save implementation.) Eg my current project uses a Postgresql database, but If I would do a singleplayer platformer I might instead just use java serialization.

@Empire Phoenix said: Actually I use a unreal like replication, from server to client, while the client is allowed to use clientside entitys at any time. Eg the keyBindStates of a player are a component that is replicated in the other direction and server read only.

What I do is a sourcecode scanning that generates me a Registry class with all components networkedcompoentes ect listed in simple arrays. Upon initializing the es it has all information available then without further scans. (As I kinda dislike runtime based autowireing, due to its hard to debug stuff)

Another system working like this is my persitence logic. As the ES is pure memory based, I have Persitence module, that scans for entites with SavaNow component, makes a snapshot of them and then writes them with all savealbe components out in the background. (The Idea behind this is to quickle by able to change the save implementation.) Eg my current project uses a Postgresql database, but If I would do a singleplayer platformer I might instead just use java serialization.

Yeah, Zay-ES prefers to inject itself into the process directly. The idea of a “persistent component” is core and EntityData implementations can choose to do what they want with it. So for a database based persistence, it gets direct access to the components because it is the manager of those components. A different persistence scheme could simply keep track of the handlers for all of the used PersistentComponents and provide access for getting them all. Or if wants to save as it goes (without using the existing persistence model or implementation) then it could register a listener. Or do both for some reason.

More curiosity than anything else, but why does your server need to know key bindings?

Edit: and note, I’m not trying to change your mind on how you did yours. It is also a valid approach. I’m just making sure people reading about Zay-ES don’t think these things are impossible because I didn’t answer or something.

Well I do all logic after long decision about cheat security on the server by now.

The network client Entity gets all keybindstates from the clients.
Then for example a car can have a controlledby component pointing to that player, wich makes the vehicledrivesystem actually modifiyng/applying changes to the raycastvehicle. Clientside I plan to add a prediction later for humanoid players. For a vehicle a delay of 50-100ms is not noticable as we expect it to have a slight delay due to inertia.

A similar system does exist for turning /analog/mouse movements.

Don’t get me wrong, I think I know why you made the decision the way you do, and I think I made my current desing implications with fully kowing the implications.I just wanted to show possible use cases for getting all components from an entity. (If there are other or better solutions in your es I can of course not determine exactly :wink:

@Empire Phoenix said: Well I do all logic after long decision about cheat security on the server by now.

Yes, I do too… but the server doesn’t care about the key bindings because the ‘key’ has already been abstracted into the common function by then. I send it as part of a control/input state that already understands what that means.

It’s cheating that is a main reason my ES is read only on the client. All manipulation of components is done on the server as a result of actions that aren’t ES-related.