Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / What maths do I need to teach myself.

Author
Message
Flock of These
9
Years of Service
User Offline
Joined: 7th Feb 2015
Location:
Posted: 21st Feb 2015 00:07
I have some good programs for creating isometric assets, Including the really nice World Creator Pro by Inet2Inet. I think that's probably getting ahead of myself though, so I want to start with learning how to do a top down action game. My problem is that I was always really slow at math. I just couldn't grasp most of what they tried to teach me. On top of that I went into a severe depression in high school, and ended up dropping out. Ive come to realize that a lot of my issues were due to the school just not knowing how to teach people with Asperger's syndrome back then. Being slow at math is still being slow at math, but I when I don't have deadlines freaking me out I can work my way through stuff I never could have learned in the school environment. Its my understanding tha things are much better for kids with Asperger's now thank goodness, but im still left with never having finished basic Algebra. I'm confidant I can learn what I need to learn now though.

So what I need help with is figuring out directions of movement for sprites. Vehicles, and bullets and stuff like that. For now Im working from a top down perspective, and everything rotates 360 degrees around. Vehicles will have momentum and bullets will fire in the direction the firing vehicle is facing. Im not looking for someone to code this stuff for me. An example would still be appreciated and all, but I need to understand the math, not just copy it. I don't know what math I need to learn to figure this out. If someone could point me in the right direction I would be appreciative. I know how to use Google, so just tell me what to search for. I'm sure I can take it from there. Having never finished algebra I just don't know where to look for the kind of math I need.
Lucas Tiridath
AGK Developer
15
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 21st Feb 2015 08:52 Edited at: 21st Feb 2015 08:54
I totally understand the problem. I went through school under the impression I was useless at maths, which was rather a self fulfilling prophesy .

In my experience, there are only a few areas of maths that are really relevant for games. I'll list the main ones that I've found useful below, with a quick explanation of why you might need them. Hopefully they should all be Googlable for reasonable results.
Vectors (addition, subtraction, scaling, normalisation, dot product, cross product).
- These are useful for a huge range of directional and movement work, and will probably provide everything you need for your current 2D project.
Interpolation and splines (linear interpolation, b-splines, catmul-rom splines etc.).
- These are useful for creating smooth movement paths, among other things.
Integration (Euler integration, Runge-Kutta fourth order integration).
- Integration is used for modelling changes over time accurately (or inaccurately in the case of Euler integration). This can be useful for calculating speed from acceleration etc. although if you're using Box2D in AppGameKit, you shouldn't need to worry about this.
Collision detection (there are lots of these: separating axis theorem, bounding volumes, ray casting etc.).
- These are vital for lots of game interactions, but are often irrelevant in AppGameKit because it provides so many collision detection functions itself.
Matrices (matrix multiplication)
- Matrices are used for lots of stuff inside rendering engines, but are less useful in day to day gameplay programming. However they can be useful for performing local transformations, for example getting objects to rotate around a point.
Quaternions
- These are a clever way of representing arbitrary rotations in 3D space, and so are quite often used for things like camera angles etc.

There is plenty more out there, and I'm certainly not saying you need all this to make games! To be honest, the only one that really crops up day to day is vectors. However I hope this gives you a reasonable starting point. If you want any specific examples of these, just let me know.

paulrobson
9
Years of Service
User Offline
Joined: 22nd Nov 2014
Location: Norfolk, England
Posted: 21st Feb 2015 08:56 Edited at: 21st Feb 2015 08:57
I'd have a look at the physics stuff which allows you to do a lot of this fairly easily. There's a couple of chapters in Hands On AppGameKit - this is for v1 but much of it still applies and its being revised as we speak for v2.

If you don't do this you don't really need calculus or anything like that - you need an understanding of the basic equations relating distance velocity and acceleration, and for directions, basic trigonometry.

(Note; this is for 2D stuff. 3D stuff does require a much deeper understanding of mathematics ; matrices and so on)

I've been coding for years and I only ever needed algebra once, when I was writing collision routines between lines and ellipses for a case tool (this was pre internet when you couldn't look stuff up).

The best way to learn is to muck about Seriously, write things, it almost doesn't matter what, the first things you write will probably be not that great (we've all been there) so don't try anything too spectacular for a first program. Most of us have written Hi-Lo games

Aspergers might have damaged your Mathematics slightly, but it will help in other ways. I am mildly Aspergers myself (and have taught Aspergers children). You gain in the ability to focus and concentrate tightly to the exclusion of all else, I almost zone out at times. Which occasionally drives the missus bonkers.
Flock of These
9
Years of Service
User Offline
Joined: 7th Feb 2015
Location:
Posted: 21st Feb 2015 11:12
Lucas Tiridath, thank you for the list. I'll just look into vectors for now. One thing at a time.

paulrobson, I did look into the physics commands, but I wasn't able to make any connection to what I need. Im guessing that is just due to my inexperience though. Looking through the commands again I guess it may be worth messing around with applying forces. I passed it by because I didn't want to effect everything, but I'm betting there are ways around that. It will be a fun experiment, and even if I fail to figure it out I will at least have a better understanding of AGK's physics system.

I suppose this answers my question. For now at least. Thanks for the help guys.
Flock of These
9
Years of Service
User Offline
Joined: 7th Feb 2015
Location:
Posted: 21st Feb 2015 11:19
Oh shoot. I just noticed that there are lots of physics commands in the sprite section. That's what I need! I was just looking in the physics section before.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 21st Feb 2015 11:38
Some of the requirements above look scary. I just want to add - it's not that scary! I'm not brilliant at maths, and I have no excuses, I'm just distinctly average

For top-down (2D) games, you can get away with very little mathematical knowledge. What you will probably do is find a function written by somebody else (For example in this thread or this one) and use it to make life as easy as possible. Then you'll just be calling a function that could be as simple as setting a speed and direction, and it will spit out the necessary values for you.

For 3D - when it arrives in full - I expect we'll have some MOVE commands. That is, you'll specify you want to move X units, and AppGameKit will work out what direction you are facing and make the relevant calculations for you. This is how DBPro - the much older sibling - works.

Good luck!

Quidquid latine dictum sit, altum sonatur
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st Feb 2015 21:05
A strong understanding of trig and geometry can be very useful for 2D games, with 3D games it's usually best to learn as much as you can, ala Lucus's list.

I am the one who knocks...
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Feb 2015 01:47
Pythagorean theorem and something as simple as proportions I find are the most basic things you should know.

These aren't so much tutorials as they are just a helpful list of commonly used equations. I created it more as a reference for myself.
http://www.zimnox.com/resources/articles/math/


"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Greenwich
9
Years of Service
User Offline
Joined: 10th Dec 2014
Location:
Posted: 22nd Feb 2015 02:37
Did someone say maths?

Hi! I'm a mathematics instructor with specific experience teaching classes for students who want supplemental across-the-board math help. I've taught at the high school and university level, very wide variety of math topics, and I've even taught classes tailored for students with developmental disabilities including people who identify within the autism spectrum.

It looks like other people already answered this question, but in general, given how much I love working with AppGameKit, and how helpful people have been with my questions, I've wanted to find ways to contribute to the community.

So I'm happy to answer anybody's math-related questions! If you describe something you're attempting to do, I can contemplate what mathematics would be involved and share some insight and help.

It's mean time. *averages*

Login to post a reply

Server time is: 2024-04-19 19:54:37
Your offset time is: 2024-04-19 19:54:37