The online racing simulator
InSim: Detect "Retired"
(9 posts, started )
InSim: Detect "Retired"
Is there a way to detect if a player goes off track and is set as "Retired"?

If so, HOW!!! :P (please?
if not, can there be? :P
Assuming you want it to work on layouts as well as "proper" tracks you could do it a couple of different ways. The two that immediately spring to my mind are as follows. There are probably more.

The simplest would be to probably consider the track as 2 2D overlapping polygons. One that has the bounding edge of the "outside" of the track. The second is the "inner" edge. You then just use a point-in-polygon algorithm to determine if its outside of the first polygon then it's off the track on the "outside". If it's inside the second polygon then it's off track, on the "inside". Edit: The problem with this is that it sucks at tracks with overlapping sections

An alternative would be to consider the track as a single path (Edit: Path not polygon), using the center or racing line as the path, and knowing the distance from each point to the 2 (Edit: or 4 if you wanted up, down, left and right of the path) edges of the track. At the start of the race/at load/whatever build and balance a tree structure using the path coordinates to minimize the number of points you need to search each time. Everytime you want to check you use the tree to get the closest point on the path, then calculate the direction and distance to the path point from the players current position. You then know if its on or off track from the direction and distance. A little harder, probably more work to maintain, but may be potentially quicker to do every second. Edit: The benefit is that you get 3 dimensions and it should work properly for overlapping tracks.

I'll update if I think of anything better.
Would it not be better to do on a time basis (if car doesn't move for x seconds then they are considered as retired) just in case someone parks on track but where the retiree might consider safe as its off the normal racing line - like a long straight or entrance/exit of an unused pit?
#4 - PoVo
Quote from sinanju :Would it not be better to do on a time basis (if car doesn't move for x seconds then they are considered as retired) just in case someone parks on track but where the retiree might consider safe as its off the normal racing line - like a long straight or entrance/exit of an unused pit?

Considering the fact that it will be used for his cruise server (AFAIK) it won't work, as people do indeed stop to park Also it's unreliable as someone may have crashed and are unable to move.
Nah, for the race server im working on . I thought about reading the PTH files.

Shame there isn't a packet for that kinda of thing!
If you're using non-layout tracks the HVLC not suitable/good enough in combination with a speed check?
Quote from Dygear :Is there something wrong with IS_HLV?

Does the $Time continue to count up, the longer they're off for?
It's fired only once they are off.

Anything else requires parsing of the PTH files to find how long they have been off.

InSim: Detect "Retired"
(9 posts, started )