NFSAddons Forums

Main Menu

[Tutorial] How to make (almost) PERFECT opponent acceleration tables in NFS4

Started by pete9516, Aug 21, 2021, 3:35 PM

pete9516

ello guys, i want to tell you how you can create an (almost) (because nothing is perfect) opponent acceleration table for a car in NFS4.

Tools you need:
Excel (or a similar table editing program)
Calculator
NFS Wizard
Notepad++

Useful websites:
https://www.automobile-catalog.com/

Step 1: Find out how fast your car gets from 0-100km/h. Let's take the 2005 Bugatti Veyron as an example. It has 1001 horse power and a maximum torque of 1250Nm. It's top speed is about 407km/h. The factory claim from 0-100km/h is 2.5 seconds. I already made an almost realistic car performance for that. Take your car to a track like Redrock Ridge or a similar track where you have an even ground which is long enough to reach a 100km/h. Be sure not to use tracks as Celtic Ruins since the finishing line is located in a sphere (not even road).
The best track for this should probably be JP Racing's Power Park Drag Strip you can find here: https://nfsaddons.com/downloads/nfshs/tracks/5432/jp-racing-power-park.html

Step 2: So i took my Bugatti to the drag strip and in the racing menu there's the "More..." button. Click it until you get to the performance tab. (hs menu performance tab.png) 2.78s from 0-100km/h (It's hard to get a car in HS to accelerate from 0-100km/h in under 2.5 seconds, but i'm happy with 2,78s)

Step 3: 100km/h:3,6=27,777m/s
            Divide 27,777m/s to 2,78s which is 9,99m/s² (unit of acceleration)
            Now take this 9,99 and multiply it by 1,1 which is 10,989 (In order to let the AI have the same acceleration as you, you need to do this) (blame NFS
            High Stakes game engine for this)

Step 4: Open Excel and insert this value (10,989) to the very first table (A1) (excel 1st step.JPG)

Additional Information: Divide 50km/h to 14 (dots in 1 acceleration table) which is 3,571 (each of it's 8 acceleration tables features 14 values)
                                  Why? If you fill the 1st table and leave 0 in all other tables, Sleepy will only drive 50km/h max
                                  Why am i telling you this? To be able to understand what we're doing here: This information comes to the clue that each dot is
                                  representing 3,571km/h
                                  For example:
                                  Dot 14 (Last dot of acceleration table 1): If this value is set to 10 (m/s²), Sleepy would accelerate at 10m/s² between dot 14 and 15
                                  (50km/h - 53,55km/h). That means Sleepy drives 10m/s faster after 1 second (which is not sleepy ;d)

Step 5: Now you need to know what is the actual top speed of your car. The 2005 Bugatti Veyron 16.4 reaches out at 407km/h which is 113,055 m/s. So each second the Bugatti passes a little bit more than a soccer field at top speeds. Divide 10,989m/s² to 113,055 m/s (Forget the units! beyond this point) which is 0,0972.

Step 6: Now you need Excel. Go to A2 (underneath A1) and make a phrase by clicking A2 (excel 2nd step.JPG). Click A2 and then click onto the adress/phrase bar and type the following: =*click on A1*-0,0972*ENTER*
*click on A1*: If you type = and then click on A1 the phrase of A2 will use the value of A1

Step 7: Now you really need Excel. Click on A2 and then move your mouse on the lower right corner of the A2 table. You will see that the icon of your mouse will change to a markable cross. This indicates a very useful function of programs like Excel. It continues the phrase of the upper previous table. Pull it to A114. You should have a value near to zero. This means at about 113 m/s Sleepy won't accelerate that much more because 113 m/s is the top speed of the car Sleepy is driving. Mark all the tables by marking A1 and SHIFTmarking A114 afterwards. Now copy them by rightclicking on one of the tables or if you don't use an Apple OS by typing Ctrl + C (excel 3rd step.JPG)

Step 8: Finally it's Notepad++'s turn. Paste (Ctrl + V) the whole excel table into an empty .txt file with Notepad++. Then type Ctrl + F (search function) and go to the "Replace" tab.
                               "Search for": Fill it with ,
                               "Replace with": Fill it with .
                               (Notepad step 1.JPG)
                               Now click on "Replace all"
You will now notice that every , in the whole file is replaced by a .

Step 9: Now move your text marker to the end of line 1. Press Shift + Right Button (steer right). Now your text marker should be at the BEGINNING of line 2. Press Ctrl + F again. Go to "Replace" tab again and DON'T CLICK on the "Search for" bar!!! Very important! Instead, click on the "Replace with" bar and type ,
Then press "Enter" and you will have 1 long line of long decimal numbers. (notepad step 2.JPG)

Step 10: Take 14 of those decimal numbers for each line. In the end you will have 9 lines of decimal numbers (notepad step 3.JPG).
              Guess what?
              50/14     = 3,5714285714285714285714285714286
              400/112 = 3,5714285714285714285714285714286
              14 dots times 8 is 112
              50km/h times 8 is 400km/h
              Maybe now you will get the clue.. The bugatti drives 407km/h at top speed. But the acceleration tables only go up to 400km/h! Unfortunately there's no
              fix for that. It's like the hardcoded 6 gears limit. If you set a 7th gear the car will act like somebody pulled the handbrakes on. You can manipulate the
              top speed of the AI's cars by raising the "Maximum velocity" option in "General" tab of carp.txt But this will have an imense effect of your car's actual
              performance! So better keep it that way. Just let the 8th table have more than 14 dots.

Step 11: Copy & paste those 8 lines into your opponent acceleration tables and save your car.viv! Done.

I will now try out the new carp.txt on Xtra Tracks. Since you can max out (almost ^^') every single mod car on that track. You can get it here: https://nfsaddons.com/downloads/nfshs/tracks/3159/xtra-tracks.html

I rounded off each number to 3 digits. Usually i take each value out of the calculator with it's like 20 digits after the comma. This is way more precise in the end and leads to a better result. But for this tutorial i kept it easy for the eye and rounded up to 3 digits for everybody this is new to. It is possible that the AI is slower with only 3 digits but in the end it probably doesn't matter.

Why did i do this tutorial? There are programs like Real Tuner 2 which does all the work for you. BUT i like to make my carp.txt's on my own because there are many many cars whose top speed is much lower than the maximum speed of the last gear. And if you make your opponent tables like in this tutorial you will certainly get a realistic acceleration out of your AIs. If you're doing this every day, you should be able to make an acceleration table in less than 5 minutes.

That's it. Now i only need to upload the remaining pictures (since i can only upload 5 each post).

Cheers


Zalcus20

Thanks for putting together this tutorial! 

This goes hand-in-hand with editing AI driving lines.  Even if a "perfect" driving line is set in the speed files, without a good acceleration table the bots will not be competitive or be too competitive.  ;)

Great work.  :)

pete9516

Quote from: Zalcus20 on Aug 24, 2021,  9:48 AM
Thanks for putting together this tutorial! 

This goes hand-in-hand with editing AI driving lines.  Even if a "perfect" driving line is set in the speed files, without a good acceleration table the bots will not be competitive or be too competitive.  ;)

Great work.  :)
Thank you very much

Small side note i forgot:
The gear efficiencies all have to be exact 1. So that in each gear the torque curve is gonna be represented at 1:1. If you (or EA) use other gear efficiency values to adapt 0-60 times (or such) you will notice that the AI might not be as fast as you or it might be faster than you.
Here is a carp i made (model is from Ryuji Kainoh) to show you how it looks ingame. Best testing on a drag strip

pete9516

I've finally found the time, will and technical preconditions to make a video on this tutorial:
https://www.youtube.com/watch?v=NCgMvdECyKc