245: GameDev: Points, Lines, Planes, Dimensions, and Normals.

Take Up Code - Podcast autorstwa Take Up Code: build your own computer games, apps, and robotics with podcasts and live classes

Kategorie:

You don’t need a lot of math to program. What you do need is usually simple. But you do need some. Don’t worry, it’s not that hard and I’ll explain it so you can understand. Game development probably needs a bit more math than you might guess. Let’s start with a point. It’s a simple concept that really just represents a position. A point has no dimensions itself. In other words, it has no length, width, or height. It just exist at some location. It’s the location that has dimensions. If we’re talking about a point in a one dimensional world, then there’s only two directions, left or right. Or, depending on how you want to view the line, it could be up or down. Or, if you can imagine that you are inside the line itself looking down it’s length, then you really have forwards and backwards as the two directions you can go. Once you know the directions, you have to decide how far you want to travel. We normally think of a line divided into equal measures like a ruler. If you start out at position zero and move forward one unit, then you can say that you’re now at position one. Moving backward from there by two units will take you back to position negative one. Everything is relative. We think of a ruler as having a specific beginning at one end that we call zero. But if you were inside that line that extends forward and backward in infinite amounts, then where is zero? Well, it’s wherever you want, really. The main thing is to be consistent. Once you pick a spot that you consider to be zero, then stick with that. Everything else will be based on that point. Listen to the full episode to learn about 2D planes and 3D and even 4D spaces. You’ll also learn why the indices are drawn 90 degrees apart from each other and what this really means. Or you can read the full transcript below. Transcript But you do need some. Don’t worry, it’s not that hard and I’ll explain it so you can understand. Game development probably needs a bit more math than you might guess. There’s a lot of things that get thrown in a game, sure, that you need to calculate where or what it’ll hit. But there’s math involved in just drawing the game objects so they look good. Things such as cloth billowing in the wind or reflections in the gentle waves of a pool of water are details that are harder to get right. They’re also things we notice if they look wrong or fake. It’s always a struggle with programming to decide how detailed you need to be. More detail either means more data or more computations. Less detail means flat surfaces that should be curved, or trees that all tend to move in the same direction at the same time, or just skipping things completely like deciding to not bother with shadows. There’s lots of tricks and shortcuts that have been developed over the years. And then there’s that fact that computers have gotten faster so games can consider it possible to include details that would have been impossible years ago. It’s harder to do these calculation in a game than it is in a motion picture. A game has a game loop that’s very sensitive to timing. A movie can take all the time you need to draw each image. It might take years to record and edit a major motion picture. But it takes you exactly 1 minute to play a game for 1 minute. And in that 1 minute of game time are 60 seconds that need 60 frames in order to look good. That’s 3600 frames that need to be drawn in 1 minute. Then there are games that simplify things on purpose. I mean, if the whole world is made out of squares, then it really simplifies a lot of calculations. I’ve always said that if you can’t get something perfect, then people will notice. Unless you make it so obviously imperfect that you can say you did it that way on purpose. Okay, I’m getting a bit off topic here. I wanted to explain some math terms today that wi

Visit the podcast's native language site