The online racing simulator
Searching in All forums
(948 results)
filur
S2 licensed
Quote from St4Lk3R :.. PHP could try to create a copy of the $LFSWorld object instead of passing a reference to it to the function.

PHP5 should AFAIK always pass objects by reference.
Last edited by filur, .
filur
S2 licensed
Quote from Anarchi-H :I'm not sure where you got the idea of global from

From the code i used in my example, the code that was being discussed by MikeB and Dygear.

Quote from Anarchi-H :As you can see, it is a minor departure from inheritance

Actually, i see it as something completely different.
Last edited by filur, .
filur
S2 licensed
Quote from Anarchi-H :Misuse of inheritance and in the specific example, mixing (business) logic with presentation. [...] In this case, aggregation would be more appropriate if you are going to extend it with OO.

While i do agree on mixing code with presentation, i would suggest pretty much anything to avoid passing the object around as a global variable.

I guess by misuse of inheritance you're saying inheritance is in this case completely unecessary, if so i would basically agree. However, attempting to explain classes, objects and association or how to use runkit doesn't really fit in this thread. Extending the class is an easy neatness fix, and in my opinion quite a good introduction to objects and classes in PHP. If there's enough interest i'm sure the manual and google would do a better job of teaching object orientation then i could.

Quote :You wouldn't expect Scawen to say "It just doesnt work, here is what you'll have to do instead".

I would expect Scawen to say "until i fix the black screen bug, don't start LFS in fullscreen" (might've been windowed).
filur
S2 licensed
Quote from Smax :I picked up a copy of Virtual Dub, but it appears unable to do more than interpolate the frame rate to something else [daft idea imho] and then export as an avi - forgive my stupidity but are there different versions?

Well yes, there are a few versions but by 'divx/xvid encoder' i assumed you were looking for something that simply took source video and encoded it to divx or xvid, avi being the standard format.

VirtualDub does pretty much exactly that, it's not an editor, even though you can do some minor editing.

Edit: liked the magic floaty cameras, could've almost done without the few static ones.
Last edited by filur, .
filur
S2 licensed
Quote from Smax :If anyone knows of a freeware divx/xvid encoder that is not a time/feature limited demo I'd love you to post me a link.

http://virtualdub.org/
filur
S2 licensed
Quote from Anarchi-H :Extending LFSWorldSDK in that manner is very bad design form and could just be a work around to a more serious issue.

What makes it bad design?
filur
S2 licensed
Quote from KMSpeed :I find that confusing. While you are racing there's only one race and one fastest lap and of course one winner. A good race comes with same cars or at least same class cars.

Multi-class racing isn't exactly a new idea.
filur
S2 licensed
Quote from Dygear :I would simpley extend the lfsworld class with your own functions.

Just to clarify as this sounds hopelessly complex for someone who's new to it.

Instead of wrapping actions into a function like MikeB did in the example a few posts above, a much cleaner and actually simpler method is extending lfsworldsdk.

include 'lfsworldsdk.php';

class MyLFSWorld extends LFSWorldSDK {
function teams_test() {
$teams = [B]$this[/B]->get_teams();
echo "<p>Starting teams list</p>\n";
foreach ($teams as $this_team) {
echo "-----------------------------------------\n";
echo "Team: {$this_team['team']} ({$this_team['tag']}) \n\n";
echo "Members: {$this_team['nr_members']} \n";
echo "Website: {$this_team['url']} \n\n";
}
echo "<p>Finished teams list</p>\n";
}
}

By doing this you are effectively copying the entire function set from lfsworldsdk and adding the teams_test function to it. The passing around of $LFSWorld is replaced with $this, $this is always a reference to the object itself when working with code inside a class.

Finally you would use your class instead of lfsworldsdk when creating the object:

<?php 
//$LFSWorld = new LFSWorldSDK();
$LFSWorld = new MyLFSWorld();
$LFSWorld->teams_test();
?>

filur
S2 licensed
Quote from maczo :OK, I'm stuck with this one. Which drivers should I download?

GeForce and TNT2

Quote from maczo :Will adding more RAM help? I mean it should help, but will it be noticeable?

You won't notice any performance gain in LFS, except from load/reload times perhaps.
filur
S2 licensed
I don't think there's many extra frames to be found, but please do post if you find some.

I just upgraded from a Radeon 9550SE to a 6800GS, the rest of my (core) system consists of a Celeron D 2.4 GHz clocked at 3 GHz and 1 GB 400MHz dual channel DDR. The performance change in <insert not-LFS here> could be measured in hundreds of percent, in LFS, none. I basically have the exact same frame rates as before (~20-30 in full grid, maximum about 70 while racing), but i went from 720x576 4xAA/AF to 1600x1200 8xAA 16xAF, there's no difference in minimum FPS between 640x480 0xAA/AF to the resolution/filtering i run now, minimum FPS stays the same all the way up to 2048x15-something with all card/driver settings on max.

I guess i'm more limited by the CPU then i thought before buying the new card, my theory before upgrading was that i could perhaps bump my minimum FPS up to about the FPS i could pull in a full grid with simulation paused. It's a bit strange that lowering the various LODs make such a big difference in LFS, mirrors also steal about 10 fps, seems like the simulation cycles aren't the only ones heavy on CPU. I use about 0.4 user LOD and 0.3 dynamic LOD reduction, it's also weird how there's no difference in performance between the minimum and maximum car draw distance. This thread is also interesting.
filur
S2 licensed
The swedish page title reads 'LFS Manuell', which i guess is a straight translation of manual as in manual gearbox, manual as in instruction manual should stay 'manual'.

(should be LFS Manual)
filur
S2 licensed
Does any other USB equipment work without entering BIOS ?
filur
S2 licensed
Quote from HorsePower :It works, basically with your function. But as hard as I try, I can see no difference (in principle) to my old code. The only change is that now there is this extra function that does the querying.

There are some oddities in PHP, sometimes it doesn't work as line-by-line as you'd expect, might've found one of those.
filur
S2 licensed
Quote from MaxK :... then it would not "bind" with the server.

Have you specified the /ip setting in the server setup cfg ? In 99.9% of cases this is not necessary and afaik the only way you could make the server fail to 'bind' unless you've accidentally started several instances. Leaving this setting undefined should make the server listen on all available network interfaces.
filur
S2 licensed
Quote from HorsePower :Nope. How? And what's different there?

You could basically find out if the webserver or anything in that environment is causing the problem.
php.exe -f path/to/file.php

http://www.php.net/manual/en/features.commandline.php
filur
S2 licensed
Quote from HorsePower :I found this post [...] He can solve his problem by using the 5-second interval. Strange. 120 seconds don't work for me [...] EDIT: Yet a last note here: It works for uncompressed LFSW-output. Now I'm really confused.

I run alot of pubstat stuff, everything compressed (gzcompress), everything on 5s. tarpit. Tried running the script from command line?
filur
S2 licensed
Quote from HorsePower :... as far as I understood, I can use pubstat every 5 seconds. But also if I wait 10 seconds between queries I get this message every single time from the 3rd query ...

Make sure you're not running something else that's querying pubstats, as it's limited per IP. Can't see how it could technically be caused by Apache or PHP.

Edit: maybe it's also limited by id-key, if you're using the same key from separate locations. (?)
filur
S2 licensed
Quote from HorsePower :

[B]Warning[/B]: gzuncompress(): data error in ...

ATM, I'm also programming a little script, and I also get this message from the 3rd time on I query LFSW (10 sec between queries).

I use this code (for example for WR's):

<?php 
gzuncompress
(file_get_contents("http://lfsworld.net/pubstat/get_stat2.php?version=1.3&action=wr&c=2&idk=".$this->id_key));
?>

How can I fix it? Any help appreciated! Thanks in advance!


<?php 
if ($gzstr file_get_contents(' ... ')) {
    if (
$str = @gzuncompress($gzstr))
        
/* it's all good. */
    
else
        
/* it's most likely an error message in plain text ($gzstr). */
}
else
    
/* can't get output. */
?>

filur
S2 licensed
Quote from SkyNet :since 1.3 you must use your pubstats id...where do i put it?

The id key is passed to the object at creation, it is actually required.
$object = new LFSWorldSDK('id key goes here');

Quote from SkyNet :if i try get my hotlaps it says "Array ( [id_hl] => [track] => [car] => ...

Arrays can be seen as collections of variable<->value pairs, to access the value of a variable, you use:
$the_array['variable_name'];

A simple way to iterate thru the entire array:
$hotlaps = get_hl('filur');
foreach ($hotlaps as $lap) {
echo $lap['track'].' in '.$lap['car'].': '.$lap['time'].'<br />';
}

More info on arrays in PHP:
http://php.net/manual/en/language.types.array.php
http://php.net/manual/en/ref.array.php
filur
S2 licensed
Updated CVS with Dygears code for the pubstat changes and released a new .rar, http://prdownloads.sourceforge ... -cvs20061110.rar?download
filur
S2 licensed
Quote from the_angry_angel :I hope you're not subtly suggesting ECMAScript as an alternative, filur

Edit: Sorry, I didn't mean to turn this into a battle of the languages. Ferite anyone?

Absolutely not. :nol2:

Ferite looks neat.
filur
S2 licensed
Quote from gwendoline :You ruin all of my works with this change.

Put simply, if you've written pubstat-grabbing scripts/applications yourself, converting to meet the new id-key requirement will take you about 15 seconds.
filur
S2 licensed
Quote from the_angry_angel :I've tried ToDo lists ... its just Another Thing To Do(TM).

This is so true, the only time i ever write todo's (programming related) is when i'm out of things to actually do.
filur
S2 licensed
From the features page it seems there's no object orientation at all, this is simply not acceptable.
FGED GREDG RDFGDR GSFDG