Mathematics questions deal with the arithmetic, geometry, calculus, formulae and other calculations used in the development of a game.
0
votes
1answer
34 views
Difference between column- and row vector matrix multiplication (vector transform)
Let's say we have a 4-by-4 matrix A which represents some transformation.
We can use this matrix to transform a vector in two ways.
Ax by assuming x is a 4-by-1 column vector.
xA by assuming x is a ...
0
votes
0answers
33 views
Predict object position
The intention of this code segment is to predict the location of an object based on it's forward velocity and angular velocity. However, the position is not show where it's supposed to be; first when ...
0
votes
2answers
19 views
How to work out the height of a point on a tilted surface?
I have a plane which gets tilted on the X and Z axis (y+ is the normal).
Given an X and Z coordinate and the X and Z rotation of the plane, how do I find out the height (Y) at that point?
I assume ...
0
votes
1answer
92 views
Calculate current level and level requirements when only XP is being updated
I am trying to create a formula to calculate the players level based on his XP alone. The game currently only increments his XP after certain actions.
I have the formula for calculating the required ...
1
vote
2answers
52 views
Merge angle range
I have AngleRange class with define range to angles to detect if a angle is inside the range.
public class AngleRange
{
private readonly double _from;
private readonly double _to;
public ...
1
vote
0answers
34 views
Decide which scoring system to use and number of points to assign for new game
I am developing a new game and would like to know if anyone could point me in the right direction for deciding the type of scoring system to use for my new game as well as the number of points to ...
0
votes
2answers
27 views
Calculate line intersecting most points, based on random points in a grid
I have been struggling with a math issue for a game I've been developing. I am in need to find the best starting and ending point for a straight line so that it intersects most of the circles (the ...
1
vote
1answer
39 views
Drawing & transforming matrices upwards
I'm drawing a hierarchy of 3D objects in C# XNA where each objects has a transform that holds position, rotation and scale.
I get my expected results If I draw my objects from my root node in this ...
0
votes
0answers
28 views
Approximating a fourth point with a weighted average between three points?
Given three points, how would one approximate the best positive weights (u, v, w) such that u+v+w = 1, and that the distance between the new u*p0 + v*p1 + w*p2 from p3 is minimal?
Basically, the ...
0
votes
1answer
23 views
Transform point while keeping other points offset
I have the following situation: I've got a box with its center of mass transform matrix that I'm obtaining from physics simulation, i.e. it keeps changing with time. I've also got two points (actually ...
1
vote
0answers
143 views
3D software-based engine projection issues
i have been writing a 3D soft-engine for a little while and i have gotten it a reasonable position but recently noticed a bug that i can't seem to solve. When i am rendering a few cubes as a test, if ...
0
votes
2answers
19 views
Timebased transition from start to end value
I'm trying to implement time line objects, the purpose of those would be to issue events at specific times. When and what is specified through objects called units, which is what you attach in the ...
0
votes
1answer
49 views
Hemisphere Projection
I came across the following segment of code that is supposed to project an image on a hemisphere:
void main(void)
{
vColor = aColor;
vec4 pos = uModelViewMatrix * vertex;
float lenxy = ...
0
votes
3answers
73 views
Calculate damage values from bullet velocity and size
I'm trying to make a top-down game using javascript and Pixi which involves multiple different guns.
Instead of giving each gun an individual damage value, I wanted to calculate the damage by the ...
0
votes
2answers
90 views
Determine the z coordinate of a deformed plane based on uv (xy) coordinates
I am using a formula to turn the following texture
into what looks like two 3 dimensional planes
The formula I am using for the texture deformation is
float2 texUV = float2(uv.x / abs(uv.y), (1.0 / ...
-1
votes
1answer
40 views
Perlin Noise' gradient
I'm having some problem understanding the Perlin Noise algorithm and none of the explanation I found go into this (probably obvious)detail.
From what function is the gradient on it? Is it from the ...
-5
votes
1answer
83 views
Why aren't there game and physics engines with double precision?
Choice of game design and other human psychological factors aside
is the present hardware not capable of working with double precision floating point calculations with reasonable performance? It can ...
1
vote
1answer
37 views
How to handle edge cases for a cell divided multiplayer world?
The most common practice that I read about for overcoming floating point precision in video games with large worlds is by dividing the world into cells and load it with player's position and shift ...
6
votes
1answer
137 views
render text inside countries
I have a map of the world and I want to place text on top of each country. The text can be anywhere from 0 to 1000 symbols long, and can often be changed.
I'm looking for an algorithm to layout text ...
1
vote
1answer
44 views
LIBGDX Perspective Camera in an Isometric view?
how can I set a PerspectiveCamera to view the game in an isometric view? What kind of angle would I use, and how would I actually translate this into the code? Math isn't my forte, so I can't really ...
0
votes
1answer
36 views
Axis of affine transformation matrix
Lets say I have a right handed column major 4x4 transformation matrix. Can I safely assume (even tough there exist non uniform scale) that first column is X axis vector, second cloumn is Y axis vector ...
1
vote
1answer
33 views
Project 3d lines onto plane
I'm trying to wrap my head around coordinate projection, and can't seem to solve the problem I am having. Here is an illustration of it:
The cubes represent 3d space, and the 2 red lines represent ...
1
vote
1answer
44 views
Find the closest point on a ray
I've got a ray defined by P1 and P2, and then a target P3, and I want to find P4. How do I go about this? I've come to understand that I should use vector projection, but I can't get it to work. Any ...
0
votes
2answers
82 views
Finding the Distance between 2 Objects
I have 2 objects One Having a Transformation Matrix T1 and other Having Transformation Matrix T2. And We are having a View Matrix V and Projection Matrix P.
Basically 2 Object are render using this ...
0
votes
0answers
18 views
FInding out if a shape is enclosed by other shapes
I'm trying to programmatically work out if a 'core' shape is surrounded with other shapes and thus no space exists around it. Here's an illustration of what I mean (ignore white gaps, they are just to ...
1
vote
1answer
65 views
Finding if 2 polygons intersect using clipper library
After realising my code was pretty inefficient at checking for polygon overlaps, I've turned to a mentioned library Clipper but finding it difficult to know hot to use it for this operation.
I am ...
1
vote
1answer
42 views
Finding when shapes overlap and lines intersect but exclude points/edges
I've been looking for a c# algorithm to help determine if shapes and lines intersect but want to exclude boundary overlaps. Here's an example:
My true problem is finding if polygons intersect but ...
8
votes
1answer
133 views
Snapping shapes together in game
I'm trying to work out how to snap shapes together the player may move around on a canvas.
As the square approaches the other object, I want to pull that shape in (given a certain proximity) and have ...
1
vote
1answer
51 views
Points inside a Polygon, failing for shapes with 0,0
I've been using an algorithm (http://wiki.unity3d.com/index.php/PolyContainsPoint) to tell me if a point is inside a polygon... in fact a few variants (here and here) but they all come back the same. ...
1
vote
1answer
80 views
Checking if shapes will tessellate
I'm trying to figure out where to start with getting code together to check if a shape tessellates.
An example:
Consider that the shapes cannot be rotated, just as-is. A 'compound' shape (as seen in ...
2
votes
6answers
376 views
Computing chance of winning when dealing with fuzzy numbers
Computing chance of winning in a one player and one enemy battle when using fixed numbers is quite easy; for example if we have these numbers:
Player : Attack : 5 - Health : 30 - Attack Interval : ...
1
vote
1answer
61 views
Problem with RGBA sampled shadowmap
I'm having a problem with the generation of a shadowmap that is converted to RGBA. The following glsl code is used to put the depth into the depthbuffer :
/**
* float/rgba8 encoding/decoding so that ...
0
votes
1answer
45 views
Zobrist Hashing equivalent for Simple Knights Game with only 1 unique piece
I looked over the Zobrist hashing function used for getting a unique hash id of the board state in a chess game. https://en.wikipedia.org/wiki/Zobrist_hashing
Martin Fierz explains it very well in ...
0
votes
2answers
61 views
Parametric form of a cubic function
After researching about curves in computer graphics (splines in my case), I have come across something I did not know: Explicit functions like: y=x^2+2 are not the best way to interpolate between ...
1
vote
2answers
157 views
Why aren't regular quadratic and cubic splines used much in games?
After investigating a bit about splines and reading a bunch of docs, I have noticed regular quadratic and cubic splines are not used very much in games.
Splines using quadratic/cubic Bézier curves, ...
0
votes
2answers
114 views
RPG Formula - Attack and defense
I'm making a game and I'm struggling with the formula to calculate the real damage the player does. I have skills which can do for example 10 hits of 20% weapon damage each of a total of 200% damage. ...
0
votes
3answers
72 views
Scaling a rotated rectangle in a given direction
I'm facing an issue when trying to scale a rotated rectangle in a given direction.
In my context, the width and height of the rectangle are based on the texture size multiplied by a scale factor (...
0
votes
2answers
71 views
Time series for creating new events in a PVP game
This is more like a mathematical problem, but I guess this is the best place to ask it.
I am working on a PVP concept and I have the following problem. There is a "battle" between two players that ...
1
vote
2answers
82 views
Finding a tile number in a grid system
Hi I am trying to find the Tile number of a grid of tiles based on the Z and X coordinates.
Where the Z and X axis are potentially infinite in either direction how can i get the number of the tile, ...
1
vote
1answer
86 views
Aim assist (GoldenEye/Perfect Dark)
Anyone remember how the aim assist works in GoldenEye on n64? Where the gun model would point at an enemy if he's within a certain area in your field of view. I'm trying to do something like that but ...
0
votes
1answer
28 views
Why don't Javascript Math.cos doesn't match this vector tutorial?
I'm following
http://www.mathguide.com/lessons2/Vectors.html#combining
Next, we need to convert their forces to horizontal and vertical components. Let's use k for Kim's vector and n for Noah's ...
1
vote
0answers
34 views
Convert box to matrix
I have a box (non-rectangular cuboid?) and would like to convert it to a matrix such that when a point inside the box is multiplied by the matrix, a vector is returned that describes the relative ...
-2
votes
2answers
58 views
Center of Image whose height, width and position are known
I have been struggling to find the center of an image(rectangle). I have following data with me:
width: w,
height: h,
position: (x,y)
My image is an object on canvas. I am using KonvaJS framework. ...
0
votes
1answer
38 views
cylindrical coordinate point in origin
I have a camera which has the following attributes:
pos (position of the camera in the scene)
look(either direction in which camera will face, or target vector)
up vector( y axis)
I am using ...
1
vote
2answers
93 views
clamp a 2D coordinate to fit within an ellipse
I need to clamp a 2D coordinate to fit within an ellipse.
Call of Duty: Modern Warfare 2 does something similar where capture points are translated from a 3D vector in the world to a 2D screen ...
0
votes
1answer
42 views
How to get the point of collision in Separating Axis Theorem?
I'm interested in the relatively precise point (not line) of collision for calculating angular velocity on impact for use in a impulse calculation. At first I thought, perhaps naively, that I could ...
0
votes
1answer
86 views
How to calculate move forward direction in Libgdx with Box2d body
I'm working on a game using Libgdx, I've create my world, bodies, fixtures etc. Everything is functional everything is working perfectly but the problem is my body just can left-right-up or down and I ...
2
votes
5answers
348 views
Approximating particles with with nebula
I have a 2d galaxy where each star is rendered a particle:
I'd like to approximate it with nebula, so that instead of seeing lots of tiny dots from afar, users will see lots smooth light in the area. ...
0
votes
1answer
65 views
How to get connect tiles in hexagonal Grid system
I've been developing a game where a number of tiles can drag into a hexagonal gird background.
But some purpose i need to find the location of same tiles into a array and marge them.
Data Layer
...
2
votes
1answer
39 views
When scaling the camera with the player, how can I make it more noticeable?
I am making a game where you play as fish. When you eat food you become larger. I am counting the camera scale as follows:
camera.scale = (player.originalWidth / player.width)
Then I apply it as a ...