GarageGames / Torque3D

MIT Licensed Open Source version of Torque 3D from GarageGames
http://torque3d.org
MIT License
3.35k stars 1.2k forks source link

Projectiles client collision issue? #2227

Closed petrifiedroadkill closed 6 years ago

petrifiedroadkill commented 6 years ago

Projectiles will sometimes hit and explode on ones client, when others see it fly by.

This is my temporary fix, tho i do not know enough if this would even be considered proper fix. if (isServerObject()){ onCollision(rInfo.point, rInfo.normal, rInfo.object); // Next order of business: do we explode on this hit? if (mCurrTick > mDataBlock->armingDelay || mDataBlock->armingDelay == 0) { mCurrVelocity = Point3F::Zero; explode(rInfo.point, rInfo.normal, objectType); } }

Areloch commented 6 years ago

Any case you see it happen fairly reliably on? Like when shooting certain object types, or anything like that?

petrifiedroadkill commented 6 years ago

I only see it with player on player fights, when both players are moving. The one client it will look like a direct hit and for the other a near miss. There may be other factors at play, but id say 15%-25% of the time a shot will falsely show a hit. I should also mention my projectile speeds are on the slower side like 90 - 150;

chaigler commented 6 years ago

I believe this is what we called a "nonreg" in Tribes & Tribes 2. Was basically a side effect of clients interpolating player and projectile positions between server updates. Depending on the interpolate settings (and packet rate, size, etc.) the clientside sim could differ from the real/serverside sim by several hundred milliseconds. You'd see a "nonreg" when your game registered a collision between another player and a projectile but no damage would be done because the collision never happened on the server. Depending on how accurate/up to date other player's sims were, they may not see the collision either.

Tribes players eventually figured out how to change the interpolate setting and disable clientside interpolation completely. This resulted in more accurate rendering of player positions but also jumpy players (entity positions would 'warp' from point to point on each update from the server).

It's been a while since I looked at this in Torque but I believe the Player and Projectile classes have something like sMinWarpTicks that can be adjusted to achieve something similar. You also want to increase your packetRateToClient and packetRateToServer rates as well.

petrifiedroadkill commented 6 years ago

Yeah, i forgot all about those settings... after messing around with them it seems to have fixed the problem thanks.