what is it in racing game code that so often results in the car rapidly spinning and flying around colliding into everything?

260 views

seems like every game with a car has this happen occasionally, and I was wondering what the underlying theme is in how vehicles are coded in these games that makes it such a common glitch?

[example](https://v.redd.it/w1qkg6qji2ca1)

In: 5

5 Answers

Anonymous 0 Comments

It could be a number of reason but most of them relate to how numbers are stored and manipulated by computers.

Computer store everything as 0 & 1, electricity or no electricity. So to store and manipulate number, you need to convert them into bundle of 0 and 1. So 0 is 0, 1 is 1, but 2 is 10, 3 is 11, 4 is 100 etc.

Now you cannot go indefinitely like that, as computer have limited amount of memory, so usually you take a certain amount of 0&1 and make a group that will express a number. For example 8 of them. That mean you can store from 00000000 (so 0) to 11111111 (255). But that also mean if you add 00000001 and 11111111 together, the result 100000000 (1 followed by 8 zero) doesn’t fit, you only have 8 space, so it will loose the 9th number (the 1) and become 00000000 (8 zero, so 0 again) which is the wrong result.

Now this is for very simple number and there is more complex version of that for number with decimal part etc. But when the game compute the forces that move the car, sometime, because there is an extreme shock at high speed etc.. The computation will create that exact problem and the result will be wrong. But the problem is that this result is the new speed of the car that will be used the next time. So now you’re using a wrong value, which in turn will give a new wrong value. Etc. Etc. Now you are in a downward spiral of bad value that just never end.

You are viewing 1 out of 5 answers, click here to view all answers.