The online racing simulator
Searching in All forums
(59 results)
Tommy
S3 licensed
If anyone is interested, here is final version of my program made for master degree:
http://sigma.univ.gda.pl/~tsulkows/TrafficSym.rar

It uses technology mentioned earlier - works good
To run it you need probably this: http://www.microsoft.com/downl ... 799EF2&displaylang=en (xna libs - directx addon for .net)

User cannot do much when the app is running - select one car and steer it a bit with cursors, ai does the rest. press "1" to see maps generated with LBM.

Documentry on how to create a whole new junction would take few pages (lots of file manipulation) of description, so take it only as a demo

Back to topic: drop in lfs map, set xml file properly, add a lfs<->trafficsym interface (tricky part) and voila, you just got yourself an autopilot
Tommy
S3 licensed
It turns out that my uni had some server problems and moved all acounts to other place.

Current download link is:
http://sigma.univ.gda.pl/~tsulkows/lfs_strobe
Tommy
S3 licensed
It turns out that my uni had some server problems and moved all acounts to other place.

Current download link is:
http://sigma.univ.gda.pl/~tsulkows/lfs_revlimiter/
Tommy
S3 licensed
Check if "ignition" is bind to "i" key in options. Program sends "i" key strokes and those may be not interpreted corectly by lfs.
Tommy
S3 licensed
It will work properly - every car name and settings are stored in a HashSet which key is car name given from the outgauge library directly (in worst case scenario settings will be lost).
If not i will write some quick patch
Tommy
S3 licensed
Im using an already made .net library that handles the outgauge - works perfectly

There are no event handlings just very fast refreshes using timer thingie.
When I get back home I will send you sources to speed up your project a little
Tommy
S3 licensed
I didnt thought that it would be downloaded so many times
its just a small demo app

anyway here is a link that will stay for long http://manta.univ.gda.pl/~tsulkows/temp/TrafficSym.rar
Tommy
S3 licensed
Well my idea was to implement cellular automata - lattice gas and steer the car with the current of the gas flow (so one wouldn't have to draw lines or areas but make some kind of walls to direct the gas flow). But idea proved to be great while simulating lots of cars, not one
Tommy
S3 licensed
Before I found my final masters degree subject (traffic simulator) I WAS thinking about autopilot for cruise servers - while driving slow, current car direction could be calculated from previous positions exactly.

So there you go: you have direction, position. Drop in a fixed line for a robot to follow and you have an autopilot. Problem was that there isn't enough "academic" thingies to put there so I dropped the idea.

But it is quite easy to do.

look here http://rapidshare.com/files/24 ... 2/TrafficSym_pre.rar.html (.net 2.0 required) - made a simple "follow line" ai some time ago (just steer it to nearest road using WASD)

In conclusion, learn to program and try to make program like this - you will be amazed how easy it is to make

hehe, JJ - good point... good point...
Tommy
S3 licensed
To be specific: it keeps current char in "pressed" state (+sends backspace press quickly) until time for next char comes.

thx JJ for helping me out
Tommy
S3 licensed
If program reports that the selected car is None (when driving one) then you probably have problem with proper outgauge configuration. Config lines should not be doubled (e.g. line containing "OutGauge Mode" occurs more than once in file)

@Rolverts - check if the cfg.file has a "archive" flag on it - it shouldn't
Tommy
S3 licensed
ok, so:
- launch control (user set revs) turned on with a button, that turns off after certain speed (or a button)
- compatibility with monks multi outgauge program

i will write something as soon as I pass the exam session
Tommy
S3 licensed
Well I consider project as finished since it works well.
I could optimize it to get less out of sync situations, but that would only fix 10% of it at most.

So the question is what could it do more? (considering revs only)
Tommy
S3 licensed
Happens to me also - but quite the opposite - siren sometimes go off.

"UseHorn" switch seems to be the problem. As requested by someone, it turns off/on the horn when selected function key is pressed (shift,ctrl,alt). For unknown reason lfsstrobe sometimes does detect it as pressed... It may be caused by keyboard (I have heard that some special keys are a combination of ctrl+alt+smth :schwitz.
I am going to update lfsstrobe with a function to disable "UseHorn" switch.

btw. I have heard some ppl had problems with download link - I think its because of the filename with version attached to it (*1.2.exe for example) so old direct links to the app are not valid. Download is placed on my uni account which should be reliable

Main dir is indexed so you can always find latest version here: http://manta.univ.gda.pl/~tsulkows/lfs_strobe/

If the link really doesnt work just send me a pm - I didnt get any concerning dead link so far
Tommy
S3 licensed
Well detecting if indicator is on is near impossible - no outgauge or insim packets contain such info. but that can be done such way that indicators will be turned on by other buttons, while app will press coresponding buttons according to current status.

But the main problem is turning them off - again no insim or outgauge packets contain information about how much steering wheel is turned nor direction. That can be done in a way gps guess direction of driving - by taking position and comparing it to last position to get direction of drive - it could compute degree of turn as well.

I had an idea to make auto-pilot for cruise servers for my MSc and that was my idea to get direction of cruise, but thats a long story...

Back to topic: its not that easy as it seems
Tommy
S3 licensed
When I tried setups posted here there is one general mistake - they are not causing oversteer and focus on rear-end braking, drifting is not ass-dragging.

in previous ai ver they could easily drift 80% of track corners with proper set - now its a bit tricky but still works.

I tried to make very unbalanced set but still controllable.
The key seems to be toe in (max positive on front, max negative on rear), then tire pressure (min in rear) and lastly camber to cause maximum oversteer.

My favorite is fz5 because it has most weight on rear tires and it tends to pull rear out of corner, but for some reason rb4 (rwd spec) seems to do best drifts under AI controll
Tommy
S3 licensed
your welcome

as I have written before it was made only for test - running it during online race is risky... and it is not recommended

About the bugs:
program should run flawlessly when you have:
- .net framework 2.0
- changed the config file properly, as written before
Tommy
S3 licensed
Made an update for lfsrevlimiter

Current version 0.9 - almost alpha
http://manta.univ.gda.pl/~tsulkows/lfs_revlimiter/

- Added preview video.
- Settings as well as revlimit for each car is saved on program exit.
- Optimized algorithm a bit to prevent desync.
- More user-friendly

To set delay properly:
first set it quite high (around 50) and test if it works good in lfs, then lower it a bit and test again - do it until you find lowest value where lfs_revlimiter doesn't get out of sync with lfs.
Tommy
S3 licensed
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
Last edited by Tommy, .
Tommy
S3 licensed
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

Tommy
S3 licensed
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.
Tommy
S3 licensed
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
Tommy
S3 licensed
Quote from Cue-Ball :That is not the behavior that I've seen. I ran multiple races yesterday with AI drivers. During at least two races where compulsory pit was turned off, the AI drivers DID pit for fuel. The did not pit for damage or tires, and they did not pit during timed races (1+ hour), but they did stop during long races for fuel. The problem is that they all stop on the same lap and crash each other out in the pits.

I didnt have time to test it on endurance race, but what i meant is: i start race with 4 laps so they have ~3laps of fuel, then set /laps 30

and watch them pit every 3 laps to test... well they dont do it when compulsary pitstop is off but when its on, they pit for fuel, tires AND damage - the way it should be.
Tommy
S3 licensed
Ai behaves ok (pitting) when server has compulsory pitstop = on, but when it doesnt, they NEVER pit.

Instead of calculating pitstops on start of the race, they should do it dynamically, like 200m before pitlane:
im_damaged_a_little && have_1min_advantage = dont pit
but, im_damaged_hard = pit.

while damage == structural damage && tire worn
some simple function would do here.

Coming out of the pit at start they should let pass whoever is on the main straight in the pit (now they crash into each other)

Coming into pits, "pitting guide lane" should be done so that they wont go over other pit boxes;
they have to watch for other racers coming out of their pit boxes.
Tommy
S3 licensed
Quote from Darkstar07 :hey I've been trying to use your strobe file, but every time I turn it on, my view stars zooming in and I cant stop it from doing that...could you plz tell me if im doing something wrong...could it be because im using Vista, or is the program meant to do that? I just don't know what's wrong

Check your key binds - if pressing certain key changes your fov, bind it to other1. Vista is 100% .Net compatible so that shouldn't be the issue.
FGED GREDG RDFGDR GSFDG