Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!

# Mathematics required for 2d games in Java?

Bobby Sharma
Ranch Hand
Posts: 598
3
Hi, I want to develop basic 2D games in Java but I have no knowledge of maths. I always sucked at maths even in high school. Would you please tell me about the maths required for 2D java games ?
I know addition,subtraction, multiplication, division, percentage, basic set theory (union, intersection), addition and subtraction of matrices only.

fred rosenberger
lowercase baba
Bartender
Posts: 12231
36
all programming is math. That's because math isn't computations and calculations, but is instead problem solving and analysis of complicated stuff so you can break it down into simpler components. Math is about THINKING - and so is programming.

Having said that, and having never done any game development, I would imagine a good foundation in geometry and trigonometry would be vital. I could be wrong, but that's my guess.

Bobby Sharma
Ranch Hand
Posts: 598
3
Yes, Fred.. I already kinda guessed 2D game programming requires a good math foundation. The more math you know, the better. I will start with co-ordinate geometry and then move to geometry and trigonometry.

Les Morgan
Rancher
Posts: 709
17
• 1
You will need more than a rudimentary understanding of the following to do complex gaming programming unless you opt to use readily developed gaming engines:

1 - Trigonometry: will describe how an object moves in free and 2D space.
2 - Geometry: you will need to know how objects are shaped and vectors for finding coordinates.
3 - Physics: this is for the more in depth game, tells how your world will interact (benefit and oppose) movement, energy, and etc for your games
4 - Basic number systems: so you understand things like
a - floating point accuracy (limitations number representation using floating point)
b - underflow
c - overflow
d - division by 0
5 - Algebra: ya, remember when you were in school and you said, "What do I need to know aX + b = C for?" Ya, this is it and it's coming back to bite you big time.
a - conversion between coordinates -- your local spot and where you want to go and how to tell if you are there or not, not to mention.
b - time displacement and movement of objects
c - targeting
d - basic implementation of everything, making your background scroll, resolving edges for movement and scrolling etc... (yes, Math describes it all).

I see the: I'm not good at Math, but I want to be a game programmer post all the time. The good news is: you can look it all up as you need it, and it's all free on line with tutorials. The bad news is: you're going to be crippled until you actually take the time and learn the basics, then get into the more in depth concepts.

salvin francis
Bartender
Posts: 1320
10
• 1
I wanted a heart shaped animation for my own marriage website in 2012. Without knowledge of mathematics this beautiful render would not have been possible:
http://marriage.salvin.in/#howWeMet
I even wrote down that equation under it

Any good animation would need good maths knowledge.