Not yet, I'll probably try the WP functions first...
Any hints on building/implementing this new feature/system in our tracks ?
Any hints on building/implementing this new feature/system in our tracks ?
rcar $car=get scriptowner car
float $rpm
float $request
float $maxtorque
float $boost
float $maxthrottle = 1
float $speed = 0
float $spool = 2.5
float $friction = 1.5
while 1
{
$request = get $car throttle
$rpm = get $car rpm / 1000
//stops turbo spinning backwards (friction will be 0 at 0 speed, so it'll stop slowing down)
//or spinning on forever (artifical limit to simulate wastegate or running out of efficiency etc)
if $speed > 1000
{
$speed = 1000
}
else if $speed < 0
{
$speed = 0
}
else
{
$speed = $speed + ($request * $spool) - $friction
}
$boost = ((0.0179 * (pow $rpm to 2)) - (0.16 * $rpm)) + 1.0431
$maxtorque = ($request * $boost) + (($maxthrottle - $boost) * $request * ($speed/1000))
set $car throttle $maxtorque
paint ($speed) at float[2]{650,125}
paint ($boost) at float[2]{650,100}
paint ($maxtorque) at float[2]{650,50}
interrupt
}
Pardon my ignorance Dave, but how would this be any different than just modding the torque curve to reflect the turbo kicking in. Most modern turbo system go to great length to be as lag-free as possible.
Not trying to discourage any coding for certain. Just confused.
Alex Forbin
rcar $car = get local car
float $throttle = 0
float $gear = 2
float $rpm = 1000
float $mindownrpm = 2500
float $maxdownrpm = 5500
float $minuprpm = 3900
float $maxuprpm = 7900
float $shiftpoint = 0
while 1
{
$throttle = get $car throttle
$gear = get $car gear
$rpm = get $car rpm
// shift down?
$shiftpoint = $mindownrpm + $throttle * ($maxdownrpm - $mindownrpm)
if $rpm < $shiftpoint
{
if $gear > 2
{
set $car gear ($gear - 1)
}
}
$shiftpoint = $minuprpm + $throttle * ($maxuprpm - $minuprpm)
if $rpm > $shiftpoint
{
if $gear < 7
{
set $car gear ($gear + 1)
}
}
interrupt
}
3 // number of throttle settings
3 // number of gears
4 // column width
0 0.5 1 // throttle
10 15 18 // 1st to 2nd
20 30 35 // 2nd to 3rd
13 20 23 // 3rd to 2nd
7 12 14 // 2nd to 1st