WIP GRAVEDIGGER Monster Truck

Ok, after a LARGE learning curve, here's a modified awd.rsx
Code:
// AWD script for Gallardo and other cars with similar awd system.
// The real car uses an in-line viscous coupling with a driveline set up with a static front/rear differential to give ~ 95% rear torque and 5% front
// In this case we set the specs for the power_gearing 'hack' to work, along with the static bias of the torque split
// Because of the in-line nature of the viscous diff in this case, we can roughly say that with a large front/rear differential the more locking we see
// But because the front wheels can 'fly away' way beyond the real diff/engine speed due to the power_gearing AWD hack, we also send torque back to the rear
// if the front/rear axle differential gets large (to the front)
// So basically, lots of rear slip, send torque to the front (up to 50% in theory, though it never reaches that in most normal situations), when fronts start
// slipping too fast, as they will with lots of torque, then trim the torque to them and send it back to the back. Ultimately the car is as 'fwd' as it can be
// without the front pair spinning a small percentage more than the rear axles speed (though in real life this may occur any way due to inertia and varying rear
// wheel speeds in transient conditions)
// This is as good a fudge as we can get and in my view drives nicely enough for this type of AWD installation.

rcar $car=get scriptowner car

float $finaldrive = 17.5
float $finaldrivel = 17.5
float $finaldriveh = 13.5
float $staticbias = 50

float $slipratiof
float $slipratior
float $rot_front_slip
float $rot_rear_slip

float $rot_front_diff
float $rot_rear_diff
float $bias_ratio

float $ramp = 1.01

//How often to run the script (ms), throttles the ramp rate above too. A longer duration means faster FPS for now.
float $frequency = 5

float $powergearing
float $finalbias = 50
float $maxtorque
int $autodiff = 1
float $slipfront
int $gearkey
int $autogb = 1

while 1
{
    if $finalbias == 0
    {
        $finalbias = $staticbias
    }
    if $autogb > 0
    {
        send "automatic" to console
        $autogb = 0
    }
    $gearkey=is key 65 pressed
    if $gearkey > 0
    {
        send "automatic" to console
    }
    $gearkey=is key 77 pressed
    if $gearkey > 0
    {
                send "manual" to console
    }
    $gearkey=is key 71 pressed
    if $gearkey > 0
    {
        $finaldrive = $finaldriveh
        set system "car0.differential0.ratio" to $finaldrive
        echo "High Final Drive selected"
    }
    $gearkey=is key 70 pressed
    if $gearkey > 0
    {
        $finaldrive = $finaldrivel
        set system "car0.differential0.ratio" to $finaldrive
        echo "Low Final Drive selected"
    }
    $gearkey=is key 86 pressed
    if $gearkey > 0
    {
        $staticbias=75
        $autodiff = 0
        echo "25/75 Locked Front/Rear bias selected"
    }
    $gearkey=is key 66 pressed
    if $gearkey > 0
    {
        $staticbias=50
        $autodiff = 0
        echo "50/50 Locked Front/Rear bias selected"
    }
    $gearkey=is key 78 pressed
    if $gearkey > 0
    {
        $staticbias=25
        $autodiff = 0
        echo "75/25 Locked Front/Rear bias selected"
    }
    $gearkey=is key 72 pressed
    if $gearkey > 0
    {
        $staticbias=50
        $autodiff = 1
        echo "Automatic Front/Rear bias selected"
    }
    //Calculate the diff bias
    $rot_front_diff = sqrt (pow((get system "car0.wheel0.rotvel") + (get system "car0.wheel1.rotvel")) to 2)
    $rot_rear_diff = sqrt (pow((get system "car0.wheel2.rotvel") + (get system "car0.wheel3.rotvel")) to 2)
    $bias_ratio = ($rot_front_diff - $rot_rear_diff) / ($rot_front_diff + $rot_rear_diff)
    if $rot_front_diff < 0.4
    {
        $bias_ratio=0
    }
    if $rot_rear_diff < 0.4
    {
        $bias_ratio=0
    }
    float $absbias = abs $bias_ratio
    if $absbias <0.1
    {
        $bias_ratio=0
    }
  
    float $rampval=($bias_ratio * $frequency)
    if $bias_ratio < 0
    {
        $finalbias -= 1
    }
    if $bias_ratio > 0
        {
        $finalbias += 1
        }
    if $bias_ratio == 0
        {
        }
if $finalbias >100
{
            $finalbias = 100
}
if $finalbias <1
{
            $finalbias = 1
}

if $autodiff == 0
{
    $finalbias = $staticbias
}
          
    $powergearing = ((($finaldrive * (100 - $finalbias)) / $finalbias) / 2)*0.9
  
    $maxtorque = $finalbias
    if $rot_front_diff and $rot_rear_diff < 4
    {
        $maxtorque = 100
    }
  
    //Set the diff bias
    set $car wheel 0 powergearing $powergearing
    set $car wheel 1 powergearing $powergearing
// echo "PG "+$powergearing
// echo "MT "+$maxtorque
    set $car maxtorque factor ($maxtorque / 100)
  
    wait $frequency
  
    interrupt
}
I've uploaded new zips with this & some other minor changes, same links as before.
The major changes are with the AWD keys, which are now:
f= low final drive
g=high final drive
h=Automatic front/rear bias split ( the script calculates slip on front/rear wheels & adjusts the bias accordingly, moving between 0/100 & 100/0 as required)
v=25/75 front/rear FIXED bias split
b=50/50 front/rear FIXED bias split
v=75/25 front/rear FIXED bias split
a=automatic gearbox
m=manual gearbox
Now by default Automatic Gearbox & Automatic front/rear bias split are selected
 
I tried it but apparently it won't even let me select it without bringing up this error.
Code:
Tue Jan 14 00:00:50 (FATAL): [racer] DGPUShaderManager:MakeObject(data/cars/gravedigger/cg/dyn_modified_wave_v.cg): can't create CG vertex shader program
The compile returned an error.
data/cars/gravedigger/cg/dyn_modified_wave_v.cg(76) : warning C7011: implicit cast from "float4" to "float3"
data/cars/gravedigger/cg/dyn_modified_wave_v.cg(82) : warning C7011: implicit cast from "float4" to "float3"
data/cars/gravedigger/cg/dyn_modified_wave_v.cg(86) : warning C7011: implicit cast from "float4" to "float3"
data/cars/gravedigger/cg/dyn_modified_wave_v.cg(79) : error C1008: undefined variable "LogZ2"
data/cars/gravedigger/cg/dyn_modified_wave_v.cg(79) : error C1008: undefined variable "zFar" [%s]
edit: switching to the shader supplied by Racer removes the error so it can be driven.
 
Last edited:
Hey there I just downloaded the mods to day and the truck and map arnt showing up in the game but in the content manager the truck is showing these errors (File "ui car.jason" is missing , Brand's badge is missing , Skins are missing
 

Latest News

Are you buying car setups?

  • Yes

  • No


Results are only viewable after voting.
Back
Top