Hacker News new | ask | show | jobs
by tombert 1706 days ago
The way that you do physics in simple platform games is with an Euler integration. I don’t really know what to tell you.

Velocity = Velocity + changes in velocity

Position = Position + Velocity

Do this on an infinite loop and That’s a numeric Euler integration of velocity to get position.

It’s not gatekeeping, I’m not saying you shouldn’t be allowed to make a game without credentials. I was a college dropout for almost a decade until three months ago. I was just saying that that is more advanced math than what a fifth grader does.

I am sorry that you think that it is absurd.

1 comments

That's so obvious it wouldn't have occurred to me that it had a name. And it still looks 100% within "5th grade math" to me.

[edit] Wikipediaing "Euler integration", which redirects to "Euler method", it's not clear to me at all how knowing the stuff on that page (and it's Wikipedia, so nothing on the page looks like 5th grade math, even if it actually is) is particularly helpful with coming up with those two addition formulas.

[edit edit] I don't mean the tone of any of this to be hostile—it's so hard to convey tone in plain text—but I'm just legitimately not following how this is connected, except in a "well you could derive these two very simple things from a very powerful, more complex, general method that's useful for a bunch of other stuff too—there's no particular reason to, but you could" sort of way.

Sure, and I will admit that my example wasn't stupendous there (that's what I get for trying to reply on a phone).

What makes this more complicated (and granted you might not be doing this if your goal is to clone Mario) is when you need to combine forces together. In that case, the change in velocity comes from acceleration, and the change in acceleration comes from the summation of forces in X and Y directions. Obviously the actual calculation is trivial, just simple arithmetic, but the knowledge of what's going on, and how to expand on it is not. If you wanted to make Joust, for example, you need to know all this stuff about forces, or at least I did when I cloned Joust a million years ago. I agree that Wikipedia has a way of complicating things, and it's possible that even without formal training in calculus that you would have rediscovered what I described, and that's totally fair, but that's still calculus! You're still doing calculus, you just didn't realize it at that point.

Of course if you need more accurate physics in your games (unlikely for a basic platformer), you would need to use a more advanced integration method, e.g. RK4 or Adams Bashforth.

I apologize if I came off slightly gatekeepey; I should be clear that I don't particularly care if you know the name of these methods. I'm just saying that these methods are calculus concepts, and as such having an understanding of calculus can help you with that.

OK, I've got what you meant now. Makes sense.

> I apologize if I came off slightly gatekeepey; I should be clear that I don't particularly care if you know the name of these methods. I'm just saying that these methods are calculus concepts, and as such having an understanding of calculus can help you with that.

None of your posts bothered me at all. Appreciate the care, though.