Live for Speed - LFS Main Site
- LFS World
- LFS News
- LFS Manual
- LFS Merchandise
  http://www.lfsworld.net/

Go Back   Live for Speed > Main > LFS Programmer Forum

Reply
 
Thread Tools Search this Thread Display Modes
Old 5th May 2012, 23:04   #1  -   
Krammeh
S2 licensed
 
Krammeh's Avatar
 
Racername: [LTC] Krammeh!
Join Date: Mar 2007
Location: Lowestoft, UK
Posts: 1,043
Krammeh's online stats
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
Reply With Quote
Old 8th May 2012, 12:27   #2  -   
the_angry_angel
S2 licensed
 
the_angry_angel's Avatar
 
Join Date: Jun 2003
Location: UK
Posts: 5,704
the_angry_angel's online stats
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.

Last edited by the_angry_angel; 8th May 2012 at 13:01.
Reply With Quote
Old 8th May 2012, 15:47   #3  -   
sinanju
S2 licensed
 
sinanju's Avatar
 
Racername: [><]Sinanju
Join Date: May 2006
Location: Livingston
Posts: 1,120
sinanju's online stats
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?
Reply With Quote
Old 8th May 2012, 17:49   #4  -   
PoVo
S2 licensed
 
PoVo's Avatar
 
Racername: host
Join Date: Jun 2008
Location: Dublin, Ireland
Posts: 1,817
PoVo's online stats
Quote:
Originally Posted by sinanju View Post
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.
Reply With Quote
Old 9th May 2012, 03:43   #5  -   
Krammeh
S2 licensed
 
Krammeh's Avatar
 
Racername: [LTC] Krammeh!
Join Date: Mar 2007
Location: Lowestoft, UK
Posts: 1,043
Krammeh's online stats
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!
Reply With Quote
Old 9th May 2012, 08:18   #6  -   
the_angry_angel
S2 licensed
 
the_angry_angel's Avatar
 
Join Date: Jun 2003
Location: UK
Posts: 5,704
the_angry_angel's online stats
If you're using non-layout tracks the HVLC not suitable/good enough in combination with a speed check?
Reply With Quote
Old 9th May 2012, 08:38   #7  -   
Dygear
S2 licensed
 
Dygear's Avatar
 
Racername: (EAGLE)Dygear
Join Date: Feb 2005
Location: Levittown, NY.
Posts: 3,583
Dygear's online stats
Quote:
Originally Posted by Krammeh View Post
Shame there isn't a packet for that kinda of thing!
Is there something wrong with IS_HLV?
__________________
Paramedic & Programmer
LFSWorldSDK & PHPInSimMod
No help via MSN or PM
Reply With Quote
Old 9th May 2012, 12:01   #8  -   
Krammeh
S2 licensed
 
Krammeh's Avatar
 
Racername: [LTC] Krammeh!
Join Date: Mar 2007
Location: Lowestoft, UK
Posts: 1,043
Krammeh's online stats
Quote:
Originally Posted by Dygear View Post
Is there something wrong with IS_HLV?
Does the $Time continue to count up, the longer they're off for?
Reply With Quote
Old 10th May 2012, 08:05   #9  -   
Dygear
S2 licensed
 
Dygear's Avatar
 
Racername: (EAGLE)Dygear
Join Date: Feb 2005
Location: Levittown, NY.
Posts: 3,583
Dygear's online stats
It's fired only once they are off.

Anything else requires parsing of the PTH files to find how long they have been off.
__________________
Paramedic & Programmer
LFSWorldSDK & PHPInSimMod
No help via MSN or PM
Reply With Quote
Reply

  Live for Speed > Main > LFS Programmer Forum

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:47.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Live for Speed © 2002-2014 - Scawen Roberts, Eric Bailey, Victor van Vlaardingen