🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How useful is math (algebra, geometry, trigonometry) for 2d game development?

Started by
4 comments, last by Bregma 4 years, 2 months ago

What would be the application of math (algebra, geometry, trigonometry?) to 2d game development?

I want to make a 2d RPG using monogame, a XNA framework.

I know math is necessary for 3d game development, but i am not sure how much math i would need to do a 2d game in a framework (not a game engine) and what benefits would it offer to manually do code stuff using math and a framework over using an engine.

Many game engines promote themselves as allowing the user to skip all the math parts and focus on the development aspect, for “faster releases”.

I am not sure:

1. How necessary will some branches of math be for 2d game development and what applications it would things like algebra, geometry and trigonometry have for a 2d game.

2. If trying to use math and do things “from zero” would be considered unnecessary and trying to re-invent the wheel when game engines allow you to skip that aspect. People choose to use frameworks to do games, so there must be a benefit.

Advertisement

It depends on what you want to do with your game. If you want to do rotations, and checking collision based on rotations (SAT), and program certain movement patterns, arching, animations, physics related tasks, ect… you need to grasp those topics. Some engines actually handle a lot for you, and some frameworks assist as well.

For an RPG think about how a sword swings and how a trailing hit-box works. What about a fireball which auto tracks the target. Think about Zelda when a bomb goes off and the sprite gets pushed back and jumps from a hit, how do you know how far and what direction based on the current movement of the player and direction? The same can be applied to path-finding. You will find many reasons to be up to date with Math for 2D game development.

I personally believe in learning even Calculus, while maintaining a strong foundation in Physics. I actually enjoy re-inventing the wheel personally so my opinions are biased in this regard, but if you're trying to avoid it as much as possible then you can find a lot of libraries that can handle things for you. Either way, learning such topics are not worthless for game programmers, but it depends on your personal goals and project requirements, along with the capability of your tools (i.e. Framework).

Programmer and 3D Artist

Even a single moving sprite is already math because you have to take axis into acount, what about falling down, how fast can a character move and what about special effects. At least if you start writing Shader code, and I believe there will never ever be an engine or framework that always fulfills everybodies needs (if it will, we're getting unemployed at all) so you will more or less be involved in writing your own Shaders

Not all math is equal. Algebra is something you will use all the time. Trigonometry is only useful if you have free rotation, and even then a half-hour primer on trigonometry will teach you basically all you need to know. Geometry as it is typically taught in school is pretty much useless for game development - what you want is analytic geometry, i.e. geometry with numbers. But what you really want is a good foundation in the branch of mathematics called “game theory”.

If you're doing a text adventure, you can probably skip having to do any arithmetic, but make sure your literature skills are top-notch and expect to have to do a little bit of Boolean algebra.

Otherwise, it's all math. Your engine or framework might supply easing curves and timestep functions, but you need to at least know what those are and when and how to use them, and that's math.

If you're afraid of power tools, lubricants, and fasteners don't become an auto mechanic even if you like to drive fast. If you're afraid of math, don't become a developer even if you like to play games.

Stephen M. Webb
Professional Free Software Developer

This topic is closed to new replies.

Advertisement