ls1 goldstone archer setup added, overtaking bug fixed as well

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@4034 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: cb0e4160b5ac6a947759be66f89f979ce1ae4e54
Former-commit-id: c8066affdcd2da20dcb684d23a1986e5dc6bcfd3
This commit is contained in:
andrewsumner 2011-11-02 04:28:37 +00:00
parent 4ed796a52f
commit ff2c030ac2
5 changed files with 121 additions and 32 deletions

View file

@ -139,6 +139,8 @@ LRaceLine::LRaceLine() :
AccelCurveOffset(0),
Iterations(100),
SteerMod(0),
SRLidx(0),
OfftrackAllowed(1),
tSpeed(NULL),
tLaneShift(NULL),
tRLMarginRgt(NULL),
@ -333,6 +335,8 @@ void LRaceLine::AllocTrack( tTrack *ptrack )
BrakeMod = GfParmGetNum( carhandle, SECT_PRIVATE, PRV_BRAKE_MOD, (char *)NULL, 1.0f );
BrakePower = GfParmGetNum( carhandle, SECT_PRIVATE, PRV_BRAKE_POWER, (char *)NULL, 0.5f );
SteerMod = (int) GfParmGetNum( carhandle, SECT_PRIVATE, PRV_STEER_MOD, (char *)NULL, 0.0f );
OfftrackAllowed = (int) GfParmGetNum( carhandle, SECT_PRIVATE, PRV_OFFTRACK_ALLOWED, (char *)NULL, 1.0f );
roughlimit = GfParmGetNum( carhandle, SECT_PRIVATE, PRV_OFFTRACK_RLIMIT, (char *)NULL, 0.80f );
MaxSteerTime = GfParmGetNum( carhandle, SECT_PRIVATE, PRV_MAX_STEER_TIME, (char *)NULL, 1.5f );
MinSteerTime = GfParmGetNum( carhandle, SECT_PRIVATE, PRV_MIN_STEER_TIME, (char *)NULL, 1.0f );
RaceLineDebug = GfParmGetNum( carhandle, SECT_PRIVATE, PRV_RACELINE_DEBUG, (char *)NULL, 0.0f ) ? true : false;
@ -471,7 +475,7 @@ void LRaceLine::SplitTrack(tTrack *ptrack, int rl)
//if (rl == LINE_MID)
SetSegmentInfo(psegCurrent, Distance + Step, i, Step, rl);
if (rl >= LINE_RL)
if (rl >= LINE_RL && OfftrackAllowed)
{
for (int side=0; side<2; side++)
{
@ -501,7 +505,7 @@ void LRaceLine::SplitTrack(tTrack *ptrack, int rl)
if (psegside->style == TR_PLAN &&
(psegside->surface->kFriction < psegCurrent->surface->kFriction*0.8 ||
(psegside->surface->kRoughness > MAX(0.02, psegCurrent->surface->kRoughness+0.05)) ||
(psegside->surface->kRoughness > MIN(roughlimit, MAX(0.02, psegCurrent->surface->kRoughness+0.05))) ||
(psegside->surface->kRollRes > MAX(0.005, psegCurrent->surface->kRollRes+0.03))))
break;
@ -1791,7 +1795,7 @@ void LRaceLine::GetRaceLineData(tSituation *s, LRaceLineData *pdata)
}
double ospeed = TargetSpeed, aspeed = ATargetSpeed;
ATargetSpeed = (1 - c0) * tSpeed[LINE_MID][avnext] + c0 * tSpeed[LINE_MID][avindex];
ATargetSpeed = tSpeed[LINE_MID][avnext];//(1 - c0) * tSpeed[LINE_MID][avnext] + c0 * tSpeed[LINE_MID][avindex];
data->avspeed = MAX(10.0, ATargetSpeed);
if (!data->overtakecaution)
data->avspeed = MAX(ATargetSpeed, tSpeed[LINE_MID][avnext]);
@ -1817,8 +1821,8 @@ void LRaceLine::GetRaceLineData(tSituation *s, LRaceLineData *pdata)
}
data->speed = TargetSpeed;
if (TargetSpeed > ospeed && ATargetSpeed < aspeed)
data->avspeed = ATargetSpeed = MAX(data->avspeed, aspeed * (TargetSpeed / ospeed));
//if (TargetSpeed > ospeed && ATargetSpeed < aspeed)
// data->avspeed = ATargetSpeed = MAX(data->avspeed, aspeed * (TargetSpeed / ospeed));
data->avspeed = MAX(data->speed*0.6, MIN(data->speed+2.0, data->avspeed));
double laneoffset = SRL[SRLidx].Width/2 - (SRL[SRLidx].tLane[Next] * SRL[SRLidx].Width);
@ -1860,19 +1864,6 @@ void LRaceLine::GetRaceLineData(tSituation *s, LRaceLineData *pdata)
data->insideline = data->outsideline = 0;
if ((SRL[SRLidx].tRInverse[Next] > 0.0 && car->_trkPos.toLeft <= SRL[SRLidx].tLane[Next] * SRL[SRLidx].Width + 1.0) ||
(SRL[SRLidx].tRInverse[Next] < 0.0 && car->_trkPos.toLeft >= SRL[SRLidx].tLane[Next] * SRL[SRLidx].Width - 1.0))
{
// inside raceline
data->insideline = 1;
data->avspeed = MAX(data->avspeed, data->speed);
}
else if (tSpeed[LINE_RL][Next] >= tSpeed[LINE_RL][This] &&
((SRL[SRLidx].tRInverse[Next] > 0.0 && SRL[SRLidx].tLane[Next] > SRL[SRLidx].tLane[This] && car->_trkPos.toLeft > SRL[SRLidx].tLane[Next]*SRL[SRLidx].Width+1.0) ||
(SRL[SRLidx].tRInverse[Next] < 0.0 && SRL[SRLidx].tLane[Next] < SRL[SRLidx].tLane[This] && car->_trkPos.toLeft < SRL[SRLidx].tLane[Next]*SRL[SRLidx].Width-1.0)))
{
data->outsideline = 1;
}
data->closing = data->exiting = 0;
if ((SRL[SRLidx].tRInverse[Next] < -0.001 && SRL[SRLidx].tLane[Next] > SRL[SRLidx].tLane[Index]) ||
@ -1886,12 +1877,26 @@ void LRaceLine::GetRaceLineData(tSituation *s, LRaceLineData *pdata)
tSpeed[LINE_RL][nnext] >= tSpeed[LINE_RL][This])
{
data->exiting = 1;
if ((SRL[SRLidx].tRInverse[Next] > 0.0 && car->_trkPos.toLeft <= SRL[SRLidx].tLane[Next] * SRL[SRLidx].Width + 1.0) ||
(SRL[SRLidx].tRInverse[Next] < 0.0 && car->_trkPos.toLeft >= SRL[SRLidx].tLane[Next] * SRL[SRLidx].Width - 1.0))
{
// inside raceline
data->insideline = 1;
data->avspeed = MAX(data->avspeed, data->speed);
}
else if (tSpeed[LINE_RL][Next] >= tSpeed[LINE_RL][This] &&
((SRL[SRLidx].tRInverse[Next] > 0.0 && SRL[SRLidx].tLane[Next] > SRL[SRLidx].tLane[This] && car->_trkPos.toLeft > SRL[SRLidx].tLane[Next]*SRL[SRLidx].Width+1.0) ||
(SRL[SRLidx].tRInverse[Next] < 0.0 && SRL[SRLidx].tLane[Next] < SRL[SRLidx].tLane[This] && car->_trkPos.toLeft < SRL[SRLidx].tLane[Next]*SRL[SRLidx].Width-1.0)))
{
data->outsideline = 1;
}
#if 0
double ae = GetModD( tAccelExit, This );
if (ae > 0.0)
{
data->speed += ae;
data->avspeed += MIN(ae, AvoidAccelExit);
data->speed *= ae;
data->avspeed *= MIN(ae, AvoidAccelExit);
}
else
{

View file

@ -201,6 +201,9 @@ class LRaceLine {
int Iterations;
int SteerMod;
int SRLidx;
int OfftrackAllowed;
double roughlimit;
double **tSpeed;
double *tLaneShift;

View file

@ -64,6 +64,8 @@
#define PRV_ACCEL_REDUX_X "accel redux factor"
#define PRV_BEGIN "bgn"
#define PRV_END "end"
#define PRV_OFFTRACK_ALLOWED "offtrack allowed"
#define PRV_OFFTRACK_RLIMIT "rough limit"
// driver values
#define PRV_PIT_DAMAGE "pit damage"

View file

@ -90,7 +90,7 @@
</section>
<section name="Front Anti-Roll Bar">
<attnum name="spring" unit="kN/m" min="0" max="50" val="10"/>
<attnum name="spring" unit="kN/m" min="0" max="50" val="6"/>
</section>
<section name="Rear Anti-Roll Bar">
@ -143,26 +143,24 @@
<section name="private">
<attnum name="min corner inverse" min="0" max="2" val="0.0017"/>
<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 brake factor" min="-20" max="20" val="0.9"/>
<attnum name="exit boost factor" min="-20" max="20" val="1.60"/>
<attnum name="add avoid speed" min="-20" max="20" val="-1.8"/>
<attnum name="exit boost factor" min="-20" max="20" val="2.60"/>
<attnum name="avoid exit boost factor" min="-20" max="20" val="1.2"/>
<attnum name="brake margin" min="-20" max="20" val="1.8"/>
<attnum name="base speed factor" min="0.0" max="50.0" val="1.00"/>
<attnum name="base brake factor" min="0.0" max="50.0" val="1.00"/>
<attnum name="accel redux factor" min="-20" max="20" val="2.5"/>
<attnum name="base speed" min="0.0" max="50.0" val="15.00"/>
<attnum name="base brake" min="10.0" max="200.0" val="130.00"/>
<attnum name="base speed" min="0.0" max="50.0" val="15.60"/>
<attnum name="base brake" min="10.0" max="200.0" val="80.00"/>
<attnum name="brake mod" min="0.0" max="1.0" val="1.00"/>
<attnum name="steer mod" min="0.0" max="1.0" val="1.00"/>
<attnum name="slope factor" min="0.0" max="1.0" val="0.15"/>
<attnum name="accel exit" min="0.0" max="10.0" val="1.40"/>
<attnum name="turn decel" min="0" max="2" val="0.4"/>
<attnum name="curve factor" min="0" max="2" val="0.13"/>
<attnum name="accel curve" min="0" max="2" val="1.30"/>
<attnum name="accel curve" min="0" max="2" val="1.20"/>
<attnum name="brake curve" min="0" max="2" val="1.00"/>
<attnum name="accel curve limit" min="0" max="6" val="2.5"/>
<attnum name="accel curve limit" min="0" max="6" val="1.2"/>
<attnum name="brake curve limit" min="0" max="6" val="1.2"/>
<attnum name="revs change up" min="0" max="2" val="0.83"/>
<attnum name="revs change down" min="0" max="2" val="0.63"/>
@ -171,8 +169,8 @@
<attnum name="steer gain" min="0" max="3" val="1.2"/>
<attnum name="max steer time" min="0.5" max="10" val="2.0"/>
<attnum name="min steer time" min="0.5" max="10" val="1.77"/>
<attnum name="int margin" min="0" max="2" val="2.0"/>
<attnum name="ext margin" min="0" max="2" val="1.0"/>
<attnum name="int margin" min="0" max="2" val="2.2"/>
<attnum name="ext margin" min="0" max="2" val="0.3"/>
<attnum name="no team waiting" min="0" max="2" val="1"/>
<attnum name="inc factor" min="0" max="5" val="0.75"/>
<attnum name="overtake caution" min="-20" max="20" val="0.2"/>
@ -184,7 +182,7 @@
<attnum name="oversteer asr" min="-0.0" max="2.0" val="0.2"/>
<attnum name="side margin" min="0.0" max="4.0" val="1.0"/>
<attnum name="pit offset" min="-200.0" max="200.0" val="-50"/>
<attnum name="steer debug" min="-5" max="5" val="-1.0"/>
<attnum name="steer debug" min="-5" max="5" val="1.0"/>
<attnum name="overtake debug" min="0" max="1" val="0"/>
<attnum name="raceline debug" min="0" max="1" val="0"/>
</section>

View file

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
file : viper-gts-r.xml
created : Sat Mar 3 18:46:37 CET 2001
copyright : (C) 2001 by Eric Espié
email : Eric.Espie@torcs.org
version : $Id: default.xml 2917 2010-10-17 19:03:40Z pouillot $
-->
<!-- This program is free software; you can redistribute it and/or modify -->
<!-- it under the terms of the GNU General Public License as published by -->
<!-- the Free Software Foundation; either version 2 of the License, or -->
<!-- (at your option) any later version. -->
<!DOCTYPE params SYSTEM "../../../../src/libs/tgf/params.dtd">
<params name="Viper GTS-R" type="template">
<section name="Front Wing">
<attnum name="angle" unit="deg" min="6" max="10" val="10"/>
</section>
<section name="Rear Wing">
<attnum name="angle" unit="deg" min="4" max="22" val="21"/>
</section>
<section name="Front Right Wheel">
<attnum name="ride height" unit="mm" min="60" max="140" val="70"/>
<attnum name="toe" unit="deg" min="-5" max="5" val="-0.3"/>
<attnum name="camber" min="-5" max="0" unit="deg" val="-5.0"/>
</section>
<section name="Front Left Wheel">
<attnum name="ride height" unit="mm" min="60" max="140" val="70"/>
<attnum name="toe" unit="deg" min="-5" max="5" val="0.3"/>
<attnum name="camber" min="-5" max="0" unit="deg" val="-5.0"/>
</section>
<section name="Rear Right Wheel">
<attnum name="ride height" unit="mm" min="60" max="140" val="60"/>
<attnum name="toe" unit="deg" min="-1" max="1" val="0.0"/>
<attnum name="camber" min="-4" max="0" unit="deg" val="0.0"/>
</section>
<section name="Rear Left Wheel">
<attnum name="ride height" unit="mm" min="60" max="140" val="60"/>
<attnum name="toe" unit="deg" min="-1" max="1" val="0.0"/>
<attnum name="camber" min="-4" max="0" unit="deg" val="0.0"/>
</section>
<section name="Front Anti-Roll Bar">
<attnum name="spring" unit="kN/m" min="0" max="50" val="10"/>
</section>
<section name="Rear Anti-Roll Bar">
<attnum name="spring" unit="kN/m" min="0" max="50" val="10"/>
</section>
<section name="private">
<attnum name="rough limit" min="0" max="2" val="0.02"/>
<attnum name="base speed" min="0.0" max="50.0" val="15.50"/>
<attnum name="int margin" min="0" max="2" val="0.3"/>
<attnum name="ext margin" min="0" max="2" val="0.2"/>
<attnum name="accel curve" min="0" max="2" val="1.20"/>
<attnum name="accel curve limit" min="0" max="6" val="1.2"/>
</section>
</params>