The online racing simulator
Searching in All forums
(235 results)
yankman
S2 licensed
It depends, at first it does matter how you generate the pngs.
With gd, which is not the fastest but very reliable, the function imagepng can be used to write the image to a certain location.
Second is you can get the get request with superglobal array $_GET.
So http://www.funracingleague.com/userbars.php?lfsname=makakazo
can be retrieved via $_GET['lfsname'], but be sure to strip any tags and quote it for use in database statements.

To pump a file from disk to the browser u can use readfile.
Send the header for the png first to inform the browser of the data type eg. header('Content-type: image/png');.
Thats basically it.

A better solution however would be the use of mod_rewrite.
It depends on the host if it is available.
With mod_rewrite you can rewrite requests to the webserver via regular expressions.

A .htaccess for your problem should be a in a seperate folder and look like this.

RewriteEngine On
RewriteRule ^(.*)\.png$ userbar.php?lfsname=$1

This would call userbar.php everytime a png is requested. This way userbar.php can directly choose between generating a new png or deliver an already generated one.

The fastest solution from my experience would be somethink like this.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.png$ userbar.php?lfsname=$1

It says if the requested file is there deliver it to the browser, if not call the script to generate and deliver it.
Now a second script can be run via cron at a certian interval to delete the already generated ones, forcing the generation of new pngs.
yankman
S2 licensed
Quote from Dygear :I think we need a HTML version of the InSim.txt that will link the structs possible member values to it's enum. Something along the lines of the attachment, as it would be nice to have an offline version as well. The Wiki could also use this level of referencing it's self.

Very nice and not only usefull for beginners.
I will have a look at some doc-generators if it can improved further (e.g. index).
yankman
S2 licensed
InSim.txt says M/S (meter per second).
yankman
S2 licensed
The z4 gt3 sounds not that spectacular, although it seems to drive nice.
My favourite is still m3 gtr paired up with striezel stuck.
yankman
S2 licensed
Quote from morpha :@yankman: What reason could someone possibly have to intentionally use outdated software? That's very unprofessional if you ask me

I don't want this to become far off topic, so a short and last explanation.

There are many privateers out there, who startet to rent root-servers (bundled with confixx/plesk etc.) for cutting the costs for hosting multiple sites.
They don't care about linux or php version (actually they don't have an idea what that is). The main goal is keep the server runing at minimal costs, so they run for years (personally I know 2 such guys). As often as I tell them they need to upgrade at least for security reasons,
they are afraid of the costs, the downtime and what else might happen.

So my experience, php 4 might be dead in terms of support but not in terms of usage in servers out there.
yankman
S2 licensed
Quote from morpha :Hardly a drawback as php4 is dead and has been for a while.

Don't be to sure, php applications are part of my work and from time to time there are customers who still use php 4.
Mostly caused by very outdated linux distributions.

Anyway my idea was something like this.

<?php 
class LFSStrConvert
{
    
// Replace Sets
    
public static $consoleReplaceArray = array("\033[30m""\033[31m""\033[32m""\033[33m""\033[34m""\033[35m""\033[36m""\033[37m""\033[39m""\033[0m");
    public static 
$htmlReplaceArray = array('000''F00''0F0''FF0''00F''F0F''0FF''FFF');

    
# Convert Live For Speed String into an ECMA-48 escaped string.
    
public static function lfs_str_convert_console($str)
    {
        
// Extra State Information
        
$isTagOpen FALSE;
        
// Parse String
        
for ($i 0$j 1$l strlen($str); $i $l; ++$i, ++$j)
        {
            
/* Handle Color Codes */
            
if ($str{$i} == '^' && is_numeric($str{$j}))
            {
                
// Get array values' length.
                
$deltaLen strlen(LFSStrConvert::consoleReplaceArray[$str[$j]]);
                
// Set tag status
                
if ($str{$j} < 8)
                    
$isTagOpen TRUE;
                else
                    
$isTagOpen FALSE;
                
// Place ECMA-48 Charaters into String.
                
$str substr($str0$i) . LFSStrConvert::consoleReplaceArray[$str[$j]] . substr($str$i);
                
// Move Pointer Past The Change.
                
$i += $deltaLen$j += $deltaLen;
                
// Get new String Length.
                
$l strlen($str);
                
// Remove The Formatting.
                
$str[$i] = NULL# Remove ^
                
$str[$j] = NULL# Remove Int.
            
}
        }
        
// Close any tag left open.
        
if ($isTagOpen)
            
$str .= "\033[0m";
        return 
$str;
    }

    
# Convert Live For Speed String into an HTML Mark'ed Up String.
    
public static function lfs_str_convert_html($str)
    {
        
// Extra State Information
        
$isTagOpen FALSE;
        
// Parse String
        
for ($i 0$j 1$l strlen($str); $i $l; ++$i, ++$j)
        {
            
/* Handle Color Codes */
            
if ($str{$i} == '^' && is_numeric($str{$j}))
            {
                if (
$isTagOpen == TRUE)
                {
                    
// Set State.
                    
$isTagOpen FALSE;
                    
// Inject Close Tag
                    
$str substr($str0$i) . '</span>' substr($str$i);
                    
// Move Str pointers Past ?.
                    
$i += 7$j += 7$l strlen($str);
                }
                if (
$str{$j} < 8)
                {
                    
// Set State
                    
$isTagOpen TRUE;
                    
// Inject HTML Markup
                    
$str substr($str0$i) . '<span style="color: #'.LFSStrConvert::htmlReplaceArray[$str[$j]].';">' substr($str$i);
                    
// Move Pointer Past The Change.
                    
$i += 27$j += 27;
                    
// Get new String Length.
                    
$l strlen($str);
                }
                
// Remove The Formatting.
                
$str[$i] = NULL# Remove ^.
                
$str[$j] = NULL# Remove Int.
            
}
        }
        
// Close any tag left open.
        
if ($isTagOpen)
            
$str .= '</span>';
        return 
$str;
    }

    
# Strip All Live For Speed Markup From The String.
    
function lfs_str_strip($str)
    {
        return 
str_replace(
            array(
'^0','^1','^2','^3','^4','^5','^6','^7','^8','^9'),
            array(),
            
str_replace(array('^d','^s','^c','^a','^q','^t','^l','^r','^v'),
            array(
'\\','/',':','*','?','"','<','>','|'), $str)
        );
    }      
}
?>

Would be nice to do some profiling, comparing both approaches.
I wouldn't be surprised if the php interpreter recognizes the constant arrays within the functions and does it only initialize once.
yankman
S2 licensed
A class with static arrays for the specific color data as well as static methods for the color handling would be a solution.

Data would be have only loaded once no matter how often you call the methods and the methods would be logically grouped together.

Might sound strange but this object oriented approach should produce less overhead than the original version.

The only drawback afaik would be no php4 support.
yankman
S2 licensed
Well the AI uses actually selected players car,
but I didn't know you can't change the selected car while on track.

Sorry, got no idea then.
yankman
S2 licensed
In game open chat window (T) and type /car FZR.
yankman
S2 licensed
Quote from giannhsgr1 :
(two gravity force will produce two anti gravity forces forcing the object to speed up like hell until they reacy the time limit)

It is not two gravitiy forces. Gravitiy is what pulls you towards the mass centre of earth, with 9.81 m/s² at sealevel.
For ease of use it has been know as 1 G.


So if there is a lateral force pulling with 5 G, it means nothing more but 5 * 9.81 m/s². It is caused by fictitous force rather than gravity.
yankman
S2 licensed
Quote from amp88 :We're arguing the different definitions of the word interpretation.

You're right. My view was one sided. Sorry for the harsh comment.
I was seeing an interpretation of a rule more as a type of bending the rule.
Imho things that are not covered by rule (e.g. where to put the tyres) are freedom of design and not a sign of a bad formed rule.
yankman
S2 licensed
Quote from amp88 :If the rules just say "your car must have 4 tyres" then there are multiple interpretations of that. You could put two at the front and two at the back or three at the front and one at the back etc. Those are different interpretations of the same rule. As BreadC points out there were different interpretations last year of the rules concerning the diffuser.

The rule doesn't say where the tyres have to be, this not part of the rule.
It just says 4 tyres.
And the one and only intepretation of that is put 4 tyres on that car everything else is up to you.

There is no rule that covers every aspect of a design as it would make no sense. So even if a rule has only one interpretation, there are most probably different results in design.
yankman
S2 licensed
Quote from amp88 :Disagree. If there was only one interpretation every car would look identical given the same rules (which we know is not the case).

Woot ???
So If I give a rule every car has to have 4 tires (which resolves to clearly one interpretation), would than every car look the same ?

One of the most stupid comments I ever read.
yankman
S2 licensed
Quote from bunder9999 :n eventually changing from hidden tables to div's, just not right now.

Don't use divs just cause someone says tables are not state of the art.
With divs you will run in much problems when it comes to browser compatibility and it will take a lot more time to sort such things out.

It is better to use a simple layout for development and seperate it from the logics via template engine (e.g. smarty).

So someone else can care for a fancy layout, while you do the vital things.
yankman
S2 licensed
InSim.Send_BTN_CreateButton("^7" + string.Format("{0:0}", Connections[GetConnIdx(Players[GetPlyIdx(MCI.Info[i].PLID)].UniqueID)].TotalDistance / 1000.0), Flags.ButtonStyles.ISB_C2, 5, 15, 145, 6, 162, (Connections[GetConnIdx(Players[GetPlyIdx(MCI.Info[i].PLID)].UniqueID)].UniqueID), 2, false);

This way ?!
yankman
S2 licensed
Quote from Ball Bearing Turbo :It's completely relevant, at least in theory, in a high bank oval where you could achieve a vector sufficient to black you out. At 9Gs, which is the absurd figure I commented on, even a full lateral acceleration can take you out since having even half of your brain starving for oxygen isn't exactly good for you either last time I heard.

Well yeah I related the direction g-force according to the car not the track.
I hope you didn't get me wrong there. So high banked ovals would produce high vertical forces.

Tbh. I have no idea of the influences of lateral forces on the brain.
I thought so ppl would rather loose their head before going blackout on lateral g-forces.
If that isn't the case they could a least use half of the brain together with the corresponding eye.
yankman
S2 licensed
Quote from marsaz :People can tolerate much higher lateral G forces than vertical ones. I guess that's mainly because of blood getting out of or in your head.

Right, thats what I meant.
For the discussion about blackouts on ovals the lateral forces are not relevant.
So point is not the add vertical and lateral Gs.

Question is how long ppl can withstand 5 Gs.
yankman
S2 licensed
Relevant for the state of blackout are only the Gs pulling downwards -> sucking the blood out of the head.

As stated in the report high banking and high speed are the causes.

Gs pulling sideways have afaik no effects on blackouts.

Stunt pilots are able the counter high G-forces by tense up but only for a short amount of time.
yankman
S2 licensed
The linker tries to link against pthreads, a threading library. (who would have guessed )

It should not be shipped with the project itself, but you can install it from cygwin setup (libs section).

If it is the wrong version (hence gc2 corresponds to gcc 2.9.x and cygwin comes with gcc 4.x ), you would need to adjust the makefile to reflect the installed version.
yankman
S2 licensed
Quote from Dygear :
As I've allocated some memory, don't I also have to free it? Or is that only for memset / alloc calls, not definitions like this (I hope that's handled by the compiler for assigning and freeing memory in this fashion, or I just leaked some memory.)

If you allocate memory on the heap you need to free it afterwards.

char sDest[666]; // this is put on the stack, the compiler knows the size at compile time.

char* psDest;
psDest = new char[666]; // this is put on to the heap so you have to free it afterwards
delete [] psDest;

psDest = 0; // good programming practise to set the pointer to zero

For the buffer problem it would be safe to allocate the desired buffer size,
and strncpy to fill the buffer.

In general you should stick to stl c++ container classes they have bullet proof memory management integrated.

Edit: Didn't see you were already using vsnprintf.
Last edited by yankman, . Reason : Lazy reading
yankman
S2 licensed
I am not sure if I fully understand, what you want to do.
But variable argument lists are handled in the va_* functions in stdarg.h.

Look here http://www.cplusplus.com/refer ... library/cstdarg/va_start/
Last edited by yankman, .
yankman
S2 licensed
U need to setup a shoutcast/icecast server first, but be sure there is enough bandwith available.
Second use winamp with shoutcast plugin to stream mp3 data to the server (DJ).

Or just read here:
http://www.shoutcast.com/
yankman
S2 licensed
Quote from yeager :So i'm not mad, the current effects of slipstreaming are not really noticeable?

If you run a few laps on the oval (e.g.FZR,BF1), you will notice the effects.
There is slipstreaming as well as losing grip, and it not just a little effect.

Strange is that even with very low wing settings the effect doesn't seem to change.
yankman
S2 licensed
Well I liked the idea ... maybe it can spread the word of LFS a bit more, if we get into higher rankings.

I use GPU version as well as CPU. The GPU is unbelievable fast compared to cpu. So one day there is no result from cpu and next day there is +4. Maybe thats the "jumpstart"

I was really hoping for more people participating.
Well I will at least participate as long as it is cold in germany and the exhaust
air keeps my foot warm .
yankman
S2 licensed
I've started such a project years ago for the LFSCAR series.

It is possible to setup a pacecar with the ai, but it cannot run server side.
So a race admin or something like that has to run the app.

It works the following way.

-detect race_start -> ai joins race with predefined skin, setup and car
-grid is reordered to move pace car in front
-the setup limits the top speed of the car by gearing
-fuel is limited so the pace car will join the pits after a certain amount of laps -> send pacecar to spectate


Thats basically it, you could even let it join the race in case of a fcy.

My tries never left early testing stage but it was enough for a proof of concept.
FGED GREDG RDFGDR GSFDG