Tagged Questions
8
votes
2answers
317 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 ...
3
votes
1answer
136 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 ...
6
votes
4answers
219 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
258 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
0answers
103 views
How to predict encounters between a ship and a body's sphere of influence in 2D
Long time listener, first time caller. I'm making a little hobby game in XNA, its about transport ships in space, analogous to container ships at sea. There are to be AI ships and player controlled ...
0
votes
2answers
196 views
How to build a math module and simulate a system?
For example, in the classical game SimCity:
an economic model to simulate the supply and demand of the city, then calculate how many people live in each building, how many people work there.
a ...
1
vote
1answer
57 views
Build a Cube/Prism from other varied Cubes/Prisms [closed]
I'm wondering, are there any algorithms or theories in existence (that aren't patented/proprietary/protected) that would take a series of 3d rectangular prisms (or cubes but a cube is a prism) and ...
5
votes
1answer
410 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 ...
3
votes
2answers
286 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
59 views
Retrieve outer most points on a 2d graph
G'day everyone,
I have a 2d graph which has some points plotted on it.
What I need to do is get only the outer most points so that I can connect them up (isn't really relevant).
What I can't seem ...
2
votes
0answers
188 views
Catmull Rom Spline - Constant Speed
Given the equations found in the answer here:
Determine arc-length of a Catmull-Rom spline
How would one A) Apply this to a 3D Catmull-Rom Spline, and B) write A out programmatically (for the math ...
0
votes
1answer
110 views
Build a view frustum from angles
I have 4 angles, left, right, top & bottom. These angles are in degrees. They define the angle between the forward vector and the corresponding side. I am trying to use these to calculate the ...
5
votes
2answers
363 views
How can I generate a navigation mesh for a tile grid?
I haven't actually started programming for this one yet, but I wanted to see how I would go about doing this anyway.
Say I have a grid of tiles, all of the same size, some traversable and some not. ...
3
votes
2answers
145 views
how to calculate intersection time and place of multiple moving arcs
I have rocks orbiting moons, moons orbiting planets, planets orbiting suns, and suns orbiting black holes, and the current system could have many many layers of orbitage.
the position of any object ...
14
votes
1answer
1k views
How to convert mouse coordinates to isometric indexes?
I draw isometric map with tile 64x32:
const Offset = 160;
int X, Y;
for (int a=0; a < 6; a++)
for (int b=0; b < 6; b++) {
X = a * 32 - b * 32 + Offset;
Y = a * 16 + b * 16;
...
4
votes
3answers
141 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 ...
0
votes
2answers
632 views
3D: First Person Movement
I've searched and searched for a solution today but haven't found one.
I have a Camera with Vector3 and also the camera has an angle.
If I use this:
hero.position.x += speedX;
hero.position.z += ...
1
vote
3answers
268 views
Acceleration based on current speed?
The faster an object goes, the slower it will accelerate, going from 0 to 50 takes a lot less time then going from 50 to 100,
How do I calculate that, though?
EDIT: Extra details,
This specific ...
0
votes
2answers
160 views
How do I make a vector exactly reach a line?
Let's say a vector starts at Point P and points in the direction of v. How do I make sure that this vector exactly reaches the line? Its end should be exactly on the line, and not cross it.
-1
votes
2answers
178 views
How to make sure that a Point A moving in the direction V reaches at Point B?
Let say I have,
Point A(X1,Y1) moving in the direction V(W, H). I need to make sure that it reaches B(X2,Y2). I think I need to subtract some value in Point A(X1, X2). But not know what? I also sure ...
2
votes
1answer
134 views
Calculate the direction, From Outer Polygon Point to Inner Polygon inside Point
I was able to find the co-ordinates of inner Polygon using this trick.
Need the co-ordinates of innerPolygon
But, I have some problem in getting the direction from Outer Polygon Point to Inner ...
3
votes
2answers
85 views
Need the co-ordinates of innerPolygon
Let say I have this diagram,
Given that i have all the co-ordinates of outer polygon and the distance between inner and outer polygon is d is also given. How to calculate the inner polygon ...
2
votes
0answers
83 views
Constrained/penalized distance function
Assume a character is located on a n by n grid and has to reach a certain entry on that grid. Its current position is (x1,y1). Also on the same grid is an enemy with coordinates (x2,y2). Each step ...
1
vote
3answers
448 views
How do you blend multiple colors in HSV (polar) color-space?
In RGB color space, you can do a weighted multiple-color blend by just doing:
Start with R = G = B = 0. Then we perform a blend at index i using a set of colors C, and a set of normalized weights w ...
7
votes
1answer
577 views
Helicopter game, but waves?
I'm looking into adapting the classic "helicopter" game (i.e. http://www.addictinggames.com/helicopter.html), but I haven't yet figured out how to create the wall-generation engine.
Any pointers into ...
8
votes
2answers
568 views
Function for sun movement?
So, given a sun sprite set at the horizon (x = 0, y = worldheight/2) I'm trying to devise a function to make the sun rise, then fall.
The best way to do this would be the sin function, but I have no ...
11
votes
5answers
1k views
Quick 2D sight area calculation algorithm?
I have a matrix of tiles, on some of that tiles there are objects. I want to calculate which tiles are visible to player, and which are not, and I need to do it quite efficiently (so it would compute ...
3
votes
1answer
164 views
Math behind simulating a simple light source for rotated rectangle?
Say I have a 2D Rectangle. By offsetting its position by x y and rendering a shadow by an offset, it gives the illusion of a shadow. If I rotate the rectangle Z degrees and try it with the same ...
2
votes
1answer
277 views
Moving two objects proportionally
I'm trying to move two objects away from each other at a proportional distance, but on different scales. I'm not quite sure how to do this. Object A can go from position 0.1 to 1. Object B has no ...
11
votes
4answers
543 views
How do I get AI Agents to move along a curve?
Currently my very basic AI framework has agents that move along a a jagged path made up of a series of points.
They do this by simply moving their position from one point to the next. When they ...
6
votes
4answers
2k views
Calculating velocity needed to hit target in parabolic arc
If I have a point which I want to hit at the end or during a parabolic arc, how would I calculate the needed x and y velocity?
10
votes
5answers
852 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 ...
1
vote
3answers
133 views
Regulating how much to draw based on how much was drawn last frame
[Edit: I found an answer - see below]
I have a 3D game world on an iPhone (limited graphics speed), and I'm already regulating whether I draw each shape on the screen based on it's size and distance ...
3
votes
1answer
137 views
Coordinate based travel through multi-line path over elapsed time
I have implemented A* Path finding to decide the course of a sprite through multiple waypoints. I have done this for point A to point B locations but am having trouble with multiple waypoints, because ...
7
votes
3answers
4k views
Sorting array of points in clockwise order
Is there such an algorithm to sort an array of 2D points in clockwise order?
I'm specifically dealing with right triangle in my case so only 3 points.
However I'm interested in knowing if such an ...
4
votes
3answers
375 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 ...
5
votes
2answers
976 views
top down game - checking, drawing enemy's line of sight area with obstacles
Examples of what i'm going to need:
I'm using cocos2d to draw a CCTMXTiledMap, on those tiles i'll have to draw the LOS cone.
How would i test if the player is within that cone, taking obstacles ...
5
votes
3answers
197 views
Preventing ties
I'm working on a simple game to rate a users' preference among several styles. There are C classes, and the game consists of R rounds of comparison. At each round, the user is presented a ...
6
votes
2answers
461 views
Calculating and detecting curves
How can I detect the 'steepness' of a curve? For example, if the user swipes their finger across the screen in a curve, what's the best way of detecting whether the curve is almost a semi-circle, or ...
6
votes
3answers
1k views
How can I get a velocity vector for an object moving in a circle?
I am simply trying to make an object move in a circle around a point. Let's say I have an object with a position vector going from that point to the object, and also the angle of the object with the x ...
3
votes
1answer
233 views
Correct Blitting 2 surface problem
this is a graphics/math problem.
Consider this 2 sprite / surface
As you can see they are a tank and his gun turret.
Now, i manage the turret rotation, and it works, and, also, the rotation of ...
8
votes
3answers
398 views
How does one separate the acceleration due to gravity from other motion in accelerometer input?
How does one separate the acceleration due to gravity from other motion in accelerometer input?