I'm in the process of retrofitting a (souls-like 3d ARPG) project - whose core gameplay is primarily driven by MonoBehaviours - to use NetCode for Entities. So far I've not had any issues utilizing a IInputComponentData struct to send player inputs, passing the inputs along with the current Entity state through to a stateless MonoBehaviour and storing any results back in my Entity's transform.
However, I'm hitting a snag now that I'm trying to port my ability (attack action) handling into the NetCode Systems. When an InputAction event is raised on a player's client, I set an enum in my InputComponentData to indicate which input was just received, on the frame it was received, and attempt to execute the action on both client and Server. However, what I'm finding is that most times, the single-frame enum change doesn't propagate to the Server, and only my local client executes my attack while the Server continues to process the input stream as if the button was never pressed.
I think I can fix this issue by not clearing the requested action until a new InputAction event is received, and timestamping the most recent action in my IInputComponentData, but it's gotten me wondering if this is actually the correct approach for this... I can keep each player's Ghost in sync with the Server, but will other, non-owning clients see anything happen when the Server is handling an action? What actually gets sent downstream to non-owning clients by default? If I have a System for processing my MovementIntent : IInputComponentData that looks like this:
[UpdateInGroup(typeof(PredictedSimulationSystemGroup))]
[UpdateAfter(typeof(PlayerInputSystem))]
public partial class MovementSystem : SystemBase
{
protected override void OnUpdate()
{
foreach (var (intent, gameObjectLink, entityTf) in SystemAPI
.Query<RefRO<MovementIntent>, EntityGameObjectLink, RefRW<LocalTransform>>()
.WithAll<Simulate>())
{ // Process input, etc. }
}
}
Will non-owning Ghosts be updated by this System, or do I need to explicitly set up a Component for handling ability execution client-side and use [GhostField] to ensure its fields replicate?