handling improvements, GT2 updates
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@3639 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: d85ad7a3bb2b775a815472646b8535d0ce5ade48 Former-commit-id: 4a4a49bdbff4b6243ea02bf052f919eb049fdbb8
This commit is contained in:
parent
9688d78915
commit
d25db8ba94
4 changed files with 33 additions and 21 deletions
|
@ -2098,8 +2098,9 @@ bool Driver::canOvertake2( Opponent *o, int avoidingside )
|
|||
}
|
||||
|
||||
oAspeed = MIN(oAspeed, o->getSpeed()+2.0);
|
||||
oAspeed = MAX(oAspeed, car->_speed_x - MIN(distance, o->getTimeImpact())/2);
|
||||
|
||||
if (oAspeed > o->getSpeed())
|
||||
if (oAspeed >= o->getSpeed()) // speed on avoidside of opponent is fast enough
|
||||
{
|
||||
if (DebugMsg & debug_overtake)
|
||||
fprintf(stderr,"-> %s: OVERTAKE2 ospd=%.1f oAspd=%.1f\n",ocar->_name,o->getSpeed(),oAspeed);
|
||||
|
@ -2130,6 +2131,7 @@ bool Driver::canOvertake( Opponent *o, double *mincatchdist, bool outside, bool
|
|||
speed = MIN(avspeed, (speed + MAX(0.0, (30.0 - distance) * MAX(0.1, 1.0 - MAX(0.0, rInv-0.001)*80))));
|
||||
double ospeed = o->getSpeed();
|
||||
oAspeed = MIN(oAspeed, ospeed+2.0);
|
||||
oAspeed = MAX(oAspeed, car->_speed_x - MIN(distance, o->getTimeImpact())/2);
|
||||
double timeLimit = 3.0 - MIN(2.4, rInv * 1000);
|
||||
|
||||
if (*mincatchdist > speed - ospeed)
|
||||
|
@ -2142,10 +2144,10 @@ bool Driver::canOvertake( Opponent *o, double *mincatchdist, bool outside, bool
|
|||
return false;
|
||||
}
|
||||
|
||||
if (speed > ospeed + 2*overtakecaution + fabs(rInv) * 500 &&
|
||||
oAspeed > ospeed &&
|
||||
(o->getTimeImpact() * (1.0+overtakecaution) < timeLimit ||
|
||||
distance < MAX(3.0, speed/7)))
|
||||
if (speed > ospeed + 2*overtakecaution + fabs(rInv) * 500 && // our speed quicker than opponent
|
||||
oAspeed > ospeed && // avoid speed quicker than opponent
|
||||
(o->getTimeImpact() * (1.0+overtakecaution) < timeLimit || // approaching opponent quickly
|
||||
distance < MAX(3.0, speed/5))) // close behind opponent
|
||||
{
|
||||
// faster than opponent, overtake
|
||||
*mincatchdist = speed - ospeed;
|
||||
|
|
|
@ -2192,12 +2192,12 @@ double LRaceLine::getAvoidSteer(double offset, LRaceLineData *data)
|
|||
//double offline = MIN(2.0, MAX(-2.0, (offset - car->_trkPos.toMiddle)));
|
||||
//targetAngle -= offline/15;
|
||||
|
||||
double steer_direction = targetAngle - (car->_yaw + car->_yaw_rate/(15-MIN(8, car->_speed_x/10)));
|
||||
double steer_direction = targetAngle - (car->_yaw + car->_yaw_rate/15); //(15-MIN(8, car->_speed_x/10)));
|
||||
NORM_PI_PI(steer_direction);
|
||||
|
||||
steer = steer_direction / car->_steerLock;
|
||||
|
||||
double nextangle = data->angle + car->_yaw_rate/3;
|
||||
double nextangle = data->angle + car->_yaw_rate/4;
|
||||
|
||||
if (fabs(nextangle) > fabs(data->speedangle))
|
||||
{
|
||||
|
@ -2356,14 +2356,24 @@ double LRaceLine::correctLimit(double avoidsteer, double racesteer, int insideli
|
|||
// correct would take us in the opposite direction to a corner - correct less!
|
||||
if ((SRL[SRLidx].tRInverse[Next] > 0.001 && avoidsteer > racesteer) ||
|
||||
(SRL[SRLidx].tRInverse[Next] < -0.001 && avoidsteer < racesteer))
|
||||
return MAX(0.001, MIN(limit, limit - (fabs(SRL[SRLidx].tRInverse[Next]) * 200.0 + tbump)));
|
||||
{
|
||||
limit = MAX(0.001, MIN(limit, limit - (fabs(SRL[SRLidx].tRInverse[Next]) * 200.0 + tbump)));
|
||||
}
|
||||
else
|
||||
{
|
||||
// correct would take us in the opposite direction to a corner - correct less (but not as much as above)
|
||||
int nnext = (Next + (int) (car->_speed_x/3)) % Divs;
|
||||
//double nnlane2left = SRL[SRLidx].tLane[nnext] * SRL[SRLidx].Width;
|
||||
if ((SRL[SRLidx].tRInverse[nnext] > 0.001 && avoidsteer > racesteer) ||
|
||||
(SRL[SRLidx].tRInverse[nnext] < -0.001 && avoidsteer < racesteer))
|
||||
limit = MAX(0.001, MIN(limit, limit - (fabs(SRL[SRLidx].tRInverse[nnext]) * 140.0 + tbump)));
|
||||
}
|
||||
|
||||
// correct would take us in the opposite direction to a corner - correct less (but not as much as above)
|
||||
int nnext = (Next + (int) (car->_speed_x/3)) % Divs;
|
||||
//double nnlane2left = SRL[SRLidx].tLane[nnext] * SRL[SRLidx].Width;
|
||||
if ((SRL[SRLidx].tRInverse[nnext] > 0.001 && avoidsteer > racesteer) ||
|
||||
(SRL[SRLidx].tRInverse[nnext] < -0.001 && avoidsteer < racesteer))
|
||||
return MAX(0.001, MIN(limit, limit - (fabs(SRL[SRLidx].tRInverse[nnext]) * 140.0 + tbump)));
|
||||
if ((avoidsteer > racesteer && car->_yaw_rate < 0.0) || (avoidsteer < racesteer && car->_yaw_rate > 0.0))
|
||||
{
|
||||
// avoid oversteering back towards raceline
|
||||
limit = MAX(0.001, limit - (fabs(car->_yaw_rate) * car->_speed_x) / 100.0);
|
||||
}
|
||||
|
||||
// ok, we're not inside the racing line. Check and see if we're outside it and turning
|
||||
// into a corner, in which case we want to correct more to try and get closer to the
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<attnum name="min corner inverse" min="0" max="2" val="0.0013"/>
|
||||
<attnum name="increase corner inverse" min="0" max="2" val="0.045"/>
|
||||
<attnum name="add avoid speed" min="-20" max="20" val="0.0"/>
|
||||
<attnum name="avoid speed factor" min="-20" max="20" val="0.80"/>
|
||||
<attnum name="avoid speed factor" min="-20" max="20" val="0.76"/>
|
||||
<attnum name="avoid brake factor" min="-20" max="20" val="0.8"/>
|
||||
<attnum name="exit boost factor" min="-20" max="20" val="1.40"/>
|
||||
<attnum name="avoid exit boost factor" min="-20" max="20" val="1.3"/>
|
||||
|
@ -43,12 +43,12 @@
|
|||
<attnum name="revs change down max" min="0" max="2" val="0.75"/>
|
||||
<attnum name="steer skid" min="0" max="3" val="0.0"/>
|
||||
<attnum name="steer gain" min="0" max="3" val="1.5"/>
|
||||
<attnum name="max steer time" min="0.5" max="10" val="1.9"/>
|
||||
<attnum name="min steer time" min="0.5" max="10" val="1.77"/>
|
||||
<attnum name="max steer time" min="0.5" max="10" val="2.2"/>
|
||||
<attnum name="min steer time" min="0.5" max="10" val="1.87"/>
|
||||
<attnum name="int margin" min="0" max="3" val="1.7"/>
|
||||
<attnum name="ext margin" min="0" max="2" val="1.3"/>
|
||||
<attnum name="no team waiting" min="0" max="2" val="1"/>
|
||||
<attnum name="inc factor" min="0" max="5" val="1.0"/>
|
||||
<attnum name="inc factor" min="0" max="5" val="3.0"/>
|
||||
<attnum name="overtake caution" min="-20" max="20" val="0.2"/>
|
||||
<attnum name="tcl slip" min="0.5" max="8.5" val="4.0"/>
|
||||
<attnum name="skid correction" min="0.0" max="8.5" val="0.5"/>
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
<attnum name="min corner inverse" min="0" max="2" val="0.0013"/>
|
||||
<attnum name="increase corner inverse" min="0" max="2" val="0.045"/>
|
||||
<attnum name="add avoid speed" min="-20" max="20" val="0.0"/>
|
||||
<attnum name="avoid speed factor" min="-20" max="20" val="0.80"/>
|
||||
<attnum name="avoid speed factor" min="-20" max="20" val="0.76"/>
|
||||
<attnum name="avoid brake factor" min="-20" max="20" val="0.82"/>
|
||||
<attnum name="exit boost factor" min="-20" max="20" val="1.40"/>
|
||||
<attnum name="avoid exit boost factor" min="-20" max="20" val="1.3"/>
|
||||
<attnum name="brake margin" min="-20" max="20" val="1.0"/>
|
||||
<attnum name="base speed factor" min="0.0" max="50.0" val="0.94"/>
|
||||
<attnum name="base speed factor" min="0.0" max="50.0" val="0.90"/>
|
||||
<attnum name="base brake factor" min="0.0" max="50.0" val="0.90"/>
|
||||
<attnum name="base speed" min="0.0" max="50.0" val="12.00"/>
|
||||
<attnum name="base brake" min="10.0" max="100.0" val="19.00"/>
|
||||
|
@ -48,7 +48,7 @@
|
|||
<attnum name="int margin" min="0" max="3" val="1.7"/>
|
||||
<attnum name="ext margin" min="0" max="2" val="1.3"/>
|
||||
<attnum name="no team waiting" min="0" max="2" val="1"/>
|
||||
<attnum name="inc factor" min="0" max="5" val="1.0"/>
|
||||
<attnum name="inc factor" min="0" max="5" val="3.0"/>
|
||||
<attnum name="overtake caution" min="-20" max="20" val="0.2"/>
|
||||
<attnum name="tcl slip" min="0.5" max="8.5" val="4.0"/>
|
||||
<attnum name="skid correction" min="0.0" max="8.5" val="0.5"/>
|
||||
|
|
Loading…
Reference in a new issue