# Tagged Questions

Arithmetic, geometry, calculus, and all else which resolves the number-crunching necessary in a game. Math questions are those that deal with the formulae and calculations used by the game in various parts.

6answers
12k views

### Best C++ Math Library for Game Engine? [closed]

I'm looking for a fast opensource C++ math-library for my game engine with the following features: fast (sse?) vectors matrices quaternions suitable for both opengl and directx
4answers
2k views

### Staggered Isometric Map: Calculate map coordinates for point on screen

I know there are already a lot of resources about this, but I haven't found one that matches my coordinate system and I'm having massive trouble adjusting any of those solutions to my needs. What I ...
5answers
4k views

### SIMD C++ library

I've use Visual Studio with the DirectX XNA math library. Now, I use the GNU compiler collection. Can anyone advise a SIMD math library with a good documentation?
2answers
1k views

### Why do people use quaternions?

I have been using them as a black box for a while, I'm just learning about of the maths but I'd just like some definitive answers to this question. So far the only benefit I've come across personally ...
2answers
1k views

### How to make the player slide smoothly against terrain

I'm making an isometric game. When the player tries to walk diagonally into a wall I want them to slide smoothly across it, so whatever portion of the movement would be legal is used, and anything ...
2answers
936 views

### Eight or infinity sign trajectory

When I want to move object around point I do: point.x *= cosf(timer.timeElapsed); point.y *= sinf(timer.timeElapsed); How to make point move on eight or infinity sign trajectory?
2answers
1k views

### Bezier curve arc length

How can I find the distance traveled by a Bezier curve? For example, the distance traveled by a Linear Bezier Curve is: distance = sqrt(pow(x[1] - x[0], 2) + pow(y[1] - y[0], 2)); But what about ...
6answers
4k views

### Math topics for 3D graphics programming

I understand that the following math topics are required for 3D graphics programming. I have started doing some of them in my math course. Can someone point me in the direction of a resource that ...
3answers
939 views

### What are the most common splines you will find in game development?

List here the most common splines found in game development, how many points the method needs to interpolate a curve, and how can you build a data type that allows you to get an interpolation of the ...
4answers
866 views

### Not sure how to handle “deceleration”

I say "deceleration" because I'm not using acceleration at the moment (it is being calculated, it's just set to 0 0); what I mean is moving the velocity back towards zero, eventually stopping. I'm ...
4answers
2k views

### Are there any disadvantages of using Distance Squared checks rather than Distance?

I use distance squared checks for basically all my distance (vector3 length) checking, due to the performance increase from not incurring a square root (like in plain length checks). From the looks ...
3answers
505 views

### How can I maintain a rectangular formation when units are added or removed?

I've got bots in a rectangular formation with rows and columns. A problem arises when a bot is added or removed from the formation. When this happens, the bots have to rearrange themselves so that the ...
5answers
3k views

### What is the purpose of the canonical view volume?

I'm currently learning OpenGL and haven't been able to find an answer to this question. After the projection matrix is applied to the view space, the view space is "normalized" so that all the points ...
1answer
1k views

### Adding air drag to a golf ball trajectory equation

I'm developing a 2D golf game in VB.NET 2005, but I am stuck on how to implement air or wind drag that should affect the ball. Already I have these equations for projectile: Vo ...
1answer
822 views

### Re-create 2D side-on wave effect from Worms game

I'm trying to recreate the waves/water effect from Worms ( see here http://youtu.be/S6lrRqst9Z4?t=31s ) From what I understand its not actually a sprite, its procedurally generated by something like a ...
2answers
4k views

### How to detect 2D line on line collision?

I'm a flash actionscript game developer who is a bit backward with mathematics, though I find physics both interesting and cool. For reference this is a similar game to the one I'm making: Untangled ...
2answers
3k views

### How to calculate shot angle and velocity to hit a moving target?

I am developing a 2D Android game and I am making an aiming algorithm for AI projectiles to hit enemies either following a path, or free moving. At the moment it just calculates where the target will ...
1answer
643 views

### How can I evenly fan out a hand of cards?

Given a set of playing cards (rectangle images with a width and height) how can I rotate and position each one so that they appear in a 'fan' pattern, much like you would hold a hand of cards in real ...
1answer
541 views

### Projected trajectory of a vehicle?

In the game I am developing, I have to calculate if my vehicle (1) which in the example is travelling north with a speed V, can reach its target (2). The example depict the problem from atop: There ...
5answers
604 views

### Circular Bullet Spread not Even

I'm creating a bullet shooter much in the style of Touhou. Right now I want to have a very simple circular shot being fired from the enemy. See this picture: As you can see, the spacing is very ...
2answers
181 views

### How do you calculate if a line is facing a curve?

Given the 2 points describing a line segment, and the 3 points describing a quadratic bezier curve, how do you calculate if the line is facing towards or away from the curve? The line has a fixed ...
3answers
4k views

### building a game for different resolution phones

I am starting some tests for building a game on the Android program. So far everything is working and seems nice. However I do not understand how to make sure my game looks correct on all phones as ...
2answers
2k views

### How to think about 2D scaling/rotation transformations

This is a kind of embarassing question to me since I'm getting more in-depth with XNA but some times my way of thinking about things in my head contradicts an example and I need to re-think it to make ...
2answers
1k views

### How to calculate the exit speed of ball bouncing off a solid surface

Hey all, I am working on a simple game to include some rigid body dynamics, involving placing (moving & rotating) some springs to bounce a falling ball into a target area. My problem is correctly ...
1answer
513 views

### Isometric - precise screen coordinates to isometric

I'm trying to translate mouse coords to precise isometric coords (I can already find the tile the mouse is over, but I want it to be more precise). I've tried several different methods but I seem to ...
1answer
736 views

### Predicting physics/trajectory for pool/billiards games

I'm thinking of making a quick proof of concept of a billiard-style game mechanic, where the player has perfect information of what is about to happen. Here's a good example: I'm only mildly ...
3answers
555 views

### Determining the probability of a successful attack based on the equipped weapon?

Take this example, a player has a sword composed of the handle and a blade. Together, they generate a strength of X and that combination adds qualitative attributes (induce more damage to fire ...
4answers
2k views

### non-linear interpolation

I have an object, and i want to interpolate its position between two points over a given time period; but i dont want it to be a linear interpolation. I'm not sure if i'm phrasing this right. vector ...
5answers
1k views

### How can I make my score-based game addictive?

I need some ideas to make players interested in the game result. Otherwise, the player plays again to get high score. My game is a calculation game that measures the speed of calculations that the ...
3answers
6k views

### Sorting array of points in clockwise order

Is there such an algorithm to sort an array of 2D points in clockwise order? I'm specifically dealing with right triangle in my case so only 3 points. However I'm interested in knowing if such an ...
2answers
365 views

### Drone targeting

Imagine a "drone" and a target point on a 2d plane. There are eight parameters: P = my position Q = target position V = my velocity I = my moment of inertia w = my angular velocity s = my angular ...
1answer
374 views

### Understanding normal maps on terrain

I'm having trouble understanding some of the math behind normal map textures even though I've got it to work using borrowed code, I want to understand it. I have a terrain based on a heightmap. I'm ...
4answers
941 views

### Physics timestep questions

I've got a projectile working perfectly using the code below: //initialised in loading screen 60 is the FPS - projectilEposition and velocity are Vector3 types gravity = new Vector3(0, ...
1answer
427 views

### Is it possible to procedurally place objects in a non-gridded game?

I'd like to implement procedural world generation, but I don't want it to look gridded or blocky, where everything is obviously placed on an integer grid. I know that you can do this in gridded ...
2answers
87 views

### margin of error trying to check if a point lays on line

Working with floating point values it is as easy as breathing to run on approximation errors by comparing quantities which should be the same. I want to know if there is a way built in some MSDN (or ...
1answer
254 views

### Canvas isometric translations to integer coordinates

I'm creating a canvas based game with an isometric playing board. I use the following transformations to get my square tiles to render on the screen: 'applyViewportTransformation' : function() { ...
1answer
121 views

### Increase restitution (bounciness) of an object in a JavaScript formula

I'm going slightly around the houses on this one. I originally started a thread over on Stack Overflow about it but then it seemed to diverge into mathematics, with no joy from the SO community over ...
1answer
214 views

### how to predict enemy postion to shoot bullet same kingdom rush

i'm doing a tower defense game same kingdom rush, enemy can run curve not only linearly. i found this link : 2D tower defense - A bullet to an enemy but this link use only for enemy run linearly. ...
1answer
551 views

### How to simulate early politics? [duplicate]

I'm making a historically accurate game where the player can interact with past times and shape the future. The entire game is scientifically generated with math and real physics. (no, it won't have ...
5answers
599 views

### Is there a common word that encompasses handling of position, rotation, and scale together?

I'm looking for a name for my class that manipulates 4x4 matrices that handle position, rotation, and scale. Is there a common word that encompasses all three? (I'm splitting the matrix math into its ...
2answers
442 views

### make a sphere rolling on a roulette mesh stop at predetermined place

I have a roulette and a ball(sphere) placed on it. When the game begins the roulette spins. The spinning of the roulette and gravitational forces on the ball makes it roll along the 3d roulette mesh. ...
5answers
3k views

### Changing coordinate system from Z-up to Y-up

Blender's coordinate system is different from what I'm used to, in that Z points upwards instead of Y. What would be the simplest way of converting all the world data (so that all animations, texture ...
5answers
2k views

### Do game studios hire people based on their math knowledge alone?

I have very little programming skills outside of very basic levels of Java, but I have excellent math and science knowledge. I was wondering what I could offer any potential team if I were to go into ...
1answer
1k views

### Rotate object to face player

This is probably a simple vector question, but I'm not sure how to do it. I have an object at vector position (ox,oy). Potentially every update, the user walks around the screen, and will be at ...
3answers
331 views

### Adding tolerance to a point in polygon test

I've been using this method which was taken from Game Coding Complete to detect whether a point is inside of a polygon. It works in almost every case, but is failing on a few edge cases, and I can't ...
1answer
1k views

### Orthographic Camera Zooming

In XNA I am using a spritebatch to render a board. I have created a camera class which can provide me a view and projection matrix. Currently I am supplying the view matrix to my sprite batch when I ...
2answers
89 views

### Need the co-ordinates of innerPolygon

Let say I have this diagram, Given that i have all the co-ordinates of outer polygon and the distance between inner and outer polygon is d is also given. How to calculate the inner polygon ...
1answer
493 views

### How do you get an object to orbit around a certain point on a 2d plane?

I had a concept for a game come to me this morning but I can't figure out how I'd go about implementing the movement. The general idea involves the left and right controls causing a sprite to go ...
2answers
120 views

### setting the position in different resolution

I have a normal game window which is 640*480, and everything is fine, but when I try to maximize the window, the objects translate to different positions on the screen, for example If I have a circle ...
1answer
1k views

### Zooming to point of interest

I have the following variables: Point of interest which is the position(x,y) in pixels of the place to focus. Screen width,height which are the dimensions of the window. Zoom level which sets the ...