The online racing simulator
Searching in All forums
(983 results)
Dygear
S3 licensed
It's hard to document what is not a finished product. Things change.

Is something like this ok for documentation? I am trying to follow the PHP Manual Syntax as much as possible.
Last edited by Dygear, .
Dygear
S3 licensed
Quote from Makao :I've started playing with PRISM and I admit this is amazing.

Wow, thank you! I was wondering if anything was going to happen with PRISM, as I've not posted an update in quite a while. Turns out that might of been the best thing for it, now with a stable API people are using it!

About the plugin, you could change your URL to 'http://www.lfsforum.net/showthread.php?t=76342' so that when the web interface is done, it will link to here, this thread so that people can get support for your plugin should they need it.
Dygear
S3 licensed
Quote from rockclan :Like a few times already, out of nowhere I've heard and felt very loud bangs, which caused the windows to shake, and everything.

Like the feeling and sound of a bomb exploding a few kilometers away.

But this happens quite often, like 3 times a week.

Anyone knows what could cause this?

Sonic Boom, if you have a military base in your area you'll hear it when they go faster then sound.
Dygear
S3 licensed
I've been getting hammer at work, and in life for the past month. I work as a Paramedic and I live in New York, on Long Island and we just had Hurricane Irene where we had to evacuate some hospitals and nursing homes so that was a week of hell. Then my good friend is the CCU in critical condition so I've been spending a few nights there.

But I'm sure this will work, I've just not had the chance to do this yet.

I was also reprogramming much of this PTH parser, because I wanted to provide much more power to it. So once that is released here, it should be quite a bit better to use, and make it quite a bit easier to handle.
Dygear
S3 licensed
Quote from E.Reiljans :That screenshot was totally worth a 5,248px × 4,032px picture.

Somebody get this man an S2 license!
Dygear
S3 licensed
Quote from DeadWolfBones :http://www.autosport.com/news/report.php/id/94357

I think that is pretty simple. There are no points awarded for what you do on a Saturday, so do what's best for Sunday.
Dygear
S3 licensed
Yeah, I think DRS going to be pretty worthless, the rear wing is TINY.
Dygear
S3 licensed
Quote from E.Reiljans :Publisher is the one who owns all rights to the game, not developer. See Activision v. Infinity Ward on Call of Duty case.

Really!? I seem to remember that suite too, I just did not remember that being the outcome.
Dygear
S3 licensed
If the dev is still around and only the publisher went bankrupt I still think this is not correct. Does SimBin distribute GTL or GTR2 at all?
Dygear
S3 licensed
Quote from T3charmy :Edit: Is there a PRISM function which will remove ^0 etc. from a string?

No, not directly, but there is a PHP one.


<?php 
str_replace
($search$replace$subject);
str_replace($needle$haystack$subject);

$Text str_replace('^0'''$Text);

$Text str_replace(
    array(
'^0'),
    array(
''),
    
$Text
);
?>

Dygear
S3 licensed
Ah, ok. About that error ...

You just happened to stumble upon something that myself and Victor tried really hard to hide. This is an issue with the PHP langauge on the Windows side. It only happens on Windows, no other OS is effected by this error. Simply because of the way Windows handles streams, it causes that error the spam the error console unless handled. As we handle that error in the main PRISM code, most users don't see it. As you are hooking directly into the PHP error handler you are seeing this message. It is unfortunately not something I can work around.

This is where we first found the bug, and reported it to the PHP bug list, and this is anyone one. So at this point, it's a fairly well known PHP bug, just one that PHP is not moving quickly to fix. When we started PHPInSimMod, we wanted to push the boundaries of PHP, and as we are starting to see some of it's cracks I think we have succeeded.
Last edited by Dygear, .
Dygear
S3 licensed
Well you are over writing the default handlers for error and shutdown, and I am not sure if you can send a packet after an error has happened within PHP as you are using a PHP resource. This might be causing the error you are having.

Second thing you might want to try is adding a return false to onPrismError at the very end. Also adding a echo statement to see if it ever get's there might also help.

Third you know you can do this right?


<?php 
IS_MTC
()->Sound(SND_ERROR)->UCID(255)->Text('Text')->Send();
?>


<?php 
    
public function onPrismError($eNo$eStr)
    {
        
IS_MTC()->Sound(SND_ERROR)->UCID(255)->Text("^1ERROR: ^7['{$eNo}'] {$eStr}")->Send();
        return 
FALSE;
    }
    public function 
onPrismClose()
    {
        
IS_MTC()->Sound(SND_ERROR)->UCID(255)->Text('^1FATAL ERROR. Restarting...')->Send();
        
Cruise::sqlSaveAll();
    }
    public function 
__construct()
    {
        
set_error_handler(array($this'onPrismError'));
        
register_shutdown_function(array($this'onPrismClose'));
    }
?>

Last edited by Dygear, .
Dygear
S3 licensed
I'm sorry but that's just stupid. Heidfeld, is at the end of the day an employee of Renault, and they can use him to bake cookies if they see fit. It does not matter as along as they pay him.
Dygear
S3 licensed
Quote from Glenn67 :I have a diesel 10kva genset on the farm and the manual recommends running it under at least 80% load for best efficiency and to maintain engine health so mybe it is true for diesel cars also?

Cool, thanks for the fact check, good to know there is something to it.
Dygear
S3 licensed
Quote from The Very End :Only visual, it does not affect the handling of the car

Just like LFS!?


(I kid, I kid.)
Dygear
S3 licensed
Quote from BigPeBe :Giving the engine some proper right foot once in a while will burn the soot out.

I've been told this is true of diesel engines, where if you take them on the motorway and run them flat out for a few miles it has the effect of 'cleaning out the headers', making it run better. I've heard this from many diesel mechanics.
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.
FGED GREDG RDFGDR GSFDG