Eli5 how can video games perfectly replicate real life physics

399 views

Like making a ball bounce…etc

In: 0

12 Answers

Anonymous 0 Comments

Physics is all about coming up with functions and rules that predict how things will move. Video games can just treat this as a recipe. You might get a problem in a high school physics class that says “A ball is 5 meters in the air at time 0, gravity is 9.8 meters per second squared, where will the be at time 1?”

A video game just solves that same problem repeatedly. “The ball has this velocity, it’s being pulled in whatever direction, where will it be in 16ms? Okay, great, move the ball there, draw the screen again.” Then it repeats the process, perhaps 60 times every second.

Many times per second, the computer simply uses regular physics equations to update everything’s velocity and position to a new position. This is really convenient because it makes certain things a lot simpler, like the famous “three body problem.” It’s really hard to know where three things orbiting each other are going to be after N amount of time, but it’s really easy to estimate fairly accurately where they’ll all be a tiny amount in the future, and for the most part, it works (although over time the calculated solution will diverge from what would happen in real life, but it’ll still look okay).

The biggest problem is collisions. Things bounce into each other, and especially at high speeds, it really matters EXACTLY when they bounced and at what angle. This is tricky to get right. A bullet can be on one side of a tank at time N and on the other side of the tank at time N+16ms.

The second biggest problem is that most real things aren’t completely inelastic. This makes calculations more expensive. Programmers get creative here, and there are a variety of approaches.

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