The online racing simulator
Searching in All forums
(981 results)
Dygear
S3 licensed
Wow, these are stunning!
Dygear
S3 licensed
Cool, I needed some brakes for my car, but I think I'm going to do an all 'round setup. Do Brembo Brakes deal ship to the US? (They should seeing as they are american brakes.)

[Edit] UK shipping only, crap.
Last edited by Dygear, .
Dygear
S3 licensed
So at the end of the day, it does not matter what order I feed the points into the function.
Dygear
S3 licensed
As I get deep and deeper into this, I'm seeing some of the power, and some of the problems with this setup. First off the problems. Where as I can provide it with a set of points, do I have to provide the inside edge first, then the outside?Should I make sure that I supply the left side of the road, then the right side should it be the other way around when the track is in reverse? Does any of this matter really?

The power of it really comes from the fact that no matter what layout is loaded, the forward or the reverse, I will be able to tell if they are on the track or not no matter the direction of the client. This becomes pretty important for the open track types should someone want to support them in the future. I don't have any plans right now of supporting unofficial tracks, however it should be pretty easy for someone else to make their own nodes should they need too using a path making plugin for PRISM.

On that subject, because I'm supporting making paths within PRISM, should someone need to for what ever reason. I'm going to be doing quite a large update to the PTH module, that will allow it to both read and write pth files. I'm also making it much more OOP, where everything within the object is an object. This mean that you can do $PTH->Nodes[$NodeID]->Limit->Left->toPoint(); or $PTH->roadToPoly(); This should provide for a pretty powerful syntax that is simply not seen within the LFS tool chest.
Last edited by Dygear, .
Dygear
S3 licensed
Quote from avetere :but the entire track, which with your function should not be any problem ... all you'd have to check was if the car is within the polygon set by the outer boundary but not that set by the inner boundary.

Funny you should say that, as that's what I am attempting right now!
Dygear
S3 licensed

<?php 
php
/*# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # *
#                                                                           #
#    This file contains a PHP adaptation of code (imagemap.c) originally    #
#         written by Brian J. Fox ([email protected]) for MetaHTML 5.01          #
#                                                                           #
#                   http://directory.fsf.org/GNU/metahtml.html              #
#                                                                           #
#    Draw a horizontal line from $X, $Y extending inf in the positive       #
#    X-axis. Count the number of times that line crosses the lines created  #
#    by connecting adjacent vertices of the polygon. If that number is      #
#    even, then $X, $Y is "outside" of the polygon, if odd, then "inside".  #
* # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #*/
class Point
{
    public 
$x;
    public 
$y;
};
function 
inPoly ($X$Y, array $points)
{
    
$min_x $max_x $min_y $max_y NULL;
    
    
# Count vertices
    
$vertices count($points);

    
# Close the polygon if it isn't already closed.
    
$i $vertices 1;
    if ((
$points[$i]->!= $points[0]->x) OR ($points[$i]->!= $points[0]->y))
    {
        ++
$i;
        ++
$vertices;
        
$points[$i] = new Point;
        
$points[$i]->$points[0]->x;
        
$points[$i]->$points[0]->y;
        
$points[$i 1] = NULL;
    }

    
# Now check to see if the point falls within the rectangle which encloses the entire polygon.
    # If not, it certainly isn't inside.
    
for ($i 0$points[$i] != NULL; ++$i)
    {
        
$min_x = (($min_x === NULL) OR ($points[$i]->$min_x)) ? $points[$i]->$min_x;
        
$min_y = (($min_y === NULL) OR ($points[$i]->$min_y)) ? $points[$i]->$min_y;
        
$max_x = (($max_x === NULL) OR ($points[$i]->$max_x)) ? $points[$i]->$max_x;
        
$max_y = (($max_y === NULL) OR ($points[$i]->$max_y)) ? $points[$i]->$max_y;
    }

    
# Is $X, $Y within the rectangle defined by $min_x, $max_y, $max_x, $min_y?
    
if (($X $min_x) OR ($X $max_x) OR ($Y $min_y) OR ($Y $max_y))
        return 
FALSE;

    
# The point falls within the polygon. Check adjacent vertices.
    
$lines_crossed 0;
    for (
$i 1$points[$i] != NULL; ++$i)
    {
        
$p1 =& $points[$i 1];
        
$p2 =& $points[$i];

        
$min_x min ($p1->x$p2->x);
        
$max_x max ($p1->x$p2->x);
        
$min_y min ($p1->y$p2->y);
        
$max_y max ($p1->y$p2->y);

        
# We need to know if the point falls within the rectangle defined by the maximum vertices of the vector.
        
if (($X $min_x) OR ($X $max_x) OR ($Y $min_y) OR ($Y $max_y))
        {
            
# Not within the rectangle. Great!
            # If it is to the left of the rectangle and in between the $Y then it crosses the line.
            
if (($X $min_x) AND ($Y $min_y) AND ($Y $max_y))
                ++
$lines_crossed;
            continue;
        }

        
# Find the intersection of the line -inf $Y, +inf, $Y] and $p1-x, $p1-y, $p2-x, $p2-y].
        # If the location of the intercept is to the right of $X, then the line will be crossed.
        
$slope = ($p1->$p2->y) / ($p1->$p2->x);
    
        if (((
$Y - ($p1->- ($slope $p1->x))) / $slope) >= $X)
            ++
$lines_crossed;
    }

    return (
$lines_crossed 1) ? TRUE FALSE;
}
?>

When I was talking to filur about this, quite a few years ago now, I think in around 2006, we decided that we where going to close the polygon ourselfs. I forgot about this, and so I did not do it in my last code update. I don't really expect for anyone else using this function to also have to worry about closing the polygon, so I found the basis of the Source that me and filur used and for this function and re did it in PHP again. This should provide us with a good answer providing that I take the node & node + 1 from the current cars position like you said to check if they are on the track.
Last edited by Dygear, .
Dygear
S3 licensed
Error is due to the inPoly function, going to fix it tonight.
Dygear
S3 licensed
Yeah, that did not work. If you download this version of PRISM from here and then download the LVS patch file from this thread, you'll have all of the information I have to see what I am doing.

Just extract to the same location, the PRISM file first then the LVS patch, and you'll have everything I have up until this point.

Important locations:
  • $PRISMDIR/data/pth/* - Has all of the pth files that I'm using.
  • $PRISMDIR/modules/prism_plugins.php - Line 449 is the start of the inPoly function.
  • $PRISMDIR/modules/prism_pth.php - Is the PTH file parser.
  • $PRISMDIR/plugins/LVS.php - Is the Lap Verification System Plugin, you'll need to activate this plugin to see what I am doing.
Last edited by Dygear, .
Dygear
S3 licensed
Yeah, had a feeling. I'm heading home now (Girlfriend is driving) so I'll make the changes to the source code and see how it works after I've had something to eat.
Dygear
S3 licensed
I'm doing it straight from the MCI packets, and from the PTH file.
Dygear
S3 licensed
Quote from avetere :Well, didn't mean to harm you ... I guess the directness is merely a lack of speech

No harm inflected, I found it quite amusing.
Dygear
S3 licensed
Quote from avetere :Here you can easily see, that Your approach must be wrong.

You see, this is why I love Germans. They are just so direct! Thank you, avetere, I'll take a closer look at your approach.


<?php 
    
public function toPolyLimit()
    {
        return array
        (
            array
            (
                
'x' => $this->Center->$this->Limit->Left cos(atan2($this->Direction->X$this->Direction->Y)),
                
'y' => $this->Center->$this->Limit->Left sin(atan2($this->Direction->X$this->Direction->Y))
            ), array
            (
                
'x' => $this->Center->$this->Limit->Right cos(atan2($this->Direction->X$this->Direction->Y)),
                
'y' => $this->Center->$this->Limit->Right sin(atan2($this->Direction->X$this->Direction->Y))
            )
        );
    }
    public function 
toPolyRoad()
    {
        return array
        (
            array
            (
                
'x' => $this->Center->$this->Road->Left cos(atan2($this->Direction->X$this->Direction->Y)),
                
'y' => $this->Center->$this->Road->Left sin(atan2($this->Direction->X$this->Direction->Y))
            ), array
            (
                
'x' => $this->Center->$this->Road->Right cos(atan2($this->Direction->X$this->Direction->Y)),
                
'y' => $this->Center->$this->Road->Right sin(atan2($this->Direction->X$this->Direction->Y))
            )
        );
    }
?>

I guess I'll commit this later on today to github for testing.
Last edited by Dygear, .
Dygear
S3 licensed
Quote from avetere :If I'm not completely mistaken you'd have to multiply your Limit and Road values with:

Ok, if you could explain this part to me. Should it not be that the Road and Limit would be giving me the delta from that of the center of the node's X & Y? There by all I should have to do is add them to the X & Y coords to get the information I need. Or am I missing some bit of information.
Dygear
S3 licensed
I'm working a something for LVS. I'm just not getting all of the parts down in my head and it's confusing me a little bit.

So, let's think it out ... We need to know if the player is in node's polygon. To do this we need to get each node's polygon, and to do that we need to load the pth file. So we are going to need to know what track we are on, for this we are going to have to hook into the State packet (IS_STA). We are also going to need to have the pth files some where that is known. (I've made it so that they are stored in $PRISM/data/pth.


<?php 
public function onTrackChange(IS_STA $STA)
{
    
$this->PTH = new PTH(ROOTDIR '/data/pth/' $STA->Track '.pth');
}
?>

Now that we have that down, we need to know the Node the player is currently in, as well as the player's X & Y coords. For this we can only hook into the MCI packet, as it is the only packet that offers this level of detail.


<?php 
public function onMultiCarInfo(IS_MCI $MCI)
{
    foreach (
$MCI->Info as $Info)
    {
        if (
$this->isInPoly($Info->X$Info->Y$this->PTH->Nodes[$Info->Node]->toPolyRoad())
            continue; 
# They are within the node.
        # If we get here, then they are NOT on the track.
    
}
}
?>

I am going to update the toPolyRoad() function to the Node class within the PTH module so that the code really is as simple as that.

Speaking of those changes to the Node class, here they are.


<?php 
    
public function toPolyLimit()
    {
        return array
        (
            array
            (
                
'x' => $this->Center->$this->Limit->Left,
                
'y' => $this->Center->$this->Limit->Left
            
), array
            (
                
'x' => $this->Cetner->$this->Limit->Right,
                
'y' => $this->Cetner->$this->Limit->Right
            
)
        );
    }
    public function 
toPolyRoad()
    {
        return array
        (
            array
            (
                
'x' => $this->Center->$this->Road->Left,
                
'y' => $this->Center->$this->Road->Left
            
), array
            (
                
'x' => $this->Cetner->$this->Road->Right,
                
'y' => $this->Cetner->$this->Road->Right
            
)
        );
    }
?>

Couple this with the lfs provided PTH files found on lfs.net and extract them to your $PRISM/data/pth directory and you'll be all set to go with these.

This is providing that I'm not completely out of my mind, as all of this is very much untested.
Last edited by Dygear, .
Dygear
S3 licensed
I tend to shy away from adding a property that does not belong there, but I agree that the information should be more flexible. I think in the case you described, there will be a proper fix for it in 2.0.0 as you can say how you want the data given to you.
Dygear
S3 licensed
Quote from spiderbait90 :Well, if you don't have sky, you may be loosing Martin completely. There has been some suggestion that Sky have offered him a contract to join their Formula 1 commentary team. Combined with that, Martin has said on his twitter account that he has to look at all of his possible options for 'work'. If sky are offering him a significant amount of money, to cover all of the races, then I do not see why Martin would not move to Sky. Prior to the Sky deal he would have been going to all of the races anyway, so it isn't like there would be significantly increased traveling.

If they happen to also take the whole BBC gang with them, minus Eddie, I'll be quite happy.
Dygear
S3 licensed
BTW, 0.3.0 works with the official 0.4.2 build of PRISM, so you can see what I have been up too.
Dygear
S3 licensed
Quote from three_jump :Is it intentional that the first post links to 1.9.3 instead to the more current 1.9.7 of the SDK?

Nope, over sight on my part. Thanks, going to fix this now.
Dygear
S3 licensed
I'm just pissed because they are messing with the best thing in years. We have it on the BBC, so there are no commercials, we have Martin Brundle and David Coulthard, arguably the best duo since Murry and Martin. More then anything, we are losing Martin and David for half the season, and I just don't know why they felt the need to do this. Just when it get's to be great, they have ruin it.
PHPInSimMod - PRISM 0.4.2 Discussion
Dygear
S3 licensed
You can download PHPInSimMod - PRISM 0.4.2 from that link. Please use this thread to talk about this release.

Thank you.

PHPInSimMod (PRISM) 0.4.2
  • Version changed to 0.4.2
  • Added timeToString & timeToStr functions.
  • Changes to this file allow for the `prism exit` command be used to restart, it also will automaticly restart PRISM in the event of a crash.
  • Fixed an error where the Player class functions would check Flags and not the correct PType property.
  • Removed module prism_state, as it was no longer used by any part of prism. Everything has already been moved over to the current State Handler.
  • Updated CRON to reflect up coming changes (Thanks filur).
  • Updated to current version of LVS.
PHPInSimMod (PRISM) 0.4.2
Dygear
S3 licensed
PHPInSimMod (PRISM) 0.4.2
  • Version changed to 0.4.2
  • Added timeToString & timeToStr functions.
  • Changes to this file allow for the `prism exit` command be used to restart, it also will automaticly restart PRISM in the event of a crash.
  • Fixed an error where the Player class functions would check Flags and not the correct PType property.
  • Removed module prism_state, as it was no longer used by any part of prism. Everything has already been moved over to the current State Handler.
  • Updated CRON to reflect up coming changes (Thanks filur).
  • Updated to current version of LVS.
Dygear
S3 licensed
0.3.0
  • Now supports single player races as well.
  • Removed a lot of code that was not needed right now.
  • File format is now UTF-8 to support the delta (Δ) character.
Dygear
S3 licensed
Ok, sorry, I'm just a little confused without the context on why you would want these.
Dygear
S3 licensed
S2Y version SMX meshes and PTH files, includes all but the AS7 and AS7R Paths. Are you ALSO looking for the older versions of the paths so that you can see what was updated between versions if anything?

@Victor & Scawen, you're missing the AS7 and AS7R path files from the SMX_PTH_S2Y zip, can you please advise.
Dygear
S3 licensed
Quote from Krammeh :cfg file backup or editing?

Manual input into the config file that was not sanitized by the LFS game name parser?

[edit] Oh never mind, apparently Krammeth beat me to it.
FGED GREDG RDFGDR GSFDG