The online racing simulator
rev limiter
(198 posts, started )
rev limiter
Its impossible..
It isn't. Using OutGauge and InSim, you could simply use the ignition key to reproduce the bouncing effect.
Pseudocode
if(revs > (max_revs[car] - 100))
{
send IS_SCH with ignition key;
sleep(.5);
send IS_SCH with ignition key again;
}

Quote from morpha :It isn't. Using OutGauge and InSim, you could simply use the ignition key to reproduce the bouncing effect.
Pseudocode
if(revs > (max_revs[car] - 100))
{
send IS_SCH with ignition key;
sleep(.5);
send IS_SCH with ignition key again;
}


can u make that work?
I know of multiple persons on this forum who made a limiter, but are not willing to share it with the public.

@morpha, sending keys which lfs uses is not possible.
Quote from mikey_G :@morpha, sending keys which lfs uses is not possible.

Really? So what's the packet there for then? There's no point in sending a character that doesn't do anything, or am I missing something?
Maybe backfire mod and change the sound?,dunno never used it
Yep it will be cool if some one make it to work Drifters dreams xD
if i knew how to do it i would, some one should try it if they have some spare time or if someone does have it, they should give us an idea to run with and make this easier because i don't think anyone would mind having a rev limiter. Then maybe it will end up in a patch so everybody has it!
a bounching limiter would just be kickass! its one of the things i think lfs lacks, a little engine tune catalog or watherver, like you could set the limiter yourself and change dimm's on rims and tyres etc....not like nfs but some options for the engine, changing the intake\outake cam's angle degree...so you get to choose yourself where on the rpm specter the engine works the best so on....hehe should be a little like street legal redline
Sending keys to lfs is not a problem - lfs_strobe does it
If anyone is interested in doing such app here is a bit of code for c#:

[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern byte VkKeyScan(char ch);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true, CallingConvention = CallingConvention.Winapi)]
public static extern short GetKeyState(int keyCode);

public const int KEYEVENTF_EXTENDEDKEY = 0x01;
public const int KEYEVENTF_KEYUP = 0x02;

private byte BreakCode(char ch)
{
switch (Char.ToUpper(ch))
{
(...)
case 'I': return 0x97; break;
(...)
}
return 0x00;
}

private void KeyPress(char ch)
{
keybd_event(VkKeyScan(ch), BreakCode(ch), 0, 0);
keybd_event(VkKeyScan(ch), BreakCode(ch), KEYEVENTF_KEYUP, 0);
//backspace key to not interfere with chat
keybd_event(0x08, 0x8E, 0, 0);
keybd_event(0x08, 0x8E, KEYEVENTF_KEYUP, 0);
}
private void KeyDown(char ch)//keeps it in pressed state
{
keybd_event(VkKeyScan(ch), BreakCode(ch), 0, 0);
//backspace key to not interfere with chat
keybd_event(0x08, 0x8E, 0, 0);
keybd_event(0x08, 0x8E, KEYEVENTF_KEYUP, 0);
}
private void KeyUp(char ch)//cancel above
{
keybd_event(VkKeyScan(ch), BreakCode(ch), KEYEVENTF_KEYUP, 0);
}


happy coding
lol can you done this
I have too much to do now, but if some1 would be kind enough to give me sample code for outsim of reading current revs + car name (for profiles) i would merge it in no time.
anyone made this?
I think no, too much work.
Quote from moskvich3v1 :Yep it will be cool if some one make it to work Drifters dreams xD

yes i'd love that, drifting sideways, bouncing off the rev limiter
Did anyone made a made one yet. A real Rev-Limiter would sound cool in LFS
somebody plz make this rev limiter
There isn't any programers who can made this?!?!?
Please some 1 to try to make this
#21 - 13OB
Quote from Tommy :I have too much to do now, but if some1 would be kind enough to give me sample code for outsim of reading current revs + car name (for profiles) i would merge it in no time.

Couldnt you get one from CSR(Car Sound Remixer) or ask the person who made it?
Had some free time today (4h to be specific) and used it to write some beta ver. of this program. Overall it works. Too bad the outcome wasn't like I imagined

Using outgauge I cannot read if the cars engine is on or off. Combine that with very short "I" key strokes and it goes easy out of sync (since I can only assume that the engine is "on" at start). On the other hand, raising delay between key strokes would kill the old school rev limiter effect.

Anyway here is the 0.1 beta version
http://manta.univ.gda.pl/~tsulkows/lfs_revlimiter/

read the "Install.txt" file to get it working properly.

Lfs Rev Limiter v0.1
====================
Its only a test program - the idea was cool but the outcome isn't...

What you need
=============
.Net framework 2.0 at least

Intall guide
============
1) LFS
- Open your cfg.txt file located in main LiveForSpeed folder
- Somwhere at the bottom you will find:
(...)
OutGauge Mode ?
OutGauge Delay ?
OutGauge IP ?.?.?.?
OutGauge Port ?
OutGauge ID ?
(...)
Where ? stands for a number
- Change it to:
OutGauge Mode 2
OutGauge Delay 5
OutGauge IP 127.0.0.1
OutGauge Port 11222
OutGauge ID 2
*Note that "Outgage Delay" has some impact on program response - experiment with it (values between 1 - 50 or more)

2)Files
- Copy "LfsRevLimiter.exe" and "LFS_External.dll" anywhere on your disk, but DO NOT SEPARATE THOSE FILES. LfsRevLimiter.exe uses LFS_External.dll to catch outgage packets and it must be in the same dir.

3)Start up lfs, then lfs revlimiter.

4)Change the trackbars value at the bottom of program to suit you - its the delay in ms between each "I" key press_and_depress cycle.

(cycle is: Press I, wait trackbar_value ms, depress I, wait 10ms, see if the cycle needs to be done again - for example revs have dropped under rev limit)

NOTES
=====
- Program works best if rev limiter is set quite high - close to real rev limiter.

BUGS
====
- lfsrevlimiter going out of sync with cars engine state
Its the main problem why I have gave up working on this program.
Problem is that there is no possibility to read if the cars engine is on or off. Assuming that its "on" while program starts, every time "I" is pressed, it changes engines ignition. Problem is that when key is pressed for shorter time then 17ms (at least on my computer) it sometimes isnt recognised by lfs, so it goes out of sync while emulating oldschool revlimiter - pressing "I" manually puts it back in sync again for short time.
Workaround? I could read if user is pressing gas pedal and asume that if revs are dropping that it has gone out of sync... but what if your in the middle of climbing a hill etc.

- nullpointer exception caused by lfs_external library... didn't have time to properly debug it, but turning lfs and lfsrevlimiter off and on again does the job

Quote from Tommy :Had some free time today (4h to be specific) and used it to write some beta ver. of this program. Overall it works. Too bad the outcome wasn't like I imagined

Using outgauge I cannot read if the cars engine is on or off. Combine that with very short "I" key strokes and it goes easy out of sync (since I can only assume that the engine is "on" at start). On the other hand, raising delay between key strokes would kill the old school rev limiter effect.

Anyway here is the 0.1 beta version
http://manta.univ.gda.pl/~tsulkows/lfs_revlimiter/

read the "Install.txt" file to get it working properly.

Lfs Rev Limiter v0.1
====================
Its only a test program - the idea was cool but the outcome isn't...

What you need
=============
.Net framework 2.0 at least

Intall guide
============
1) LFS
- Open your cfg.txt file located in main LiveForSpeed folder
- Somwhere at the bottom you will find:
(...)
OutGauge Mode ?
OutGauge Delay ?
OutGauge IP ?.?.?.?
OutGauge Port ?
OutGauge ID ?
(...)
Where ? stands for a number
- Change it to:
OutGauge Mode 2
OutGauge Delay 5
OutGauge IP 127.0.0.1
OutGauge Port 11222
OutGauge ID 2
*Note that "Outgage Delay" has some impact on program response - experiment with it (values between 1 - 50 or more)

2)Files
- Copy "LfsRevLimiter.exe" and "LFS_External.dll" anywhere on your disk, but DO NOT SEPARATE THOSE FILES. LfsRevLimiter.exe uses LFS_External.dll to catch outgage packets and it must be in the same dir.

3)Start up lfs, then lfs revlimiter.

4)Change the trackbars value at the bottom of program to suit you - its the delay in ms between each "I" key press_and_depress cycle.

(cycle is: Press I, wait trackbar_value ms, depress I, wait 10ms, see if the cycle needs to be done again - for example revs have dropped under rev limit)

NOTES
=====
- Program works best if rev limiter is set quite high - close to real rev limiter.

BUGS
====
- lfsrevlimiter going out of sync with cars engine state
Its the main problem why I have gave up working on this program.
Problem is that there is no possibility to read if the cars engine is on or off. Assuming that its "on" while program starts, every time "I" is pressed, it changes engines ignition. Problem is that when key is pressed for shorter time then 17ms (at least on my computer) it sometimes isnt recognised by lfs, so it goes out of sync while emulating oldschool revlimiter - pressing "I" manually puts it back in sync again for short time.
Workaround? I could read if user is pressing gas pedal and asume that if revs are dropping that it has gone out of sync... but what if your in the middle of climbing a hill etc.

- nullpointer exception caused by lfs_external library... didn't have time to properly debug it, but turning lfs and lfsrevlimiter off and on again does the job


Very good addon i very like it! I want it to Offical addon to LFS!!!

Bugs: -Rev limiter.exe still in task after exit (next start is freeze)
-When the RPM not going to the specifed limit the engine is off.
-When you want to change the limit twice the limit still in 25000

Thx for the addon,pls say to Scawen to take it to LFS
forgot to kill the outgauge thread on program exit... fix in 5 min's

Edit:
After fine-tuning delay times it started to work properly - no more out of sync.
It appears that 17ms (my computer) is needed not only for keeping key pressed but also between another key stroke (previously 10ms)
You now just need to set delay as low as possible but high enough so it won't go out of sync... and it will never go

Now I will add profiles for each car, automatic save for each setting and some other stuff
LolTommy very nice addon mate
Is there a way to fix that bugs
When i set it on 10 ms or on 17ms it still going bam bam only two times and then the engine go off I can't set rpm limit more than 9000rpm maybe becouse i am trying this programm on X Thanks!!!

rev limiter
(198 posts, started )
FGED GREDG RDFGDR GSFDG