Hello everyone,
Iam currently trying to implement an ability System using entities with netcode for entities.
Because of the GhostLimit of 256, it is a bad idea to use a Ghostcomponent/Entity for every Ability per client.
So Iam trying to have less ability components. Also the bandwidth might become a problem at some point.
I cant decide which method I should use to synchronize the activation of an ability between client and server (and other clients).
Currently Iam using RPCs, because they are "one-shot", reliable and the method I have used in netcode for gameobjects.
Or should I use Ghost snapshots or commands?
Currently it works with RPCs like this:
- Client presses button for ability
2.Ability gets executed on client while the RPC (direction, rotation, abilityId,...) for the ability gets send to the server - Host/Server receives ability and checks for conditions (is player allowed to execute ability, does the ability exists....)
- Host/Server than executes ability (spawns non ghost entity) while sending out a broadcast to every client to inform about the executed ability
- Other clients receive the RPC and also execute it
I also thought about using IInputComponentData, but I feel it might need RPCs and IInputComponentData. Like so:
- The client presses the ability button, which gathers the input data for the ability.
- The input data is stored in an instance of IInputComponentData.
- The client sends the input data to the server using the Command pattern.
- The server receives the input data and checks the ability conditions.
- If the conditions are met, the server executes the ability logic and updates the game state.
- The server sends an RPC to all clients to notify them of the changes in the game state.
- The clients receive the RPC and update their local game state accordingly.
What would be the correct approach to implement an efficent ability system using netcode for entities?
Thanks for any input.
-Manu