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.

129 views

Need a better function for transportation efficiency

I'm making an economic kind of game, and one of the things I'm simulating is the transportation of resources to a central depository, e.g. moving metal from a mine to the city (so it can be turned ...
953 views

snapping an angle to the closest cardinal direction

I'm developing a 2D sprite-based game, and I'm finding that I'm having trouble with making the sprites rotate correctly. In a nutshell, I've got spritesheets for each of 5 directions (the other 3 come ...
179 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 ...
431 views

Drawing isometric walls

I'm having some trouble with isometric walls. I'm drawing isometric floor tiles using the back to front rendering method, and it works fine. I also keep my floor tiles lined up properly in a nice ...
289 views

How to get distance from point to line with distinction between side of line?

I'm making a 2d racing game. I'm taking the nice standard approach of having a set of points defining the center of the track and detecting whether the car is off the track by detecting its distance ...
438 views

Convert point to its barymetric coordinates

I'm making a 2.5D game engine (in JavaScript) and I'm trying to get it to detect whether a block is under the cursor. This would be a simple task were it restricted to single-level isometric ...
4k views

Basics of drawing in 2d with OpenGL 3 shaders

I am new to OpenGL 3 and graphics programming, and want to create some basic 2d graphics. I have the following scenario of how I might go about drawing a basic (but general) 2d rectangle. I'm not ...
4k views

How to get translation from view matrix

How can I retrieve the camera's world-space position from its view matrix? The only answers I've seen to this question suggest the translation is in the last row/col but this wouldn't work since the ...
353 views

UVW: better explanation, and how to implement with GLES texture2D()

UVW texture coordinates, as opposed to UV texture coordinates, do not get very adequate explanation on the web. Many people offer the simple exlanation, "UV is for 2-dimensional textures and UVW are ...
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, ...
300 views

Line plane intersection: what is this variable?

I'm doing line plane intersection, and have come across an un-referenced variable or constant in the tutorial I'm following. One of the formulae given is this: t = N dot (p2 – p0) ...
408 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 ...
156 views

Determine inventory item position shape

Not a great title but couldnt think of a shorter way to describe it. I am trying to think of the best way to determine the shape of items placed in the players inventory. I guess the best examples ...
2k views

Simplified math formula to calculate stock price based on supply/demand

I am making an overly simplified version of a stock simulator game, because I: am fascinated with how the stock market works learn better & faster from a project like this, rather than ...
402 views

Finding closest coordinate of a pre-known set

Let's say I have a large number of conceptual objects of some kind, each of which occupies a pre-known set of points in a Cartesian 3-space. 1) What is the best combination of data structure (for ...
625 views

Circled plus math symbol - Direct sum of triangles?

I'm reading a paper on terrain rendering LOD and there's some math notation there I'm not clear on. When talking about how triangles are split into pairs of smaller triangles where more detail is ...
325 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 ...
214 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 ...
157 views

How to transform mesh components?

I am attempting to transform the components of a mesh directly using a 4x4 matrix. This is working for the vertex positions, but it is not working for the normals (and probably not the tangents ...
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 ...
819 views

What is a good way to determine if a vector is between two other vectors?

I could operate with the angles, but I do not have the angles calculated yet (and would like to avoid having to do that). It would be possible to calculate and cache the local-coordinate-frame angles, ...
869 views

How to make a 2D Soft-body physics engine?

The definition of rigid body in Box2d is A chunk of matter that is so strong that the distance between any two bits of matter on the chunk is completely constant. And this is exactly what ...
807 views

Kepler orbit : get position on the orbit over time

I'm developing a space-simulation related game, and I am having some trouble implementing the movement of binary stars, like this: The two stars orbit their centroid, and their trajectories are ...
242 views

Projecting onto different size screens by cropping

I am building a phone application which will display a shape on screen. The shape should look the same on different screen sizes. I Decided the best way to do this is to show more of the background on ...
335 views

Estimate angle to launch missile, maths question

I've been working on this for an hour or two now and my maths really isn't my strong suit which is definitely not a good thing for a game programmer but that shouldn't stop me enjoying a hobby surely? ...
845 views

How do I calculate an inverse bind-pose matrix for COLLADA?

I want to port a rigged mesh from a custom format to COLLADA. The bones I have define a position for the bone (local) and a matrix that transforms the child-bones' positions into the next-higher ...
538 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 ...
708 views

3D isometric depth sorting

How is it possible to depth sort tiles and objects in an isometric environments without any limitations? I've been researching this for a while now and there seems to be no publicly available answers ...
106 views

What OpenCL video cards (or FPGAs) features are needed for high speed multiplication?

I'm benchmarking some cryptographic related software and am looking for video cards that are better at parallel multiplication vs parallel addition. Is there any prior work that would graph video ...
254 views

What is a fast way of limiting the heading vector to a certain angle so that it turns in greater distance relative to the limit. A smaller cone/angle should make the object take a far bigger curve to ...
314 views

Box-box contact information

I have two colliding boxes, How i can calculate contact information like (contact normal, contact point and penetration) . Is there any simple algorithm . Note: i'm using XNA .
404 views

How to detect and collide two elastic line segments?

There are 4 moving physical nodes in 3D space. They are paired with two elastic line segments / strings (1 <-> 2; 3 <-> 4). Part I: How to detect the collision of two segments? Part II: On the ...
182 views

Are there multiple valid definitions for what translate, rotate and scale do?

Are there multiple valid definitions for what translate, rotate and scale do to the 4x4 matrix? I bring up this question, because I have a simple webgl program that draws a square and does a few ...
192 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 ...
957 views

Equation to make small number big and big number small (gravity)

I have a sprite that I want to speed up as it gets closer to another object. I really want this to flow well and don't want a series of if statements. All I can think of is to take the distance and ...
7k views

Rotate vector by matrix?

If I have a Vector, say (1,1), how can I rotate it around the origin (0,0)? I'm working in XNA if that helps.
488 views

Vary speed of enemy smoothly

Hey. I'm trying to create an enemy that travels at a speed s on screen but I'm having trouble with trying to make the speed vary in a smooth motion. Basically, I can get the enemy to move at a ...
133 views

Math > Logic for a Logarithmic Score Meter

I'm trying to implement a score meter whereby I specify a maximum value (say 15,000) and I can render values on it in a logarithmic manner ie: +------+---+--+-++ +------+---+--+-++ |== ...
245 views

How to implement armor? [closed]

I am a newbie in Python, I am very bad at math too and I need some help. Also close/move this post if you feel this isn't the right place for it. Hero1 = 5000 # His HP is 5k. Hero1dmg = 200 # ...
485 views

When constructing an orientation matrix, are the rows of the matrix the axis?

When constructing an orientation matrix, are the rows of the matrix the axis? The matrix is row-major and I'm multiplying vectors on the right (Mv). So, the matrix looks like r0c0 r0c1 r0c2 r1c0 ...
152 views

How much mathematics is involved in video game development? [closed]

I'm average at maths. Maybe a tad below average. If I was going into a normal career I'd be fine. But I want to create video games. Is a career in video game development still on the cards for me? I ...
214 views

How does a point squared equal the radius squared?

I am working on a simple ray tracer but I don't understand some of the formulas. One that is bugging me at the moment is this: If a sphere is centred at origin, a point p lies on a sphere of ...
241 views

Generate a range of number with X being returned most of the time

I am attempting to write a RNG which returns a normal-like curve. For example, say I define X to be 4, I would like to generate a range of numbers from 1 to 8, but with 4 being returned most of the ...
496 views

Spot the difference game design help

I'm thinking of making a spot the difference game. But immediately I stumbled over a problem. I'm thinking of storing a "difference area" in the form of a x,y coordinate. However, because on a ...
151 views

How to Construct a Perspective Projection With 4 Vanishing Points

Is it possible to construct a projection matrix which will create a perspective with four (or more) vanishing points? This question have an OpenGL tag, but general insights are welcomed as well.
3k views

Getting isometric grid coordinates from standard X,Y coordinates

I'm currently trying to add sprites to an isometric Tiled TMX map using Objects in cocos2d. The problem is the X and Y metadata from TMX object are in standard 2d format (pixels x, pixels y), instead ...
2k views

Understanding log/exp formula for RPG experience

While looking for examples of RPG experience formulas I came across this one How to create adjustable formula for RPG level up requirements?, and I would really like to figure it out because I don't ...
4k views

Getting the angle between two objects?

I have a set of boxes which create a sort of path, they don't intersect very smoothy and to help that process I'm trying ot find a way to get an angle between them that can make it easier to generate ...