Add tuning biases for vehicles, blacklist unmodifiable ones

This commit is contained in:
Fierelier 2022-10-08 23:46:51 +02:00
parent da31082b6d
commit 40539c0f24
2 changed files with 3750 additions and 8912 deletions

File diff suppressed because it is too large Load Diff

View File

@ -522,7 +522,8 @@ update_field transmission tt_top FINAL_GEAR 3.3
update_field transmission viper FINAL_GEAR 3.07
update_field transmission viper_top FINAL_GEAR 3"""
carlist = ["911gt2","911turbo","997s","a3","a4","bmwm3gtr","bmwm3gtre46","camaro","carreragt","caymans","clio","clk500","cobaltss","corvette","corvettec6r","cts","db9","eclipsegt","elise","fordgt","gallardo","gti","gto","imprezawrx","is300","lancerevo8","monaro","murcielago","mustanggt","punto","rx7","rx8","rx8speedt","sl500","sl65","slr","supra","tt","viper"]
carlist = ["911gt2","911turbo","997s","a3","a4","bmwm3gtr","bmwm3gtre46","camaro","carreragt","caymans","clio","clk500","cobaltss","corvette","corvettec6r","cts","db9","eclipsegt","elise","fordgt","gallardo","gti","gto","imprezawrx","is300","lancerevo8","monaro","murcielago","mustanggt","punto","rx7","rx8","sl500","sl65","slr","supra","tt","viper"]
carlistNoTop = ["911gt2","bmwm3gtr","bmwm3gtre46","camaro","corvettec6r","rx8speedt","sl65"]
baseRideHeight = 8.5 # 7
correctedRideHeight = {
@ -566,17 +567,154 @@ correctedRideHeight = {
"tt": 1.3,
"viper": 1.0
}
rideHeightMultTop = 0.8
topBias = {
"911gt2": 0.8,
"911turbo": 0.6,
"997s": 0.6,
"a3": 0.2,
"a4": 0.2,
"bmwm3gtr": 1.0,
"bmwm3gtre46": 0.4,
"camaro": 0.0,
"carreragt": 0.9,
"caymans": 0.6,
"clio": 0.2,
"clk500": 0.2,
"cobaltss": 0.1,
"corvette": 0.4,
"corvettec6r": 1.0,
"cts": 0.1,
"db9": 0.7,
"eclipsegt": 0.4,
"elise": 0.0,
"fordgt": 0.6,
"gallardo": 0.6,
"gti": 0.2,
"gto": 0.1,
"imprezawrx": 0.4,
"is300": 0.0,
"lancerevo8": 0.5,
"monaro": 0.1,
"murcielago": 0.6,
"mustanggt": 0.1,
"punto": 0.2,
"rx7": 0.5,
"rx8": 0.4,
"rx8speedt": 0.6,
"sl500": 0.5,
"sl65": 0.4,
"slr": 0.6,
"supra": 0.3,
"tt": 0.3,
"viper": 0.4
}
parsedVlt = []
for line in properties.split("\n"):
line = line.strip(" \t\r")
arg = ""
args = []
for c in line:
if c == "#": break
if c in [" ","\t"]:
if arg != "":
args.append(arg)
arg = ""
continue
arg = arg + c
if arg != "":
args.append(arg)
arg = ""
if len(args) > 0:
parsedVlt.append(args)
#parsedVlt = {}
#for line in properties.split("\n"):
# line = line.strip(" \t\r")
# output = parsedVlt
# arg = ""
# for c in line:
# if c == "#": break
# if c in [" ","\t"]:
# if arg != "":
# if not arg in output:
# output[arg] = {}
# output = output[ærg]
# arg = ""
# continue
# arg = arg + c
# if arg != "":
# if not arg in output:
# output[arg] = {}
# output = output[arg]
for car in carlist:
if not car in correctedRideHeight:
print("car doesn't have height adjusted: " +car)
def findTopLine(parsedVlt,fline):
flength = len(fline)
fline = fline.copy()[:-1]
iVehicle = fline.index("replaceme")
for line in reversed(parsedVlt):
if not len(line) == flength: continue
try:
if line[iVehicle] != "replaceme_top":
continue
except:
continue
index = 0
success = True
while index < flength - 1:
if index == iVehicle:
index = index + 1
continue
if line[index] != fline[index]:
success = False
break
index = index + 1
if success == False:
continue
return line
file = open(nfsmsScript,"w")
properties = properties.split("\n")
for car in carlist:
for line in properties:
outLine = line.replace("replaceme",car,1)
file.write(outLine + "\n")
for line in parsedVlt:
line = line.copy()
length = len(line)
isCarLine = False
isTopLine = False
if "replaceme" in line:
isCarLine = True
if "replaceme_top" in line:
isCarLine = True
isTopLine = True
if isCarLine and isTopLine and car in carlistNoTop:
continue
if line[0] == "update_field":
if not (line[1] in ["ecar","pvehicle"]) and isCarLine and not isTopLine:
tline = findTopLine(parsedVlt,line)
if tline == None:
print(" ".join(line))
val = float(line[-1])
tval = float(tline[-1])
line[-1] = str(val + ((tval - val) * topBias[car]))
index = 0
while index < length:
line[index] = line[index].replace("replaceme",car,1)
index = index + 1
file.write(" ".join(line) + "\n")
gearRatios = gearRatios.split("\n")
for line in gearRatios:
@ -588,13 +726,19 @@ for line in gearRatios:
for car in carlist:
file.write("update_field chassis " +car+ " RIDE_HEIGHT Front " +str(baseRideHeight)+ "\n")
file.write("update_field chassis " +car+ " RIDE_HEIGHT Rear " +str(baseRideHeight)+ "\n")
if car in carlistNoTop: continue
file.write("update_field chassis " +car+ "_top RIDE_HEIGHT Front " +str(baseRideHeight)+ "\n")
file.write("update_field chassis " +car+ "_top RIDE_HEIGHT Rear " +str(baseRideHeight)+ "\n")
for car in correctedRideHeight:
file.write("update_field chassis " +car+ " RIDE_HEIGHT Front " +str(baseRideHeight * correctedRideHeight[car])+ "\n")
file.write("update_field chassis " +car+ " RIDE_HEIGHT Rear " +str(baseRideHeight * correctedRideHeight[car])+ "\n")
file.write("update_field chassis " +car+ "_top RIDE_HEIGHT Front " +str(baseRideHeight * correctedRideHeight[car])+ "\n")
file.write("update_field chassis " +car+ "_top RIDE_HEIGHT Rear " +str(baseRideHeight * correctedRideHeight[car])+ "\n")
rhTop = (baseRideHeight * correctedRideHeight[car]) * rideHeightMultTop
rh = baseRideHeight * correctedRideHeight[car]
rh = rh + ((rhTop - rh) * topBias[car])
file.write("update_field chassis " +car+ " RIDE_HEIGHT Front " +str(rh)+ "\n")
file.write("update_field chassis " +car+ " RIDE_HEIGHT Rear " +str(rh)+ "\n")
if car in carlistNoTop: continue
file.write("update_field chassis " +car+ "_top RIDE_HEIGHT Front " +str(rhTop)+ "\n")
file.write("update_field chassis " +car+ "_top RIDE_HEIGHT Rear " +str(rhTop)+ "\n")
file.close()