In the samples it seems that the CommandTargetComponent is usually set to the player entity.
However I feel like the obvious choice for the target should be the connection entity itself…
Clearly it’s designed to not be attached to the connection entity, just looking for the reason why?
After thinking about it a little is it just technical?
i.e. the connection entity isn’t a ghost so can’t hold the ICommandData?
I think this makes sense but would appreciate clarification from someone who actually knows
You can store the ICommandData on the connection entity if you want to and it fits your game logic, but you don’t have to.
Some reasons why you would not want to store it on the connection entity:
It makes the code in the prediction group using the inputs harder since it needs to access both the character entity and the connection entity.
You want to predict remote players, when doing so the remote players need to send their inputs, and that requires the entity the inputs are stored on to be a ghost.
You can control different entities which have different commands (switching between a character or a vehicle for example). There are some issues with doing this in the current version but the goal is that it should be possible in the future.
In most of our samples the primary reason is the first one, our Entities.ForEach is over the players / characters and there is no easy way to get the connection entity from that.