Questions tagged [mathematics]

Mathematics questions deal with the arithmetic, geometry, calculus, formulae and other calculations used in the development of a game.

Filter by
Sorted by
Tagged with
1 vote
1 answer
1k 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 ...
John Leidegren's user avatar
0 votes
1 answer
303 views

Scale sprite between two points

I need to start a sprite at a scale .6 (scale1) at a y position 40 (yPos1). Knowing the end y position 560 (...
user82384's user avatar
0 votes
2 answers
84 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 ...
Nick's user avatar
  • 113
0 votes
2 answers
1k 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 ...
user1202888's user avatar
3 votes
4 answers
199 views

Merge angle range

I have AngleRange class with define range to angles to detect if a angle is inside the range. ...
Joshua's user avatar
  • 175
1 vote
0 answers
146 views

Decide which scoring system to use and number of points to assign for new game [closed]

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 ...
Jon's user avatar
  • 11
0 votes
2 answers
152 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 ...
Steffen Brem's user avatar
1 vote
2 answers
221 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 ...
jsmars's user avatar
  • 135
0 votes
0 answers
64 views

Approximating a fourth point with a weighted average between three points?

Given three points \$p_1,p_2,p_3\$, how would one approximate the best positive weights \$(u, v, w)\$ such that \$u+v+w = 1\$ and that the distance between the new \$up_0 + vp_1 + wp_2\$ from \$p_3\$ ...
AturSams's user avatar
  • 10.5k
0 votes
1 answer
113 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 ...
Pateman's user avatar
  • 180
1 vote
0 answers
193 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 ...
Will D's user avatar
  • 23
0 votes
2 answers
40 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 ...
MetalGodwin's user avatar
0 votes
1 answer
244 views

Hemisphere Projection

I came across the following segment of code that is supposed to project an image on a hemisphere: ...
Unheilig's user avatar
  • 485
0 votes
4 answers
2k 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 ...
JellyWX's user avatar
  • 101
0 votes
2 answers
192 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 ...
user1423893's user avatar
-1 votes
1 answer
719 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 ...
Leonardo Marques's user avatar
1 vote
1 answer
80 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 ...
Allahjane's user avatar
  • 709
6 votes
1 answer
178 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 ...
Anvaka's user avatar
  • 295
2 votes
1 answer
2k 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 ...
floyan's user avatar
  • 23
0 votes
1 answer
278 views

Axis of affine transformation matrix

Let's say I have a right handed column major 4x4 transformation matrix. Can I safely assume (even though there exist non uniform scale) that first column is X axis vector, second column is Y axis ...
Cihan's user avatar
  • 5
1 vote
1 answer
497 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 ...
user92679's user avatar
3 votes
1 answer
519 views

how to create an outlined polygon with vector3 coordinates?

I have a set of vector3 coordinates and I use them to draw a polygon in another app, my question is: how can I calculate a second set of coordinates to make it look like the line is outlined. in ...
Henjin's user avatar
  • 405
-2 votes
1 answer
108 views

Calculate experience for each kill [closed]

I need a formula to calculate experience of players on each kill. It's based on the value of armor of the 2 opponents. For example if i kill the opponent and i've a total armor of 4000 gold and the ...
Mr.M's user avatar
  • 3
2 votes
1 answer
2k 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 ...
jsmars's user avatar
  • 135
0 votes
2 answers
956 views

Finding the Distance between 2 Objects

I have 2 objects One Having a Transformation Matrix T1 and other Having Transformation Matrix ...
Marvel's user avatar
  • 131
2 votes
1 answer
2k 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 ...
dolyth's user avatar
  • 445
0 votes
1 answer
376 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 ...
dolyth's user avatar
  • 445
8 votes
1 answer
5k 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 ...
dolyth's user avatar
  • 445
1 vote
1 answer
203 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. ...
dolyth's user avatar
  • 445
2 votes
1 answer
929 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 ...
dolyth's user avatar
  • 445
0 votes
2 answers
2k views

Formula For Finding Out Price of Item? [closed]

I've been working on a game with a friend for a while now. I'm in charge of plotting most of the stats on the weapons. Weapons have several attributes: Four damage types: Base, Impact, Punct and ...
Xhyher Cypher's user avatar
2 votes
6 answers
464 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 : ...
dev-masih's user avatar
  • 164
1 vote
1 answer
175 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 : ...
Martin Gerhardy's user avatar
2 votes
1 answer
229 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 ...
Oanta William Richard's user avatar
2 votes
2 answers
4k 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 ...
Notbad's user avatar
  • 1,095
2 votes
3 answers
1k 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, ...
Notbad's user avatar
  • 1,095
10 votes
1 answer
21k 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. ...
marcg11's user avatar
  • 425
1 vote
3 answers
1k 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 (...
João Alves's user avatar
0 votes
2 answers
118 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 ...
Tasos's user avatar
  • 571
1 vote
2 answers
488 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, ...
Josh Kirkpatrick's user avatar
1 vote
1 answer
2k 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 ...
herewego's user avatar
0 votes
1 answer
371 views

Why doesn't JavaScript's Math.cos function match this vector tutorial?

I'm following this MATHguide lesson on combining vectors and have reached this part: Next, we need to convert their forces to horizontal and vertical components. Let's use k for Kim's vector and n ...
user333866's user avatar
1 vote
0 answers
56 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 ...
Zachary Burns's user avatar
-1 votes
2 answers
138 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 ...
Hitesh Kumar's user avatar
0 votes
1 answer
114 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 ...
Iurie Cojocari's user avatar
1 vote
2 answers
1k 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 ...
Cynthia Hart's user avatar
2 votes
2 answers
2k 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 ...
JavaProphet's user avatar
1 vote
1 answer
2k 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 ...
İbrahim Kasapoğlu's user avatar
2 votes
5 answers
527 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. ...
Anvaka's user avatar
  • 295
1 vote
1 answer
956 views

How to get connected tiles in hexagonal grid system

I've been developing a game where a number of tiles can drag into a hexagonal grid background. For some purpose I need to find the location of same tiles into an array and merge them. Data Layer: ...
moin khan's user avatar

1
15 16
17
18 19
40