I am making a game that has fast moving NPCs that attack the player. For responsiveness, I am already handling players hitting the NPCs on the client with sanity checks on the server to verify the hits are legitimate. However, what I cant wrap my head around is to also handle having NPCs generate attacks from the client without creating a massive vulnerability from exploiters.
An exploiter can simply disable attacks from all NPCs and therefore they would never reach the server. This is very different from when a player is requesting a hit on an NPC, then we can check the request and apply damage if it is valid.
I can of course have all NPC to player hits generated from the server, but the server does not always reliable know where the player actually is! Has anyone else ever tried to do this? I could use some pointers.
I can of course have all NPC to player hits generated from the server, but the server does not always reliable know where the player actually is! Has anyone else ever tried to do this? I could use some pointers.
You can get the player’s position by firing the server and putting the player’s position inside the parameters for the server firing.
yes, NPCs on map attack the player. Handling hitboxes on the client is my preferred method, with sanity checks on the server. This ensures a very smooth experience for the player even with rather high ping.
This works fine when a player is attacking, because they are REQUESTING to hit from the server after already visually seeing the results. If they request is legit, the server will apply damage and effects. If not then the initiating player sees the visuals but they have no effect. Likewise no other player would see it.
Now when we get to the NPCS attacking, the exploiter can cancel requests to hit, therefore never taking any damage. If we instead hit the player form the server, well the server is never very accurate on player position since the client is always the authority on player position.
Quite the conundrum really.
@SOA_hydra
this wont solve any ping issues anyway, since the server not knowing where the player is is a combination of low refresh rate and ping delay.
You can always check where the player / his character is at from the server ,
if you’d do so from the client, you should use a remote to update the server when the player’s character has moved, and then use that position.