Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Pages: 1 ... 4 5 [6] 7 8

Author Topic: Vehicle script [version 1.4.0]  (Read 42974 times)

John514

  • Hero Member
  • *****
  • Posts: 543
  • Certified TARDIS driver.
Re: Vehicle script [version 1.4.0]
« Reply #75 on: August 01, 2013, 03:49:45 pm »

I cant test the script now since I`m on a Integrated Gfx Laptop but how is the vehicle behaviour on this one?
What I cant stand on Outerra is that on higher speeds the vehicles behave like there is no weight or downforce, often spinning out and flipping. I`d like to see some nice and heavy handling for a change.
Logged
You mustn't be afraid to dream a little bigger, darling

Note: I do not claim to know everything.
I just like to help people around the forum.

mLichy

  • Full Member
  • ***
  • Posts: 104
  • newbie
Re: Vehicle script [version 1.4.0]
« Reply #76 on: August 01, 2013, 07:50:25 pm »

Yeah. Part of that is messing with suspension limits and weight.
But even still, if u hit small rocks u go tumbling.

Part of the flipping though could be damped if the body could collide instead of only tires.
Logged

John514

  • Hero Member
  • *****
  • Posts: 543
  • Certified TARDIS driver.
Re: Vehicle script [version 1.4.0]
« Reply #77 on: August 02, 2013, 01:08:45 am »

Right, lets wait for that!
Logged
You mustn't be afraid to dream a little bigger, darling

Note: I do not claim to know everything.
I just like to help people around the forum.

PytonPago

  • Hero Member
  • *****
  • Posts: 2253
  • It´s way too complex, dont let me try to explain !
Re: Vehicle script [version 1.4.0]
« Reply #78 on: August 02, 2013, 07:01:11 pm »

Yeah. Part of that is messing with suspension limits and weight.
But even still, if u hit small rocks u go tumbling.

Part of the flipping though could be damped if the body could collide instead of only tires.

There seems to be a little problem at such speeds, that those forces do not get partially consumed when hitting the ground. Maybe some script, that by some exceeding speed (or on a speed function dependance base) the force, witch the dumpers compensate, will be significantly reduced. So it doesn't try to jump away. ... but still, if there would be possible to make a "broken" script, where, if the force exceeds a certain value, the "axes break" - thus making the stiffens go zero, disable the force feed to it (maybe even invert it or make it resist the movement notion of the rest of the car in some way). There could be even a lighter version for just get a flat tire.
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

John514

  • Hero Member
  • *****
  • Posts: 543
  • Certified TARDIS driver.
Re: Vehicle script [version 1.4.0]
« Reply #79 on: August 04, 2013, 03:00:05 pm »

To be honest, I`d like THAT kind of driving in Outerra.
It would be the best Rally Game EVER!

Logged
You mustn't be afraid to dream a little bigger, darling

Note: I do not claim to know everything.
I just like to help people around the forum.

PytonPago

  • Hero Member
  • *****
  • Posts: 2253
  • It´s way too complex, dont let me try to explain !
Re: Vehicle script [version 1.4.0]
« Reply #80 on: August 04, 2013, 04:59:59 pm »

Had an idea ... many trucks have a second gear option - maybe a little script, saying key XY turns on/off and if on, then the RPM is aether + 120 or multiplied by 1,05 (just for example)  ?  Then, the gears will be complete and truck sims can go on.  :)
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

PytonPago

  • Hero Member
  • *****
  • Posts: 2253
  • It´s way too complex, dont let me try to explain !
Re: Vehicle script [version 1.4.0]
« Reply #81 on: August 10, 2013, 06:13:21 am »

Hi Giucam ... i got a lot of thinking about your script and what i would like to get of a car simulation out of it ... but runned on some knowledge and function problems ...

Basically, i would like to try to enhance some gear functions. Something, like adding a Max and Min for each gear instance to simulate bad gearbox entry (like trying to move from the place at the highest gear - giving an specific sound and engine turns off, or getting to a too low gear - gear-braking into the right speeds for the gear applied and with its own sound, etc. other functions like cabin gear rod animations for each and gearbox destruction).  ... i just didnt figure out yet - your engine works like inside the gearbox (just one general RPM)?      Meaning, my approach would need a separate engine RPM and on it based interactions with the gearbox (that needs its own separate RPM value based and interacting with the engines one) on each gear at the restrains mentioned.

Maybe, if there would be a way to get the sim. working, with an IF function depending on actual chassis.forwardGears ratio ? Or would it not be a much good idea to get the functions be dependent on such value ?

Im just starting to get the scripting into my head and i would rather modify your script than get to make my own complex one written, cause im not sure, if i could find the right logics and errors in it ...
« Last Edit: August 10, 2013, 06:15:40 am by PytonPago »
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

PytonPago

  • Hero Member
  • *****
  • Posts: 2253
  • It´s way too complex, dont let me try to explain !
Re: Vehicle script [version 1.4.0]
« Reply #82 on: May 25, 2014, 01:04:06 am »

Just got finally to merge my Stuff opening script with this vehicle script - found out, that there is a little problem in the way the action function is done so i made a little change to use the switch for multiple stuff :

Code: [Select]
function action(k,v,dt)
{

    switch(k){

      // Engine-needed switch part //
     
     case AAuxb1: {
         if (k == AAuxb1 && v == 0) {
            this.automaticTransmission = !this.automaticTransmission;
            this.log_inf("Automatic transmission " + (this.automaticTransmission ? "enabled" : "disabled"));
         }
     }break;
     
     case AAuxb2: {
         if (k == AAuxb2 || k == AAuxa2) {
              if (k == AAuxa2) {
                 v = 1 - (v + 1) / 2;
              }
             v = 1 - v;
             v *= v;

             this.clutchState = (v == 1 ? ClutchState.Disengaged : ClutchState.Engaged);
             this.clutch = v;
             this.clutchOverride = v != 1;
         }
     }break;
     
     case AShiftUp: {
        if (v == 1 && aShiftUpBool == true) {
           this.shiftUp();
        }

        if (v == 1 && aShiftUpBool == false) {
         aShiftUpTime = aShiftUpTime + (2 * 1);
           this.shiftUp();
        }

        if (v == 1) {
           if (aShiftUpBool == false) {aShiftUpBool = true;}
           else{aShiftUpBool = false;}
        }
      } break;
     
           case AShiftDown: {
        if (v == 1 && aShiftDownBool == true) {
           this.shiftDown();
        }

        if (v == 1 && aShiftDownBool == false) {
         aShiftDownTime = aShiftDownTime + (2 * 1);
           this.shiftDown();
        }

        if (v == 1) {
           if (aShiftDownBool == false) {aShiftDownBool = true;}
           else{aShiftDownBool = false;}
        }
      } break;
     
     
            default:
                break;
     
      // Engine-needed switch part End //
     
        //Lights

       case ALight: {

if (v == 1 && aLightBool == true) {
           this.log_inf("Light OFF");
         this.geom.set_mesh_visible_id(this.light_id, true);
         this.geom.move_joint_orig(this.pb14, {x:0,y:0,z:0});
}

if (v == 1 && aLightBool == false) {
         aOpenTime = aOpenTime + (2 * 1);
           this.log_inf("Light ON");
         this.geom.set_mesh_visible_id(this.light_id, false);
         this.geom.move_joint_orig(this.pb14, {x:0,y:-0.01,z:0});
}

if (v == 1) {
    if (aLightBool == false) {aLightBool = true;}
    else{aLightBool = false;}
}

     }break;


  //HornSound

  case AHorn: {

      if (v == 1 && aHornBool == true) {
           this.log_inf("hOONKhOONK");
      this.snd.play(1, 4, false, true);
}

if (v == 1 && aHornBool == false) {
         aHornTime = aHornTime + (2 * 1);
           this.log_inf("hOONKhOONK");
         this.snd.play(1, 4, false, false);
}

if (v == 1) {
    if (aHornBool == false) {aHornBool = true;}
    else{aHornBool = false;}
}

       }break;


  //Fire


  case AFire: {


       }break;


  case AOpen: {

      var d = this.d1.value>0 ? -1 : 1;
      this.d1.set(d);
      this.d2.set(d);
      this.d3.set(d);
      this.d4.set(d);
      this.d5.set(d);
      this.d6.set(d);
            this.d7.set(d);
      this.d8.set(d);
      this.d9.set(d);
            this.d10.set(d);
      this.d11.set(d);
      this.d12.set(d);
            this.d13.set(d);
      this.d14.set(d);
      this.d15.set(d);
            this.d16.set(d);
      this.d17.set(d);
      this.d18.set(d);
            this.d19.set(d);
      this.d20.set(d);
      this.d21.set(d);
      this.d22.set(d);
      this.d23.set(d);
 //     this.snd.play_sound(2,4);

    }break;

    // We need a selector button - so we create a counter dependance on the aux button

        case AAuxb3: {  // For Cabin stuff
         
          if (v == 1 && aAAuxb3Bool == true) {
            cabcount = ( cabcount + 1 );
     // this.snd.play(1, 4, false, true);
}

if (v == 1 && aAAuxb3Bool == false) {
         aAAuxb3Time = aAAuxb3Time + (2 * 1);
           cabcount = ( cabcount + 1 );
      //   this.snd.play(1, 4, false, false);
}

if (v == 1) {
    if (aAAuxb3Bool == false) {aAAuxb3Bool = true;}
    else{aAAuxb3Bool = false;}
}

    if (cabcount > 10) {cabcount = 1;}

     if (cabcount == 1) {this.log_inf("SetOpen Hood");}
     if (cabcount == 2) {this.log_inf("SetOpen Door-Left");}
     if (cabcount == 3) {this.log_inf("SetOpen Door-Right");}
     if (cabcount == 4) {this.log_inf("SetOpen DoorWindow-Left");}
     if (cabcount == 5) {this.log_inf("SetOpen DoorWindow-Right");}
     if (cabcount == 6) {this.log_inf("SetOpen CaseBig-Left");}
     if (cabcount == 7) {this.log_inf("SetOpen CaseSmall-Right");}
     if (cabcount == 8) {this.log_inf("SetOpen SunCower-Left");}
     if (cabcount == 9) {this.log_inf("SetOpen SunCower-Right");}
     if (cabcount == 10) {this.log_inf("SetOpen HydrWheelHolder");}

    }break;

    case AAuxb4: { // For Back-section stuff

     
  if (v == 1 && aAAuxb4Bool == true) {
            bscount = ( bscount + 1 );
     // this.snd.play(1, 4, false, true);
  }

  if (v == 1 && aAAuxb4Bool == false) {
         aAAuxb4Time = aAAuxb4Time + (2 * 1);
           bscount = ( bscount + 1 );
      //   this.snd.play(1, 4, false, false);
  }

  if (v == 1) {
    if (aAAuxb4Bool == false) {aAAuxb4Bool = true;}
    else{aAAuxb4Bool = false;}
  }

    if (bscount > 5) {bscount = 1;}

     if (bscount == 1) {this.log_inf("SetOpen BSDoor-Back");}
     if (bscount == 2) {this.log_inf("SetOpen BSBackDoor-Left");}
     if (bscount == 3) {this.log_inf("SetOpen BSBackDoor-Right");}
     if (bscount == 4) {this.log_inf("SetOpen BSFrontDoor-Left");}
     if (bscount == 5) {this.log_inf("SetOpen BSFrontDoor-Right");}

    }break;


  }


}

... i had to use the " aShiftUpTime" n "aShiftUpBool" stuff, cause whiteout it, gears were shifted trough two of them (0 to 2 to 4 ... - it switched at pressing and releasing the button).

Other than that - works like charm. Now tweaking the RPM needle and engine characteristics again.  ;)

P.S. ... only thing i cant find is some koeficient, that makes the car slow down faster when no gas is given. Any idea ? My actual state is :

Code: [Select]
    chassis.wheelRadius = 0.24;

    chassis.torquePoints = [ { rpm: 0,    torque: 560},
                             { rpm: 100,  torque: 950},
                             { rpm: 200,  torque: 1000},
                             { rpm: 400,  torque: 1130},
                             { rpm: 600,  torque: 1150},
                             { rpm: 800,  torque: 1156},
                             { rpm: 1000, torque: 1176},
                             { rpm: 1200, torque: 1200},
                             { rpm: 1400, torque: 1060},
                             { rpm: 1600, torque: 960},
                             { rpm: 1800, torque: 820},
                             { rpm: 2000, torque: 960},
                             { rpm: 2200, torque: 750},
                             { rpm: 2400, torque: 620},
                             { rpm: 2600, torque: 410},
                             { rpm: 2800, torque: 15},
                             { rpm: 3000, torque: 0} ];

    chassis.forwardGears = [ { ratio: 8.10, shiftUp: 2300, shiftDown: -1   },
                             { ratio: 4.75, shiftUp: 2300, shiftDown: 800 },
                             { ratio: 2.90, shiftUp: 2400, shiftDown: 700 },
                             { ratio: 1.96, shiftUp: 2400, shiftDown: 600 },
                             { ratio: 1.50, shiftUp: -1,   shiftDown: 500 } ];

    chassis.reverseGears = [ { ratio: 7.80, shiftUp: -1, shiftDown: -1 } ];

    chassis.differentialRatio = 3.85;
    chassis.efficiency = 0.10;
    chassis.speedLimiter = -1; // maximum speed in m/s. a value < 0 means there's no limiter
    chassis.engineBrakeCoefficient = 1.4;
    chassis.breakingForce = 60000.0;
    chassis.pitchMultiplier = 1.5;
    chassis.engineInertia = 0.005;
    chassis.minimumRPM = 400;
    chassis.minimum = 0.5;
    //end of engine properties

    return { com:{y:-0.47, z:0.31}, mass:13710, steering:2.0, steering_ecf:60, centering: 2.6, centering_ecf: 20, com: { z:0.1 } };
}
« Last Edit: May 25, 2014, 05:49:32 am by PytonPago »
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

Atrax

  • Full Member
  • ***
  • Posts: 119
  • newbie
    • AtraxGaming Game Shop
Re: Vehicle script [version 1.4.0]
« Reply #83 on: September 19, 2014, 06:05:17 am »

Oh man it would be nice if someone that knows something about Outerra's physics would do a proper physics for at elast one car. Cause now it is drivable, but it's not satisfying at all to drive the cars, nor is it realistic. So anything you put into the game is just there as a number and not something you can actualy use and have fun with.
Wish I knew more about scripting and all the other stuff to do this myself, but unfortunately I don't. :\

ZeosPantera

  • ||>>-Z-<<||
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2518
  • #1 Outerra Fan Boy
    • My Youtube
Re: Vehicle script [version 1.4.0]
« Reply #84 on: September 19, 2014, 10:32:03 am »

Find the Sound Test Car. Someone (not sure who) made a box with wheels and a screen that demo'd how a car could use 16 samples to generate the audio. It handled shifting and I tweaked the vehicle properties and it is probably the best handling vehicle "fast" until a tire model is released.
Logged
"Fear accompanies the possibility of death, Calm shepherds its certainty" - General Ka Dargo

thx_nb

  • Member
  • **
  • Posts: 94
  • newbie
Re: Vehicle script [version 1.4.0]
« Reply #85 on: September 19, 2014, 04:41:27 pm »

The sound test car probably has the most realistic sound, although right now the sound seems to be tied to the speed of the car, instead of the RPM.
However, when I accelerate in a straight line to over 150 km/h on for example the nurburgring it just slides away, which is not very realistic. In the script I only see a 'slip'-property which seems to me to be far too simple to model the grip of a car with different speeds, even if we don't take the surface type into account. I guess that's what Atrax means with proper physics. Problem is I don't know what I'm doing when I increase or decrease this slip factor for example.

Adding a tire model seems a whole leap further to me, together with things like tire screeching when you lose grip.
Logged

HiFlyer

  • Hero Member
  • *****
  • Posts: 1773
  • newbie
Re: Vehicle script [version 1.4.0]
« Reply #86 on: September 19, 2014, 06:43:54 pm »

Is this of interest?

http://www.gritengine.com/
Logged
Spex: Intel Core i7 6700K @ 4.6GHz / 32.0GB G.SKILL TridentZ Series Dual-Channel Ram / ASUS STRIX GeForce GTX 1080 / Sound Blaster Z / Oculus Rift VR Headset / Klipsch® Promedia 2.1 Computer Speakers / ASUS ROG SWIFT PG279Q ‑ 27" IPS LED Monitor ‑ QHD / 2x Samsung SSD 850 EVO 500GB / Windows 10 Pro

PytonPago

  • Hero Member
  • *****
  • Posts: 2253
  • It´s way too complex, dont let me try to explain !
Re: Vehicle script [version 1.4.0]
« Reply #87 on: October 29, 2014, 07:36:10 am »

 ... i dont know if it was my fiddling with the script earlier (the multiple stuff usage - actually, the switch enhancement) and i thought, the clutch should be used if you want to change the gear, so i rearranged the part and added the need of pressing the clutch button (AAuxb2) :

Code: [Select]
     case AAuxb2: {
         if (k == AAuxb2 || k == AAuxa2) {
              if (k == AAuxa2) {
                 v = 1 - (v + 1) / 2;
              }
             v = 1 - v;
             v *= v;

             this.clutchState = (v == 1 ? ClutchState.Disengaged : ClutchState.Engaged);
             this.clutch = v;
             this.clutchOverride = v != 1;
         }
     }break;

    case AShiftUp: {
      if ( this.clutchState == ClutchState.Engaged ) {
        if (v == 1 && aShiftUpBool == true) {
           this.shiftUp();
        }

        if (v == 1 && aShiftUpBool == false) {
         aShiftUpTime = aShiftUpTime + (2 * 1);
           this.shiftUp();
        }

        if (v == 1) {
           if (aShiftUpBool == false) {aShiftUpBool = true;}
           else{aShiftUpBool = false;}
        }
      }
    } break;

    case AShiftDown: {
      if ( this.clutchState == ClutchState.Engaged ) {
        if (v == 1 && aShiftDownBool == true) {
           this.shiftDown();
        }

        if (v == 1 && aShiftDownBool == false) {
         aShiftDownTime = aShiftDownTime + (2 * 1);
           this.shiftDown();
        }

        if (v == 1) {
           if (aShiftDownBool == false) {aShiftDownBool = true;}
           else{aShiftDownBool = false;}
        }
      }
    } break;

     case AAuxb1: {
       
         if (k == AAuxb1 && v == 0) {
            this.automaticTransmission = !this.automaticTransmission;
            this.log_inf("Automatic transmission " + (this.automaticTransmission ? "enabled" : "disabled"));
         }
       
     }break;

 ... so at the next update of the ural, you have to use the clutch when changing gears ... ( not sure when that will be, im changing a lot of stuff there )


still, there is a problem ... the clutch should be pressed to brake too ... otherwise, ya know. Also, the base speed shouldnt be zero if the clutch isnt disengaged ... this tuff still needs some twindling.
« Last Edit: October 29, 2014, 08:04:32 am by PytonPago »
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

PytonPago

  • Hero Member
  • *****
  • Posts: 2253
  • It´s way too complex, dont let me try to explain !
Re: Vehicle script [version 1.4.0]
« Reply #88 on: January 03, 2015, 01:01:44 pm »

still, there is a problem ... the clutch should be pressed to brake too ... otherwise, ya know. Also, the base speed shouldnt be zero if the clutch isnt disengaged ... this tuff still needs some twindling.


 ... Now i found whats wrong with the damned clutch ! ... first the idle rpm state when the clutch is disengaged has some value, doe when engaging the clutch, there is a little moment when rpm comes down lower than the minimum, that shuts the engine down (at the very end of the script) - this is no problem, doe should not happen at the first gear (or at least not every-time). You need to apply gas when wanting to move when getting to 1 gear, but there is no (or seems not to work properly) real effect of the gas whyle engaging the clutch - making the RPM go right under the minimum and shutting down the engine right away.  ---- this needs some modding.

The second thing is the idle RPMs torque/force - it does not seem to be taken from the  chassis.torquePoints ... how is it working ?

Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

PytonPago

  • Hero Member
  • *****
  • Posts: 2253
  • It´s way too complex, dont let me try to explain !
Re: Vehicle script [version 1.4.0]
« Reply #89 on: January 30, 2015, 04:50:10 am »

I found a way to do a simple differential - this may be interesting in doing a better script for trucks and off-road vehicles. Basic is, i dont have to include it in the computation of the "force" that is applied to the wheel, but make an addition to that. As OT has a way to get individual wheel RPMs, ya make just a set of difference variables between the two at an axle and multiply the "force" by it at each proper wheel. adding an constant to the difference variables can be used as an tuning of the differentials ratio.

  ... in addition, an binding-key controlled variable is included witch says if the differential lock is on or off, making the addition be equal to the computed number, or 1 (as the differential being locked, thus giving all wheels the same force)

    Doe, when a wheel gets off ground, the force at an differential-driven axle goes entirely to the wheel white less resistance (the one in the air). So there is also an script witch looks into the height of the wheel and if one of them goes off, it renders the other force-less - giving the negative effect of the axle differential to effect.
 (off course, you must use the "log" script to first find the minimum position of the wheel (when it just hangs in the air) manually, cause its a different number to the minimum in the wheel-parameters as it takes a few more stuff into accout)

   Off course, using it on an basic setup of wheels (where the wheel in script is also having the mesh) is not good, as all wheels getting off ground stop rotating in the basic OT script way. So for showing it off at a graphical level, the mesh of the wheel should be a separate one with rotation projected thanks to the ".rotation " value of the actual script wheel. Witch, when going off ground, will switch to an rotation based on intensity of the gas pedal (and maybe even the gear selected, so its different at different gears and stops or reverses at neutral and reverse gear positions). 
  .. and also rotate the both wheels on the axle the same angle-speed if the differential lock is engaged (cause the basic OT way it turns due to the ground).

 ... will do some testing with some details and try to paste-bin it for ya. If ya have some idea of pimping it up a little more, let me know !
« Last Edit: January 30, 2015, 04:56:23 am by PytonPago »
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

Pages: 1 ... 4 5 [6] 7 8