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.
1
vote
0answers
22 views
Quaternion to direction vector - flipping
I've kinda solved this myself by adapting the Camera::setDirection code from OGRE to work for my need:
Now I have the following code:
Vector3 boneDir = getBoneWorldOrientation(mEntity, mHips) * ...
0
votes
0answers
24 views
How do I fire a projectile at where an object will be located in the future? [duplicate]
I'm making a tower defense game where the towers are shooting projectiles at enemies. I do not want to make the projectiles homing, and I want to make sure that when a tower fires a projectile, it ...
0
votes
2answers
61 views
Is this Rotation Matrix correct?
I'm having heavly troubles with setting up a View Matrix and a Projection Matrix. It simply doesnt work. So I think my problem is related to my rotationMatrix function. I'm using this tutorial to ...
0
votes
1answer
83 views
How can I remove the view and projection matrix from ray position to get only the ray model?
I've got a little problem with my picking module and I need your help.
I have a method to project a ray from the camera to a fixed point when I click somewhere. The computed ray looks good, it go to ...
1
vote
2answers
66 views
How do I derive the angular movement for a craft
I have the regular (linear) motion implemented like this:
class Craft{
...
Vector location, velocity, acceleration, angularVelocity, angularAcceleration;
...
//the move class responsible for linear ...
2
votes
1answer
45 views
Getting half plane direction relative from cam position
Im implementing certain Camera movements in my turn based games. I'm able to place and rotate the camera between two units that attack each other. However it will always move to the same "side". Which ...
9
votes
4answers
225 views
Generate equal regions in a hex map
Taking for example large (X by Y) hex map, how can I divide the map into N regions of connected hexes to simulate countries?
The goal is to generate a hex map that looks like a real life map with ...
1
vote
1answer
88 views
How good do I have to be at Math to create a 3D game using three.js? [closed]
A question I've often had, how good at Math do I need to be to create 3 dimensional games? I get along with 2d games just fine. I understand everything I'm doing without problems after practise. ...
3
votes
1answer
90 views
How to account for acceleration when aiming projectiles?
How do I aim a constant speed projectile to hit a target if there is a constant acceleration vector acting on it? (For example, the wind and gravity from Worms.)
1
vote
3answers
68 views
Move from point a, to point b, and determine the accuracy
Let's say I have a circle at point a (0,0), and I wish to move it to point b (23,58), whatever, how can I accurately do this with a speed variation if I wanted. (I'm doing this in javascript).
Every ...
1
vote
2answers
109 views
Calculate object coordinates from window coordinates using inverse projection matrix
What I am trying to to is placing 3D Objects (A Sphere) in the world when I click there.
I am using a perspective projection so the first step after calculating the canonical clip coordinates from ...
0
votes
0answers
32 views
Opengl 3.2 Flickering after smooth animation?
Okay I am new to OpenGL I am getting an odd issue.
I am performing rotation on a bunch of triangles on a scene graph.
The rotation starts off really smooth everything is animating then much later you ...
0
votes
1answer
62 views
Drawing the same scene with perspective then orthographic projections
I have a scene that I'm rendering first with a perspective matrix. I then want to rerender it in a different viewport using an orthographic matrix for a top-down 2D view of the scene. I think I may be ...
7
votes
2answers
265 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.
...
3
votes
1answer
110 views
Matrix represents same rotation with different euler angles
I have Transform component storing it's rotation as Quaternion.
Transform has set/getEulerAngles (rotation order oy, ox, oz).
I want to rotate object in any direction but while testing I get ...
0
votes
1answer
115 views
Heightmap implementation in javascript question, a 2D water heightmap
I have a height map function from GPU Gems 2 Chapter 18, where they're generating a set of B/W pixels from this equation:
H(x,y,t) = Σi=0N h (
Axi x + Bxi,
Ayi y + Byi,
Ati x + ...
4
votes
1answer
161 views
Picking 3D with OpenGL ES 2
I'm trying to implement picking in my framework but I don't understand how I can do this.
I'm working with:
OpenGL ES 2.
GLM mathematic library.
What I have understand, picking can be made with ...
-1
votes
2answers
76 views
adding space between each bricks in breakOut [closed]
i am trying to create breakout. code below loop though my 2d array(map) and creates bricks. the problem is that i want to add 10 pixels space between each bricks. i was thinking to add ...
-5
votes
2answers
91 views
Should I negate a variable or use absolute value? [closed]
this is how i was chaning ball postion
if(...) //if ball goes to left of screen
dx = -dx
if(...) //if ball goes right of screen
dx = -dx;
i found some people using math.abs to move ball ...
0
votes
1answer
87 views
How to make healthbar size relative to hp
Like in most games with healthbars, the units in my game have a hp_bar object which is a frame, with a slightly smaller rectangle inside which should get smaller (and change color) as a unit loses hp, ...
0
votes
1answer
62 views
Need help with a complex 3d scene (using Ogre and bullet)
In my setup there is a box with a hole on one side, and a freely movable "stick" (or bar, tube). This stick can be inserted/moved through the hole into the box. This hole is exactly as wide as the ...
3
votes
2answers
124 views
What kind of projection is ScreenX=X/Z, ScreenY=Y/Z?
I have an existing class which transforms 3D vectors and projects them on a 2D plane (Camera). The code is all written in C without help from an external library.
To project a single vector (X,Y,Z) ...
2
votes
1answer
122 views
Negative scale in Matrix 4x4
After some rotations and to from quaternion conversions I get negative scale from Matrix 4x4, is it possible? I need that scale to draw sprite on screen so I get sprite flipped,
how to deal with this ...
0
votes
3answers
91 views
Keeping raycast on the same level
I want my raycast to end at certain height(red line). But as the game is 3D and the camera rotates I can't use a fixed magnitude. What I thought was a stroke of genius, I figured I'd project the ...
8
votes
2answers
317 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 ...
2
votes
1answer
88 views
Rotation independent rotation
I came up with some cube rotating, but I could not make it smooth and easy to use because as the cube turned - the keys that handle the turning changed their purpose. Link to demo. The demo rotation ...
4
votes
2answers
151 views
Getting an angle in degrees from north
This may have been asked already, but I was unable to find it, because I don't really know what I'm looking for. I drew a picture:
I need theta. I've seen various solutions using Vector.Dot, and ...
3
votes
1answer
136 views
What algorithm to use to fill a KenKen square board with cages?
I am working on recreating KenKen, a popular math puzzle involving a blank grid that is divided into "cages". Each cage is just a collection of adjacent squares and has a clue which is generally a ...
0
votes
0answers
52 views
Going from point a to b through a curve using “gravity” [duplicate]
I have enemies and when they die they spawn an energy ball with a given velocity. I want to move this ball to the player using "gravity" to create a curved path. I have a version of the function but ...
4
votes
1answer
149 views
1D functions and shapes
I have a set of numbers I normalize ( so the converted number is between 0 and 1 ) which I want to pass trough a function, which in return gives me a different number between 0 and 1 based on the ...
4
votes
3answers
185 views
Fast method of detecting whether point is inside mesh
I'm trying to construct a 3d object from a large number of particles. I think this is called BVH (Bounding volume hierarchy). I figured the best way is to draw the particles inside the mesh, then let ...
0
votes
0answers
62 views
Math concepts from the ground up; practical uses in game design? [duplicate]
I recently went back to school and chose to start learning math from the ground up, to ensure proper footing in higher level courses. I was always interested in game design and took a computer science ...
3
votes
2answers
131 views
Discover x,y coordinates given set arc distance and rotation
I have a turn-based car simulation. My vehicles have a maximum speed they can travel in a round, as well as a maximum amount they can change their heading over the course of a round. Say, 20 meters ...
2
votes
1answer
111 views
RGB to xyY color space conversion and luminance
The luminance calculated by following GLSL functions (fragment shaders - tonemap) has different value:
float GetLuminance (vec3 rgb)
{
return (0.2126 * rgb.x) + (0.7152 * rgb.y) + (0.0722 * ...
15
votes
1answer
337 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 ...
3
votes
1answer
188 views
Quaternion Look At with Up vector
I have implemented a "look at" method for my screen elements and it almost works how I want it to work.
The ScreenElement class uses a R3 Vector and a Quaternion to determine the position and ...
0
votes
1answer
59 views
Different types of smooth object movement
In a game I have a specific object and two positions the object will move from and to.
I already have the function for calculating current position in specific time.
It works like this:
Inputting 0 ...
6
votes
4answers
220 views
Interstellar Economic Simulation
I'm designing a game reminiscent of Elite or Escape Velocity, those old space trading games, where you play a traveling merchant in space.
I'd like to have the game's economy at least resemble a real ...
8
votes
2answers
258 views
100 points between 0-1000 on an increasing scale
Basically, it's for roleplay, I need to generate 100 points along a scale. Level 1 is the starting amount, and is at point 0 on the scale. Level 100 is the highest amount planned at this point, and it ...
2
votes
3answers
140 views
Simulated Economic Factors Based on Supply and Demand in MMO Resource Trading Game
I'm working on a gam (naturally), and the primary activity for the player is to buy and sell commodities at various marketplaces.
Each commodity has the following properties:
Base Price: if all ...
1
vote
1answer
112 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() {
...
4
votes
2answers
134 views
Inventory Grid Detection
I'm working on creating an inventory system for a game. The inventory system will use cells and 2D images to represent items, like Minecraft, Diablo, or WoW. I've hit a bit of a snag when trying to ...
-1
votes
3answers
118 views
Directional light and matrix issues
I'm trying to implement basic directional lightning in OpenGL 3.3 by emulating the logic shown in this guide: http://www.arcsynthesis.org/gltut/Illumination/Tutorial%2009.html
I do not understand ...
1
vote
1answer
73 views
A controlled trapezoid transformation with perspective projecton
I'm trying to implement a controlled trapezoid transformation in Adobe Flash's ActionScript using the built-in perspective projection facility. To give you an idea of how the effect looks like:
...
-4
votes
2answers
92 views
What effect does the amount of 0 in a stat have. [closed]
Basically I want to know if the following three characters are the same
character A
health 10
strength 3
defence 2
character B
health 100
strength 30
defence 20
character C
health 1000
...
0
votes
0answers
57 views
Uses for vector projection?
My previous question was solved by vector projection. Thus I spent some time studying it (Few helpful links: Interactive projection, short video and a longer video.).
There were plenty of sites that ...
3
votes
3answers
227 views
Getting correct angles between Vector3s
I'm working on a project where you can draw lines between points. You select one point and drag the mouse onto another point and a line is drawn between them.
The line itself is a 3d object which is ...
4
votes
1answer
214 views
deferred rendering and point light radius
I use a common attenuation equation for point lights:
attenuation = 1 / kc + kl * d + kq * d^2.
I use deferred rendering so I need to know a light radius. An example light has following intensity: ...
0
votes
2answers
129 views
games logic based on closed shapes
I would like to know the math concepts behind shape based games like http://www.miniclip.com/games/fat-slice/en/
To be specific, I would like to know on
how to model shapes programmatically
finding ...
0
votes
0answers
103 views
How to predict encounters between a ship and a body's sphere of influence in 2D
Long time listener, first time caller. I'm making a little hobby game in XNA, its about transport ships in space, analogous to container ships at sea. There are to be AI ships and player controlled ...


