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.
-3
votes
0answers
54 views
How should I go about coding my own matchmaking algorithm?
I'm currently thinking about adding my own matchmaking algorithm to my game (the games are 1v1). I'm probably going to go with a modified ELO for my needs but this is not what I'm wondering about ...
1
vote
1answer
66 views
Determining explosion radius damage - Circle to Rectangle 2D
One of the Cocos2D games I am working on has circular explosion effects. These explosion effects need to deal a percentage of their set maximum damage to all game characters (represented by ...
1
vote
0answers
45 views
Surface normal to screen angle
I've been struggling to get this working. I simply wish to take a surface normal and convert it to a screen angle.
As an example, assuming we're working with the highlighted surface on the sphere ...
4
votes
1answer
103 views
Modular spaceship control
I am developing a physics based game with spaceships.
A spaceship is constructed from circles connected by joints. Some of the circles have engines attached.
Engines can rotate around the center ...
0
votes
0answers
81 views
Should I get “Mathematics and Physics for Programmers” (Charles River Media Game Development) given ~ [closed]
http://www.amazon.com/dp/1584503300/?tag=stackoverfl08-20
I have alot of improving to do in the area of Math and am heavily interested in Game Development. I just have a few questions~
The ...
4
votes
3answers
94 views
Matrix multiplication - Scene Graphs
I wrote a MatrixStack class in C# to use in a SceneGraph. So, to get the world matrix for an object I am suposed to use:
WorldMatrix = ParentWorld * LocalTransform
But, in fact, it only works as ...
0
votes
0answers
61 views
Premultiplying matrices with Perspective destroys them
If I apply world_to_camera, perspective and camera_to_screen to my mesh, everything is okay. But if I premultiply given matrices (i.e. transform = world_to_camera * perpective * camera_to_screen) ...
6
votes
2answers
214 views
Procedural dungeon generation. No corridors, color key doors
I am curious how dungeons like the one in Runescape dungeoneering skill are generated. They basicaly have a 10x10 grid. So theres 100 rooms total. There's starting room and exit room. And each one are ...
0
votes
1answer
59 views
Which is the right way to build a OpenGL Projection Matrix
This time I'm trying to learn the core of matrix transformations. I dont like the idea to using a Math library and dont understand what is hapening on background, because this I'm having some ...
1
vote
1answer
64 views
Making Ball Fling in a Curve Direction
I was wondering how to figuring out how to slice a ball (banana kick) by flinging it curve-ways. However, according to the LibGDX's gesture listener, the method for flinging only focuses on a straight ...
1
vote
0answers
49 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
28 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
66 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
119 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
72 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
48 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
238 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
94 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
114 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
72 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
119 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
38 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
89 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
277 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
120 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
122 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
176 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
78 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
93 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
89 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
82 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
127 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
131 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
92 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
321 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
90 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
155 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
146 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
53 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
152 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
195 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
138 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
115 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
354 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
205 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
224 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
260 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
149 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 ...