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
votes
1answer
30 views
cannot convert two different enumerated types? "Invalid conversion from 'int' to 'IMGdirections' [closed]
typedef enum
{
NORTH=0,
NORTHEAST=1,
EAST=2,
SOUTHEAST=3,
SOUTH=4,
SOUTHWEST=5,
WEST=6,
NORTHWEST=7
} ISODIRECTION;
...
0
votes
0answers
15 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
42 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 ...
6
votes
2answers
189 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
95 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
258 views
LibGDX Perspective Camera for 2D
I'm very new to LibGDX and I'm trying to use DecalBatch with PerspectiveCamera, simply to have z-coordinate for my sprites, as SpriteBatch does not offer that. However, I don't know how to calculate ...
0
votes
1answer
112 views
Camera lookAt target changes when rotating parent node
have the following issue.I have a camera with lookAt method which works fine.I have a parent node to which I parent the camera.If I rotate the parent node while keeping the camera lookAt the target , ...
4
votes
3answers
827 views
Random Vector within a cone [duplicate]
I'm looking to create a random vector within a cone given the radius (base).
It feels like I've been traversing through many pages on the internet and still I'm no further forward to getting an ...
0
votes
1answer
355 views
rotate opengl mesh relative to camera
I have a cube in opengl. It's position is determined by multiplying it's specific model matrix, the view matrix, and the projection matrix and then passing that to the shader as per this tutorial ...
-2
votes
0answers
36 views
Catapult projectile math [duplicate]
I'm trying to make a catapult that will attack enemies as they approach a castle but I have only a foggy idea on how to get the math correct for the projectile to travel from the catapult, to the ...
3
votes
1answer
851 views
Opengl-es picking object
I saw a lot of picking code opengl-es, but nothing worked. Can someone give me what am I missing?
My code is (from tutorials/forums)
Vec3 far = Camera.getPosition();
Vec3 near = ...
0
votes
1answer
162 views
Normalizing the direction to check if able to move
i have a a room with 4 walls along the x and z axis respectively. My player who is in first person (therefore the camera) should have collision detection with these walls. I'm relatively new to this ...
0
votes
1answer
98 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 + ...
2
votes
2answers
252 views
Derive a algorithm to match best position
I have pieces in my game which have stats and cost assigned to them and they can only be placed at a certain location.
Lets say I have 50 pieces.
e.g.
Piece1 = 100 stats, 10 cost, Position A.
Piece2 ...
3
votes
1answer
157 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 ...
3
votes
1answer
118 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
73 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 ...
0
votes
1answer
57 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 ...
-5
votes
2answers
88 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 ...
2
votes
3answers
126 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 ...
0
votes
1answer
78 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, ...
3
votes
2answers
114 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) ...
0
votes
1answer
53 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 ...
10
votes
5answers
835 views
How could you parallelise a 2D boids simulation
How could you program a 2D boids simulation in such a way that it could use processing power from different sources (clusters, gpu).
In the above example, the non-coloured particles move around ...
2
votes
1answer
109 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 ...
8
votes
2answers
297 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 ...
0
votes
3answers
83 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 ...
2
votes
1answer
86 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 ...
-3
votes
0answers
48 views
Bullet not return when player shoot to any object [closed]
package com.example.game4;
import java.io.IOException;
import java.util.Iterator;
import java.util.LinkedList;
import javax.microedition.khronos.opengles.GL10;
import ...
4
votes
2answers
145 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
131 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 ...
1
vote
1answer
67 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:
...
0
votes
0answers
51 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 ...
6
votes
4answers
985 views
Implementing 2D CSG (for collision shapes)?
Are there any simple (or well documented) algorithms for basic CSG operations on 2D polygons?
I'm looking for a way to 'add' a number of overlapping 2D collision shapes. These may be convex or ...
4
votes
1answer
139 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 ...
1
vote
1answer
122 views
Map displacement transformation to texture space?
I am trying to displace geometry in object space without giving the appearance of texture warping.
My idea is to displace the UV lookup by a relative amount to the geometry displacement.
Any ...
4
votes
3answers
168 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
1answer
177 views
Why does multiplying texture coordinates scale the texture?
I'm having trouble visualizing this geometrically - why is it that multiplying the U,V coordinates of a texture coordinate has the effect of scaling that texture by that factor?
eg if you scaled the ...
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
120 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
95 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
291 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 ...
6
votes
4answers
205 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 ...
2
votes
3answers
666 views
8
votes
2answers
247 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 ...
0
votes
2answers
127 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 ...
1
vote
1answer
102 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
122 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
106 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 ...
11
votes
5answers
5k views
Complete Math Library for use in OpenGL ES 2.0 Game?
Are you aware of a complete (or almost complete) cross platform math library for use in OpenGL ES 2.0 games?
The library should contain:
Matrix2x2, Matrix 3x3, Matrix4x4 classes
Quaternions
...

