The online racing simulator
"Real life" camera pitch/roll with InSim
This is a poorly written python program that uses InSim and OutSim to level the camera relative to the horizon.

Updated to work with Z30, now with working joystick look axis: http://www.mediafire.com/file/igz89t86gpljfnz/camlevel2_2.7z

Here's a video showing what it does: http://www.youtube.com/watch?v=uLVUq_Ex2H4

It's terribly primitive and doesn't do much error checking, so if too much goes wrong it'll either lock up or just quit. I haven't tested it online, so that may not work at all, or maybe only work if the server isn't using InSim. I've tested it on my computer using XP Home SP3 32 bit and Windows 7 64 bit.

So, first download the file and decompress the archive (it's a 7-Zip file if you can't open it,) wherever you find handy as it doesn't need to be installed.

To use your controller to look left/right, first run configure_controller.exe. It will (should) print a list of any game controllers on your system. Enter the ID of the correct one and hit enter. Then type 1 or 2 and enter to indicate if you want to use buttons/hat or a joystick axis. Then it will prompt you to hit the button or hat direction that will look left. Then it will do the same for the right button/hat. At this point it'll create (or overwrite) a file named input_cfg.txt and exit. Looking left/right won't work with the keyboard and/or mouse, sorry.

Next, run camlevel.exe. It should start up and start attempting to connect to the port listed in the camlevel_cfg.txt file. Start LFS and hit the / key to get the message prompt. Type /insim 10100 and hit enter, although if you've changed the default port enter that instead. In a moment you should get a message in LFS saying camlevel has connected and that OutSim is enabled. Then go driving around and see if you like or hate the effect. It seems to work better if you're not using the in-game camera acceleration shifts, but your mileage may vary.

The camlevel_cfg.txt file contains various settings:

The first two lines are self-explanatory, the InSim and OutSim ports it attempts to connect to.

Next are the pitch and roll multipliers. They control how close to the horizon (besides the averaging described next) the camera is kept level. 1.0 means always level with the horizon, 0.0 meaning not at all (like the normal LFS camera.)

Next is the averaging window, which is the length of time over which the camera will attempt to return to the level of the car interior. This helps keep the camera angle from getting nauseating on the corners of KY1 for example. It is defined in hundredths of a second so 100 would be one second.

The averaging multiplier controls how far back to the level of the car the averaging returns to, 1.0 being all the way and 0.0 being not at all (no averaging.)

The camera average tells LFS how long to take (in thousandths of a second) to move the camera to each new angle, so the movements are smooth instead of jerky. This probably doesn't need to be changed, but it might be different if your computer is faster or slower, I'm not sure.

Then there are the pitch and roll limits. These will keep the camera from pitching or rolling beyond those limits, which will keep the camera from going too bonkers if you roll the car.

Next, there's the angle the camera goes to when looking left or right, and the second angle the camera goes to when holding down both look buttons, just like in LFS. The look_angle2 line also sets the view angle when at maximum deflection with a joystick axis.

And last, a fixed amount of pitch to add to the final pitch angle.
where i put this?
Just decompress the .zip and run camlevel.exe when a race or replay is running, it shouldn't need to be in any specific folder.
Oh, and I just updated it slightly so the pitch and roll are only half leveled, which looks a little nicer.
Nice, a bit too subtle maybe?
It's wonderful. But i have some problems here

When i leave the race/replay for go to pits or lfs main menu, the program will close, and i need to open it again aways if the race start.

But the rest, really wonderful. 9/10 (-1 because some problems)

Please keep up the project

Thanks.
Quote from hugoluis :When i leave the race/replay for go to pits or lfs main menu, the program will close, and i need to open it again aways if the race start.

I changed it so it should stay open, but as the computer I have here at work can't really run LFS I wasn't able to test it very well.
Hey! This is very good - much smoother, imo, than the stock way LFS handles camera motion. I haven't played much, only a few laps with it on, but it was pretty much intuitive and felt natural right away with the stock settings. I'll definetely be keeping an eye on this one.
5 stars from me, this is incredible!
This by far for some reason makes LFS feel far more realistic when using the in-car cam.

Many games nowadays like PGR have this effect, and I think LFS really should have this at some point in time because it really adds a realistic effect to the game.
Whenever I try running it, it says password does not match you multiplayer admin password.

[edit] I got it to run by removing all my multiplayer passwords and my create host passwords. Weird this always (to be tested) happens to me when I try running an insim program. :l

+100! The dev's should really make something like this in the upcoming patches.
is there some setting that you've neglected to tell us what to set it to? or some setting in LFS to set to? because it doesn't do anything for me.
I'm absolutely loving this! This HAS to be implemented in LFS - it may be an option or not for those who don't like it, but I do.

Especially when driving to quickly across a hill my stomach floats some centimetres up from where it's intended to be - crazy!!! And btw, just like in real life!

Please stick on!
Quote from burnsy1882 :is there some setting that you've neglected to tell us what to set it to? or some setting in LFS to set to? because it doesn't do anything for me.

Did you type /insim 10000 and get a message in the top left corner saying "InSim : port 10000"?

After doing that you can start camlevel.exe and you should see two messages in LFS: "InSim - TCP: CamLevel (UDP port 10001)" and "OutSim : enabled". Then, until a race is going, it should time out and reconnect over and over until a race is going, with "Timed out" showing up in the camlevel.exe window and "InSim guest closed : CamLevel" in LFS followed by the inital connection messages. If you're running a firewall it could interfere with InSim packets too, so you may need to adjust its settings.

I've only tested it on XP and 2000, so there could be missing .dll or other problems with 98 and/or Vista.
no, i get all those.

ok, after some testing, i think that it only works if it's you in the car, not spectating other people on a server. nor does it work on MPRs, but i could be wrong. am i correct?
Quote from burnsy1882 :but i could be wrong. am i correct?

You are wrong in stating you might be wrong but correct in your initial assumption. It needs to have a view that produces OutSim data in order for it to work.

Tinkering a little more with it - I think the effect is a little disorienting on highly banked curves like oval sections in Kyoto but spot-on for "normal" conditions.
ok, thanks.

then, this is a cool app, makes the racing look a lot more real. good job.
nice idea works really well and gives a surprisingly good feel for what the car is doing

the only problem i see is that it doesnt work all that well on steep hills like eg the chicane at aston
Quote from Shotglass :nice idea works really well and gives a surprisingly good feel for what the car is doing

the only problem i see is that it doesnt work all that well on steep hills like eg the chicane at aston

You might try setting the third line in the camlevel.cfg file to 0.5 or 0.75. If the banking in KY1 gets too disorienting you can set the fourth lower as well.
Hmmm...
Reducing the roll multiplier kinda kills it for riding over curbs and smaller violent or just quick motions. Perhaps acceleration needs to be taken into consideration or just have max limits and sensitivity settings? Right now even with 0.5 multiplier on the banked turns it is very weird as it "sends" the cockpit way off to a lower corner of the screen - makes it fun that it sort of makes you want to tilt your head but a bit annoying because you end up with a traveling dashboard. This is quite pronounced in the singleseaters. Sadly as I usually play on KY2 & 3 then I can't just use one setting that would make it look okay just for the oval section.

As it stands though, for normal turns, bumps and curb-riding the effect is great. Looking forward to further development.
Added limiters so you can control how far the pitch and/or roll gets adjusted.
Ah... much better now! I dumped the nasty limiter and added averaging which does a much better job of leveling out banking and elevation changes.
Very nice!

I changed the pitch and roll leveling to 0.5 and 0.5. If they're at 1.0 your head stays unnaturally level with the horizon no matter what the car's doing; it's like you're the stig. If you have a bouncy setup and accelerate/brake/accelerate/brake it's not good. 0.5 seems to be a good comprimise
#23 - Jakg
"InSim guest closed : CamLevel"

Every time i start a race running this :X
Quote from Rotareneg :Ah... much better now! I dumped the nasty limiter and added averaging which does a much better job of leveling out banking and elevation changes.

Amen - this is much much better... now if only we could turn the view right and left (no problem if it's an extra hotkey [command with an insim prefix or something] and doesn't use the in-game left+right)...

EDIT:
Oh yes: it also won't let you enter the editor/free camera view (shift-u).

As a sidethought - maybe an extra command to enable/disable camlevel on the fly would be handy?

PS: If you flip the car over with CamLevel enabled it's hilarious - it's like you're not wearing a harness and you're tumbling inside the car like it's a washing machine.
Quote from Jakg :"InSim guest closed : CamLevel"

Every time i start a race running this :X

Hmm, you might try changing the insim and/or outsim port it uses (first and second lines in the config file,) just in case something is conflicting with them. What happens if you load camlevel.exe again once you start racing?

FGED GREDG RDFGDR GSFDG