Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Good job to grab data. I sent you the data files from my machine. It is clear the bug is still active, just as in my prior videos.

Even better: I've found which variables go wrong. A couple of very small floating point variables are 100x bigger than they should be. Also interesting: when I run the logger, the decimal separator in the files is a comma, while in your files (and someone else's) it's a point. How this is possible, I don't know. But I've added an option that will divide those variables by 100. This might do the trick for now. (Probably only your own car, not the AI.)

It gets even better: it has nothing to do with my code, but with the regional settings of Windows. I changed the country from Belgium to USA and yes, the car went uncontrollably fast. The option to multiply the values didn't solve the issue, but perhaps I can now find a solution.

And finally, I believe I've found the culprit: a text file that represented the tire slip curve had commas as the decimal separator. English systems wouldn't recognize this and simply removed that comma, multiplying the values by 100. I removed the comma altogether and divided the value in the code itself. Problem solved!

(1 edit)

I think you're using C#. Look into System.Globalization. Try using CultureInfo.InvariantCulture. Then try using TryParse on the data type you are reading into. I believe it should parse any global / culture format.

However, if you just changed all of your floats into integers (x100) then that also works, but you should then read them into integers -- this is so it fails when someone later adds a float to that text file by accident.

In other words, your code should fail at the location of the bug. Not in the middle of gameplay where anything may have caused the error. Fail fast. Then my report to you would be "here's the exception", which can be solved in seconds.

Nonetheless, good debugging!