Firearm System - Server Hit Validation Problem

Hello,
So, with what I’m currently having an issue is hit validation on server. So let me explain how it works first:


  1. Client. Hitscan (aka FastCast Redux) simulates bullet fly. Bullet loosing it’s speed and fall after some time. || If hitted character - sending an event with registration data (weapon itself, what hitted, where fired the weapon, hit position, hit normal).
  2. Server. Received the registration data, checking if weapon is nil. || If everything is alright, Server trying to simulate hit with raycast; from the start (where weapon fired) to the end (to the hitted limb). If everything is alright - continue, else stop.

During the playtest with my friends, we noticed that sometimes bullets don’t registrate damage, but the blood spills were appearing - the sign that Hitscan actually did hit, so the problem is on the end.

But I can’t understand one: how does it not registrates, if bullet shall trail nearly 300-500 studs (for CQC map it’s an impossible number), to actually start fall. So basically, something wrong with the raycast check on the server.


The Main Question

How to actually make normal, at least rarely false-positive raycast hit checker?

Any help would be appreciated :tangerine:

:penguin:

1 Like

if you are doing blood spills on client, then my guess is it depends on client raycast, and by the time the server is reraycasting, the hitter has already moved from servers perspective

Good point.

But I have one card that I forgot to take out, chrono.

Chrono shall supply better replication, but I think it doesn’t help in this situation.

it can, but that puts more pressure on server if ur also raycasting on server, since current character replication is at 1/20 client > server > all clients, you could up the replication rate with custom character replication

Didn’t really get it, I have bad English probably…

This is how currently character ownership work in order

  1. Input, you hold / press and key like W, A, S, D, and it sets character velocity based on keys
  2. Gravity. gravity is constantly being applied to characters velocity (ex: character.velocity += gravity)
  3. Position is updated (Position += velocity)
  4. Collisions, it resolves all collisions, corrects position if needed
  5. Send new position to server at 1/20 rate, server without authorization replicates it to every player at same fixed rate
  6. Rendering, now you render the final position the client has simulated, you move the player model at the new position

take a look at this

Based off what I understand everything with the bullet itself is fine (physics and such) but actually registering the damage is the problem.

To solve this problem I would look in the script for exactly where:

  • Blood spill is created
  • Damage is inflicted

I’m not sure how your script is structured but Im assuming they could be right after each other, if you had a snippet it would give me more insight.

My Advice: Try printing the data sent by the event, the only way I see damage not being inflicted is how you said the SERVER script checks

“if weapon is nil”

Try testing again and see if the issue replicates by shooting and quickly unequipping your weapon

LMK if I’m understanding correctly its been a while lol

Tested with friend, it’s all good now.
Thank ya :face_savoring_food:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.