General Want easy way to add any/all the official street cars to CSP traffic tool? Read this...

The gist: Traffic tool of the newer CSP needs the 3 files for car's 3d, lod and collider + edit of the contents of the file ".. \extension\lua\tools\csp-traffic-tool\src\simulation\CarsList.lua" in the game's folder.

To give it that the easiest way for preparing the existing cars from "..\content\cars\" is to save the lodB with the textures and the much hated from some 3DSimED3 is a brilliant tool. So, open it, drop into the window the full 3d original. "Ok" to have the temporary folder with the textures.
Clipboard01.jpg
Clipboard02.jpg
Clipboard03.jpg


The goal is to move those textures to the lodB model. So drop the lodB into 3DSimED3
Clipboard04.jpg
Clipboard05.jpg
Clipboard06.jpg


See, no fuss with "*****.ini" and ksEditor. Now export from 3DSimED3 the kn5 model and point it to the "..\extension\lua\tools\csp-traffic-tool\data\" folder in your game.
Clipboard07.jpg

Clipboard08.jpg


Then next to that file copy the lodC and the collider. Rename the collider to the specific car's name
Clipboard09.jpg


Now all that's left is to edit the list of cars in the file ".. \extension\lua\tools\csp-traffic-tool\src\simulation\CarsList.lua". Duplicate in full the code of the first car that comes with the default - "data/bmw_1m.kn5". In the new first instance replace the values after "=" to fit the new car. Be cautious to keep the proper syntax - even one unnecessary empty row or space will cause the Traffic tool to crash (to refuse loading the traffic). So after each adding of a car test the "CarsList.lua" before moving to the next car edit.
Clipboard10.jpg


Final remarks: I know lodB + lodC is much heavier to render than lodC+lodD but the difference in graphics quality is worth it since in traffic we all get very close to the dummies. With the lodC+lodD I had to increase the distance of the lod switch in the file "TrafficCar.lua" row 245 to
Code:
  if self._distanceSquared < 180^2 ~= (self._fullLOD ~= nil) then
and that gave me a small fps hit anyway. The edit is also necessary because the main kick of having 500+ traffic on a multi-lane at night is in working headlights and stop lights. Speaking of which, the file "..\extension\lua\tools\csp-traffic-tool\src\simulation\TrafficCarFullLOD.lua" holds the values that control the brightness of the lights and with defaults they come too dim. I edited rows 47-50 on mine to
Code:
headlights = SmoothEmissive(modelMain:findMeshes(car.definition.lights.headlights), rgb(190, 190, 190), rgb(0, 0, 0), 0.6, 0),
    rear = SmoothEmissive(modelMain:findMeshes(car.definition.lights.rear), rgb(35, 0, 0), rgb(0, 0, 0), 0.6, 0),
    brakes = SmoothEmissive(modelMain:findMeshes(car.definition.lights.brakes), rgb(150, 0, 0), rgb(0, 0, 0), 0.6, 0),
    rearCombined = SmoothEmissive(modelMain:findMeshes(car.definition.lights.rearCombined), rgb(150, 0, 0), rgb(0, 0, 0), 0.6, 0),
Also in that file row 210 controls the placement of the light cone that points ahead and it is a bit too high. To move it below the bonnet I edited to
Code:
    self._lightSource.position:set(0, 0.8, 0):add(car:getBodyPos()):addScaled(car._dir, 0.8)
Don't forget that the edits of the files in "..\extension\lua\tools\csp-traffic-tool\src\simulation\" are going to be overwritten each time you change CSP version. So if you reached some progress - pack all edited files into a zip and after CSP change use that saved zip to restore your preferred code.

Share your thoughts and suggestions !
 
Last edited:
Some of the cars that rely on animations for wings and pop-up headlamps are not good candidates for CSP traffic... Just skipping them. Plenty of others to go round.

While test-loading the ever growing list I have annoying bug in 0.1.79 (recommended) - a couple cars got confused "txMaps" and "txDust" textures in the "SKIN_00" material. Could use some tips how to force the traffic tool to read the carlist.lua as if for the first time and to refresh the cache (which is the suspected cause for this).
 
Union Island is excellent for adjusting the lod (light switch) distance.
Clipboard01.jpg
Clipboard02.jpg


You may want to edit the file "TrafficCar.lua" row 245 to
Code:
if self._distanceSquared < 800^2 ~= (self._fullLOD ~= nil) then
and test for performance. The "800" is good for ~200 cars near and that's enough for the "Union Island". For "Daikoku" when you want ~1000 cars then it's "180" in code to keep up the draw calls low enough. Have a look in "Render stats" app and if the "Main" is over 90% in any direction you may lose frames and lose vsync. If you see a need to regain some fps - keep open "Object inspector" and "Traffic tool" apps and then edit and save the "TrafficCar.lua". The game will take the new values immediately.The downside is the RAM memory gets overloaded and if you repeat that same live-edit too many times with too many traffic cars loaded the game will exit with a crash. Don't panic. The next session will load as normal as always.

For the light cone I found some better values for "..\extension\lua\tools\csp-traffic-tool\src\simulation\TrafficCarFullLOD.lua" rows 198-204
Code:
      self._lightSource.color = rgb(20, 20, 20)
      self._lightSource.specularMultiplier = 0
      self._lightSource.range = 20
      self._lightSource.rangeGradientOffset = 0.1
      self._lightSource.fadeAt = 620
      self._lightSource.fadeSmooth = 10
      self._lightSource.spot = 140
and for row 210
Code:
    self._lightSource.position:set(0, 0.6, 0):add(car:getBodyPos()):addScaled(car._dir, 2.4)
 
Last edited:

Latest News

Are you buying car setups?

  • Yes

  • No


Results are only viewable after voting.
Back
Top