Nil Value Error on long straight with downward slope

I have been putting some stuff together for a challenge. Needless to say, this isn’t the grand reveal I had planned, but I made a track where most cars will come close to their top speed and this error is doing my head in.

I have recreated the problem on a simple long straight, sloped 10% downwards (attached here).

Most cars will get no error.
Some, apparently at random, throw up a Nil Value error and the game crashes.

I have attached the long slope, and two versions of the same car. One version succeeds, the other fails. The one that fails has more than 160hp, the one that succeeds has 100.

I have now discovered that the failing car will stop failing if you lower the RPM limiter by 300. No other changes.Does the game break if a car’s top speed is limited by the high rev power drop-off in, say, the penultimate gear? The drop off is sometimes much greater than this with no problem.

Or perhaps the power at the rev limiter in 4th gear is sufficient, and for some reason the driver tries to shift up, but the power available in fifth is not enough to even MAINTAIN the current speed, let alone go faster, so the driver’s head explodes?

AAA long straight.zip (1.2 KB)
Archpeasant - randomcar.zip (88.3 KB)
Archpeasant - randomcar fails.zip (88.2 KB)


Lua Error:

Step() failed!: [string “–client\functional\TrimDesignerWindow.lua…”]:4184: [string “–SANDBOX_DATA\CCarCalculator_TestTrack.lua…”]:410: attempt to perform arithmetic on a nil value

DId any other values change as a result?

I’m checking your car, and it works well with the other custom tracks in game without lowering the rpm, even with the pikes peak track with an elevation of 1.5km, so it isn’t the game neither your car. And checking youy tracks, it seems you’re using values too extreme, and not every car can handle them.

I’ve recreated the problem on a simple sloping long straight (and edited the op to clarify this), so it seems to be a general game bug.

There is some marginal jumping around when the test engine RPM is lowered by 300, but it’s minor. I’m thinking it could be some sort of edge case in the driver AI?

@Sillyworld
It does seem to be a general game bug, since it isn’t related to the track but seems to apply to any sloping straight near top speed.

I took the “AAA long straight” track (which produces the error) and deleted the downward slope and the problem, again, disappears. It seems to do with some sort of interaction between the engine/drivetrain at high speed and a slope down which simplifies gaining speed.

You said it yourself “I deleted the slope and the problem dissappears”. Yes is a game bug, but it only appears in your tracks, not other tracks have such extreme downward slopes. It is kind of hard to expect a regular car to do a +300m downward slope and be fine with it xD. That said, is weird that changing the rpm limit solve that.

I can recreate the bug on a 3km long straight with a 150m drop. That translates into a 5% slope which to my mind would hardly count as “extreme”. For reference, the straight (with a 10% drop) on my track was 1.5km long, but had a long winding curve leading into it, which helped gather some initial speed.

There is nothing inherently absurd about a car reaching its top speed on a slight forward slope.
There is nothing inherently absurd about a 1,5km or even a 3km straight.

I acknowledge that I could fix the problem by revising the track geometry, and I appreciate the attempt to help. But I don’t see the track geometry as being extreme. In fact I very much want to keep it as it is because I like the idea of cars coming close to their top speed in a race and a slight slope will assist in that without making the track too long.

It would seem it isn’t the tracks that are bugged, because most cars complete them just fine. But they do provide a background system, where a bug occurs in the engine/drivetrain/AI? interaction for some cars set up in a specific way. I would very much appreciate a comment from the devs as to whether this is a simple fix or nontrivial.

1 Like

I’ll try to look into it during next week.

We have had similar issues before which usually are difficult to find but relatively easy to fix. For instance, we had a problem where a car would go faster than (TopSpeed + 10%) due to a downhill, which resulted in the “driver” not knowing how/when to brake for the next corner, because braking calcs are done in a certain “reasonable” range of speeds :slight_smile:
It could be something similar in your case, we’ll have a look!

1 Like

Thanks @Der_Bayer and @Killrob!

It seems possible that it could have something to do with the cars going too far beyond their power-limited top speed, because that would explain why lowering the RPM limiter fixed the issue. The gearbox was tuned to have the power peak at the theoretical top so the “extra rev range” beyond the peak could have been made available by the slope.

I should say that the intent of the circuit I made was to provide playing room and a little bit of help to go Really Fast within the car’s limits, not to explore the no man’s land beyond the theoretical top speed.

If the problem is indeed going too far beyond the theoretical top, there could maybe be option a) to limit cars to (Top Speed) or (Top Speed+10%) to keep them within calculation range or option b) to calculate AI up to the range of the gearbox where the “natural” rev limiter will prevent the car from going faster? Since some cars have overdrive gears for economy, option b could be wasteful from a resource point of view.

Ultimately, you know the game best and I appreciate your time is limited. If the problem turns out to be too well hidden or too time consuming to solve, when I post the challenge I can ask the contestants to save and test on the track before submitting to make sure the cars don’t explode.

I think in the current version you are playing we upped that calculation limit to something like TopSpeed + 40% already :slight_smile: in any case, we shall investigate, thank you for providing the car and track for us to track down the issue more easily.
Cheers!