The online racing simulator
[EXAMPLE REQUEST] Formula One: Timing & Scoring.
Hello, if some one would please take on the challenge of providing a F1 style Timing & Scoring interface that would be awesome. Here is the requirements for Timing and Scoring with examples on how I would like it implemented.

When a driver completes to a split, there should be a Race Control Message (hence forth referred to as, RCM) displayed to only that user with their split time. For example, if a user has reached Split 3 of a 4 Sector track the time displayed should be Split 1, Plus Split two Minus Split 3 giving you only the time they spent in that sector. (Split1 + Split2) - Split3 = SectorTime The RCM should be then colorized by the quickness of their sector time. For example, if the server has set the fastest split for that session the color of the time, displayed in the RCM, should be purple. Should the driver set a personal best sector time, then the RCM should be green. If it does not meet any of these conditions then no color should be applied. The RCM should only display for 5 seconds, and then clear.

If you could, also on session end save out a csv file with the sector time data that would be awesome.

Thank you to any one who picks up the project, your a supper star!

[EDIT]Just so you all know, MaKaKaZo has picked up the project and has released the program and source code in this thread titled C++ - LFS Session Timing (application/tutorial)
This Is Not A Real Request, I'm Just Providing An Example On How It Should Be Done.


But if some one want's to make it (I already have), a public version would be I think pretty cool for leagues, feel free too.
Thank you Dygear
As always angel, not a problem .
Here is an open version of this request, feel free to make it work (I've not tested it, at all and I'm sure their are some bugs in it).


<?php 
class TimingAndScoring extends Plugin {
    function 
__constuct() {
        
$this->splits = array();
    }
    function 
onSPX($pck) {
        
$this->onLAPandSPX($pck);
    }
    function 
onLAP($pck) {
        
$this->onLAPandSPX($pck);
    }
    function 
onLAPandSPX($pck) {
        
extract($pck);
        if (!isset(
$this->splits[$PLID]['LAPS']])) {
            
$this->splits[$PLID]['LAPS'] = 1;
        }
        
$Time = ($Split == 'LAP') ($LTime 100) ? ($STime 100);
        if (
$Time $this->splits[$Split]) {
            
$color '^3';
            
$this->splits[$Split] = $Time;
        } else if (
$STime $this->splits[$PLID][$Split]) {
            
$color '^7';
            
$this->splits[$PLID][$Split] = $Time;
        } else {
            
$color '^0';
        }
        
$this->splits[$PLID][$this->splits[$PLID]['LAPS']]['L'] = $Time;
        
$this->parent->sendRCM("{$color}{$LTime}"5);
        if (
$Split == 'LAP') {
            
$this->splits[$PLID]['LAPS'] = $LapsDone;
        }
    }
    function 
__destruct() {
        
$this->parent->export->csv($this->splits);
    }
}
?>

I have made this "project" as a side job and I think I'll be releasing it tomorrow as a tutorial on InSim programming with C. It doesn't generate CSV files though.

I first made this as a feature for another bigger insim app, but thought it would be nice to have something like this as a standalone application that can be running all the time on a dedi server.

I hope some people will volunteer to do a little beta testing. And I hope someone takes a look at the code and corrects the many mistakes I must have done
Sure mate, send the code over!
You going to Open Source the Whole thing?
I hope your going for an GPL or MIT license.

I really think that this makes a perfect example now. I did not pester the community to make my request, I just left it, and it ran it's course. With a well thought out idea put down, you can get the community to respond. We just need to know the specs your looking for.
Quote from Dygear :Sure mate, send the code over!
You going to Open Source the Whole thing?
I hope your going for an GPL or MIT license.

I'm using a LGPL library. I think that allows me to choose any license for my application, even one not GPL compatible. I think I'll be going with the MIT license.

I need to do some tasks before releasing it though:
  • Translate the code into English (var names, etc.)
  • Add comentaries so it's easy to follow.
  • Add license text and notices to the code and stuff like that.
That will take a while
Very nice sir, just took at peek at the source code . . . And ran the program, works very well. Love it! Did not get to use the ! commands, forgot about them . But good work over all.
Thanks! What I noticed after running it a bunch of times with some friends is that after a while you check the coloured text before having a look at the standard RCM split time. And playing a bunch of short, consecutive races, the first thing you do when you finish is check "!splits" and "!best" too see where you were losing most time.
Quote from MaKaKaZo :Thanks! What I noticed after running it a bunch of times with some friends is that after a while you check the coloured text before having a look at the standard RCM split time. And playing a bunch of short, consecutive races, the first thing you do when you finish is check "!splits" and "!best" too see where you were losing most time.

Yeah, yea, totally. The first thing I do is check the split color and time, then I check the difference that you provided to see weather it's red or green, the standard RCM sector time. I want to know how much time I spent in THAT split I really don't care what I did over all. Most of the time I'm losing time to some one else in one split vs the rest, so I try to negate that as much as possible and this provides me much better feed back based on that.
Quote from Dygear :The first thing I do is check the split color and time, then I check the difference that you provided to see weather it's red or green, the standard RCM sector time. I want to know how much time I spent in THAT split...

Not to get on your nerves, but I think the terms split/sector are used in the opposite way

The track is divided into sectors, and the sector time is the time you do in one specific sector (what I show in yellow/green/purple). On the other hand, the split time is the aggregated time from the start of the lap to one specific point (what LFS shows by default). Anyway, I totally understand what you're saying.

In my case, it dependes on whether the first sector was good or bad. If my lap is being a fast one then I'll look at the red/green difference first, to see how much time I'm losing to the fastest. When I do one bad sector time, then I'll look at the sector time in the following splits to see if at least I'm doing fine in the final sectors. In these laps, the global time is not that important anymore as you already lost it.

Also, when you are in a league race in which the fastest lap gives you some points, it's nice to know after the second split if you are being faster than the current fastest lap at that point, so you go for it in the final sectors.

PS: I'm sorry that this conversation is starting to go off-topic Maybe it would fit better in the thread I started
MaKaKaZo, just wanted to thank you for making this available to the public, I really think it adds a lot the sim.
Quote from Dygear :MaKaKaZo, just wanted to thank you for making this available to the public, I really think it adds a lot the sim.

Scawen, read this and think of it as a possible future feature
I have a question.
I dont know anything about programing and coding and i wanna try this program on my host.How could i make this happen?
And where is the program?
Sorry for the dump question but really need this feature.
Quote from pliktro :I have a question.
I dont know anything about programing and coding and i wanna try this program on my host.How could i make this happen?
And where is the program?
Sorry for the dump question but really need this feature.

Go here: http://www.lfsforum.net/showthread.php?t=46643

Then try to do it yourself, and if you can't then PM me and I'll try to help you.
MaKaKaZo

Thank you very much i'll try it
A PAWN Plugin Solution to this problem.


<?php 
#include <lfs>

new aTimes[MAX_CLIENTS][MAX_SECTORS], aBTime[MAX_SECTORS];

public 
plugin_init() {
    
register_plugin("Timing & Scoring""0.1""Dygear");
}

public 
client_split(idtimesplit) {    // on ISP_SPX
    
getSectorTime(idtimesplit);
    return 
PLUGIN_CONTINUE;
}

public 
client_lap(idtime) {    // on ISP_LAP
    
getSectorTime(idtime);
    return 
PLUGIN_CONTINUE;
}

getSectorTime(idtimesplit 0) {
    new 
aParams[4];
    
aParams[0] = id;
    if (
aBTime[split] > time) {
        
aParams[1] = 7// Sets RCM Color to Purple
        
aBTime[split] = time;
        
aTimes[id][split] = time;
    } else if (
aTimes[id][split] > time) {
        
aParams[1] = 2// Sets RCM Color to Green
        
aTimes[id][split] = time;
    } else
        
aParams[1] = 4// Sets RCM Color to White
    
aParams[2] = time;
    
set_task(5.0"fwSendRCM"idaParams); // Sets the RCM to show up 5 seconds after the normal Split RCM.
}

public 
fwSendRCM(params[4]) {
    new 
szTime[16];    // ^#HH:MM:SS.TT
    
client_print(params[0], PRINT_RCM"^%d%s"params[1], timeToStr(params[2]));
}
?>

Now I just need to learn how to make each packet trigger a callback ... I guess I'll have to clear C for real .
The following is information was obtained from the image here. The image is of the McLaren Pit wall showing the FOM Timing & Scoring screen. I've copyied the data here as close as I can, and I think I can emulate this data for Live For Speed.

Best Lap KOV SUT KOV LIU SUT KOV 1:41.367
1 2 KOV 1:41.757 25.901 270 46.179 289 1:41.757 19
2 20 SUT 1:41.958 36.078 272 46.383 293 19.466 254 IN PIT 8
3 14 WEB 1:42.491 36.463 266 1:49.334 9
4 17 NAK 1:42.591 35.976 271 46.983 289 19.632 250 IN PIT 11
5 1 HAM 1:42.642 36.104 270 46.779 287 19.759 258 IN PIT 10
6 21 LIU 1:42.738 36.481 268 46.296 294 19.961 254 1:42.738 9
7 3 FIS 1:42.853 36.453 267 46.898 286 19.788 248 IN PIT 19
8 12 BUE 1:43.199 36.232 270 47.360 289 19.594 247 IN PIT 17
9 15 VET 1:43.218 36.390 268 46.898 286 19.925 247 IN PIT 11
10 16 ROS 1:43.221 36.479 270 46.993 287 14:43.181 15
11 10 KOB 1:43.407 35.959 270 47.993 287 19.936 249 IN PIT 13
12 4 RAI 1:43.460 -16 +1.604 -3 +0.172 16:15.543 18
13 22 BUT 1:43.504 36.893 269 46.930 288 19.681 251 IN PIT 10
14 7 ALO 1:43.833 36.347 270 47.338 286 19.879 251 IN PIT 16
15 11 ALG 1:44.043 36.244 270 47.522 293 19.962 248 IN PIT 19
16 9 TRU 1:44.047 36.330 268 47.872 286 19.723 248 IN PIT 9
17 6 HEI 1:44.088 36.793 263 1:44.088 8
18 23 BAR 1:44.217 36.843 270 47.308 291 20.066 251 IN PIT 10
19 5 KUB 1:44.222 36.926 264 46.998 281 20.228 245 IN PIT 11
20 8 GRO 1:44.571 36.778 269 47.674 287 19.783 251 IN PIT 17

11:16:05 © F1 GROUP P1 13:55

Attached images
ECMA-48 F1 FOM Timing & Scoring with LFS Color Codes.png
Attached files
ECMA-48 F1 FOM Timing & Scoring with LFS Color Codes.zip - 1.7 KB - 956 views
Quote from Dygear :I've copyied the data here as close as I can, and I think I can emulate this data for Live For Speed.

To follow this up yes it can be done via a console app, but it can't be done via the InSim buttons for the following outlined reason:

Following the same standard as FOM's Live Timing and Scoring screen found on the pit wall and in front of the drivers while they are sitting in the pits.

The following information should be displayed while the client is a spectator, and while the clients is not in the pits (they should be viewing the track), there should also be on option to hide the screen via an additional button displayed to turn this view on and off at all times while the client is in spectator mode.

There should be a few things noted about the amount of data that is going to be displayed via the buttons. Player Number, Player Name, {{Split Time, Split Speed}x{Number of Sectors}}, Total Time, # of Laps.

That's 4 plus anywhere from 1 sector times 2 (Split Time, Split Speed) to 4 sectors times 2, so 6 - 12 per row. So with that in mind, there is a max of 32 clients that can be in a race at any one time, 32 * 12 = 384 buttons, and that's not including the 8 header buttons (392 total) and 3 footers buttons (395 total). 240 buttons is the InSim max. So we are going to have to trim some fat from the InSim version.

So, 4 plus anywhere from 1 to 4 sector times, with a max of 32 clients. 256 buttons total. Again to many. Thus ... It is not possible to do an InSim version of The FOM Pit wall timing and scoring screen with buttons at this time.
I thought about doing this too about two years ago when I started with insim and also ruled it out because of the maths involved that you have mentioned. There's just not enough buttons, and I was basing my design on the basic live timing that www.formula1.com offers for free to subscribers during F1 events, which doesn't include top speed data. (http://www.formula1.com/live_timing/)

Anyway, the best idea would be to do it as a web application, like an alternative to lfs remote. The original live timing by F1.com is a Java application, but I guess using PHP/ajax something very similar could be done. I'm not a good web programmer so... maybe I'm talking nonsense
Quote from MaKaKaZo :Anyway, the best idea would be to do it as a web application, like an alternative to lfs remote. The original live timing by F1.com is a Java application, but I guess using PHP/ajax something very similar could be done. I'm not a good web programmer so... maybe I'm talking nonsense

I know it can be, filur did this ... I want to say 4 years ago ... for the SimFIA site that I was running. It was very cool to see, and everything was written in PHP and he did the rest of the work in AJAX.

FGED GREDG RDFGDR GSFDG