[BUG] Raytrace failure on spheres

Started by EK.IceFlake, Sep 30, 2015, 12:32 PM

Previous topic - Next topic

EK.IceFlake

Description
Raytrace (CCD/continuous collision detection) wrongly marks a sphere enter when teleporting from a place to another through a sphere.

Reproducible
Always

What you were doing when the bug happened
Teleporting through a sphere in the VKs official server [don't try to check, its fixed by adjusting the positions]

What you think caused the bug
Raytrace not resetting on teleport

EK.IceFlake


.

Quote from: NE.CrystalBlue on Sep 30, 2015, 12:32 PMRaytrace (CCD/continuous collision detection) wrongly marks a sphere enter when teleporting from a place to another through a sphere.

I think you have no idea what you're talking about.

1'st I'm not even sure it uses CCD (even though it should/could). Depends where the calculations are performed. It might not be a good idea to have CCD on the server side.

2'nd Raytrace means having two points and calculating what object(s) was/were hit by the ray emitted from the start point to the end point. Therefore, what ray are you talking about when you simply have a sphere and you calculate whether a point is inside or outside?
.

EK.IceFlake

I do
1'st, from what happens, it does
2'nd, if the player leaves the sphere with lag, server can't get his pos at the right time in the sphere usually. So it performs a raytrace from the last known pos to the new pos and checks if it hits that sphere.

.

#4
Quote from: NE.CrystalBlue on Oct 01, 2015, 04:48 PM2'nd, if the player leaves the sphere with lag, server can't get his pos at the right time in the sphere usually. So it performs a raytrace from the last known pos to the new pos and checks if it hits that sphere.

That's not how CCD works. You take the position of your last scan and the current position You generate a ray and split that into multiple positions. Usually depending on your expected latency (ping) and therefore your server FPS.

If your server expects 30 frames per second that means you must have an average of 33ms (1000/30=33.3333...).
But let's assume that you have a latency of 300. Therefore the server can obtain your position once every 9 frames.
If you would in fact have CCD. You would take the previous position (for simplicity) 10,10,10 and your current position (for simplicity) 100,100,100
Now the server must generate a ray from the previous position and the current position and split that ray into 9 points to account for the 9 lost frames.
The points would be: 20,20,20 - 30,30,30 - 40,40,40 - 50,50,50 - 60,60,60 - 70,70,70 - 80,80,80 - 90,90,90 - 100,100,100 (last one for the current frame)
And for every one of those resulted points it would run a simulation for collision with spheres and see which point collided with what sphere.
That's called stepping. Imagine your step measures 1m and you simply cannot walk a bigger distance than that with a single step.
Now someone comes along and places a mark 9 meters away from you and asks you to reach there. Normally you would have to step 9 times to reach that point.
That's what CCD does (kinda). The smaller the step the bigger chance to catch the collision.
.

Thijn

Confirmed, the server would perform a raycheck and it goes nuts if you stand on the other side of the sphere and teleport to the other side. I would guess this was done in order to improve detection when inside a vehicle.

I'm not sure how bad this is, though. Or how easy it is to detect/fix.