SMALL UPDATE (2008-08-29):
The CInsim library was replaced with a newer version, but in this application no new features are used.
LFS SESSION TIMING v0.1
Ok, here is the application I made based on the example request by Dygear (http://www.lfsforum.net/showthread.php?t=46253).
First of all, I didn't know where to post this, as a reply to Dygear's thread, here as a new thread, or in the unofficial addons sub-forum. As it's more an example/tutorial I've chosen to post it here, moderators feel free to move it elsewhere, merge it with another thread, etc.
Also I'd like people to test it. I haven't tried it for long periods of times with many people connecting and leaving. Give me some feedback please! And take a look at the code!
But, WHAT THE HELL IS THIS?
It's an example InSim console application using the C++ language and my own small library.
It's meant to be used as an example/tutorial, and helping people understand how InSim works.
This application writes tons of stuff to the console. If there are too many players it might be impossible to follow, but if there are just a few, you can keep an eye on the console and pretty soon you will have a good idea on how InSim works, and what the application is doing at any time.
There are a lot of comments in the code too so it's easy to read and analyze
WHAT DOES IT DO?
It just shows extra information every time a driver completes a sector of the track. That info is:
To achieve this I have used transparent buttons. If you use RCMs they overlap (and erase) the standard split time, and you can't have several RCMs at one point, so buttons are an alternative, although their colors might be a bit too bright for some people.
There are some added features, like consulting lap and sector times for any driver connected to the server, the best times, and disabling the screen messages.
Admins also have more features, like making times permanent or resetable at each restart. By default all times (both individual and global) get reset at each restart, but you can set it so they are permanent. In that case they are reset only when the track is changed. Admins can also reset the times at any given time.
QUICK START
Just run the executable in the zip with 3 arguments: IP PORT ADMIN_PASS
(The PThreads dll must be in the same directory)
I recommend to create a Windows link and add those arguments in the properties.
Connect to the server and the help screen should appear. You can be in the server when the application starts, but be warned that the first thing it does is send everyone to spectators. The help screen is pretty self explanatory.
Start running!
LIMITATIONS
The application doesn't know when you are in shift+F mode, so you have to manually turn screen messages off, because buttons show even when you are in shift+F mode.
NOTES:
A file called insim.h is used. This is the original InSim.txt file included in the docs/ folder of your LFS installation, renamed to a .h. The only change that has been done to this file is in the line 1568:
char Text[112]; // 0 to 240 characters of text
The original button struct does not define a static text size, but permits different sizes. As a novice programmer I didn't know how to use buttons with variable sized texts, so I fixed it to 112. This causes a notable overhead when sending multiple IS_BTN packets to the server. If anyone knows how to use variable sized text with this CInsim library please tell me!!!
I'm also open to suggestions and awaiting for corrections to the code!
The CInsim library was replaced with a newer version, but in this application no new features are used.
LFS SESSION TIMING v0.1
Ok, here is the application I made based on the example request by Dygear (http://www.lfsforum.net/showthread.php?t=46253).
First of all, I didn't know where to post this, as a reply to Dygear's thread, here as a new thread, or in the unofficial addons sub-forum. As it's more an example/tutorial I've chosen to post it here, moderators feel free to move it elsewhere, merge it with another thread, etc.
Also I'd like people to test it. I haven't tried it for long periods of times with many people connecting and leaving. Give me some feedback please! And take a look at the code!
But, WHAT THE HELL IS THIS?
It's an example InSim console application using the C++ language and my own small library.
It's meant to be used as an example/tutorial, and helping people understand how InSim works.
This application writes tons of stuff to the console. If there are too many players it might be impossible to follow, but if there are just a few, you can keep an eye on the console and pretty soon you will have a good idea on how InSim works, and what the application is doing at any time.
There are a lot of comments in the code too so it's easy to read and analyze
WHAT DOES IT DO?
It just shows extra information every time a driver completes a sector of the track. That info is:
- Sector time coloured depending on how fast it was. Purple is global best, green is personal best and yellow is used in other cases.
- Difference to the best lap of the session at that point. Red means you are slower, green means you are faster, and white is used if you are doing the exact same time.
To achieve this I have used transparent buttons. If you use RCMs they overlap (and erase) the standard split time, and you can't have several RCMs at one point, so buttons are an alternative, although their colors might be a bit too bright for some people.
There are some added features, like consulting lap and sector times for any driver connected to the server, the best times, and disabling the screen messages.
Admins also have more features, like making times permanent or resetable at each restart. By default all times (both individual and global) get reset at each restart, but you can set it so they are permanent. In that case they are reset only when the track is changed. Admins can also reset the times at any given time.
QUICK START
Just run the executable in the zip with 3 arguments: IP PORT ADMIN_PASS
(The PThreads dll must be in the same directory)
I recommend to create a Windows link and add those arguments in the properties.
Connect to the server and the help screen should appear. You can be in the server when the application starts, but be warned that the first thing it does is send everyone to spectators. The help screen is pretty self explanatory.
Start running!
LIMITATIONS
The application doesn't know when you are in shift+F mode, so you have to manually turn screen messages off, because buttons show even when you are in shift+F mode.
NOTES:
A file called insim.h is used. This is the original InSim.txt file included in the docs/ folder of your LFS installation, renamed to a .h. The only change that has been done to this file is in the line 1568:
char Text[112]; // 0 to 240 characters of text
The original button struct does not define a static text size, but permits different sizes. As a novice programmer I didn't know how to use buttons with variable sized texts, so I fixed it to 112. This causes a notable overhead when sending multiple IS_BTN packets to the server. If anyone knows how to use variable sized text with this CInsim library please tell me!!!
I'm also open to suggestions and awaiting for corrections to the code!