Algorithms are used for calculation, data processing, and automated reasoning. More precisely, an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function.

learn more… | top users | synonyms

1
vote
1answer
66 views

Rotate an arrow on a plane?

I'm creating a display for a GPS-based embedded system and would like to have an arrow indicating the current bearing. I'd love the arrow to have a 3d appearance by rotating it on a plane tilted up ...
0
votes
2answers
64 views

How to write an adjacency algorithm that compares position data?

I have a list of indexed triangles for which I need to generate adjacency data. I've already written a brute force algorithm that creates 3 edge data structures for each triangle and then compares the ...
3
votes
1answer
98 views

Fighting Game Camera Positioning in SDL

I'm working on a 2D fighting game (using SDL) much like the original Killer Instinct on SNES. I want the camera to keep both players an equal distance from the left and right sides of the viewport. ...
1
vote
1answer
82 views

Swarm Algorithms [closed]

I have been asked to deliver a presentation for my university course on ant, bee and particle swarm algorithms. Therefore I am attempting to learn more about swarm algorithms and their uses within ...
1
vote
1answer
47 views

How to implement a hint-system for nearby matches (in a Match-3 puzzle game)?

Taking Candy Crush as an example: In a Match-3 game, how would you figure out which nearby tiles are 1 move away from creating a match? Do you basically have to do it by trial-and-error on every ...
0
votes
1answer
28 views

Point to coordinate function

I am working on a game in which I need an enemy ship to point towards the player. Here is the equation I came up with: angle = sin-1(abs(y1 - y2)/√(x1 - x2)2-(y1 - y2)2) This essentially takes ...
1
vote
1answer
63 views

How can I do a weighted cascade down a path in a 3D environment?

I am trying to perform a weighted cascade down a path in a 3D environment. Now, what I am trying to do is have one object(a cube) in the environment scan from its coords 1 in every direction for ...
0
votes
0answers
33 views

Displaying range around a unit [duplicate]

I'm looking to highlight a set of square tiles around a unit to signify its movable range. The concept should be quite familiar to those who have experienced the Fire Emblem series of game. I have ...
3
votes
2answers
152 views

A Star pathfinding algorithm, multiple node set optimization

I'm trying to determine if this is an optimization I should pursue or if this is way to complicated to be worth my time. I've successfully implemented the A Star Algorithm for my video game. I used ...
1
vote
1answer
50 views

Need help with algorithm for generating connected bricks in Pick A Brick clone

I want to make a clone of an Amiga 500 game, Pick A Brick, a 2D game where the goal is to clear a table of bricks by matching them up, following certain rules. I am getting nowhere when it comes to ...
0
votes
2answers
71 views

Quick algorithm to identify undrawn rectangles inside a map

I already have a working algorithm for this but it's home-made and there is some redundancy in the things it checks, so I'm looking for a fast algorithm (or the name of it) that would detect undrawn ...
2
votes
0answers
30 views

Calculate required resolution

Lets say I have a rectangle with width x and height y. Then there is transformation matrix T. Now, how using only those data can I estimate minimal resolution of texture (that is its width and ...
1
vote
1answer
159 views

Algorithm for staying “alive” forever

I am implementing a game where the player is playing(sliding) the little red rectangle and the purpose is to not hit the black rectangles and to not move out of the inner blue rectangle. The black ...
0
votes
1answer
48 views

Smooth path/direct movement

I have a tile based isometric map and an A* algorithm that returns a path. I am looking to smooth this path efficiently but with good aesthetics. Basically i am using my grid for building the map and ...
0
votes
1answer
54 views

Algorithm to find average position

In the given diagram, I have the extreme left and right points, that is -2 and 4 in this case. So, obviously, I can calculate the width which is 6 in this case. What we know: The number of ...
0
votes
1answer
26 views

Timed player collision

I'm trying to make the player loose one heart then cool down for a second after being hit. For an example if(a.overlaps(b)) { p.health--; } would lower the health while being touched. In my old ...
0
votes
1answer
23 views

Can GJK be used with the same “direction finding method” every time?

In my deliberations on GJK (after watching http://mollyrocket.com/849) I came up with the idea that it ins not neccessary to use different methods for getting the new direction in the doSimplex ...
12
votes
1answer
886 views

Efficient way to calculate “vision cones” on 2D tile map?

I'm trying to calculate which tiles a particular unit can "see" if facing a certain direction on a tile map (within a certain range and angle of facing). The easiest way would be to draw a certain ...
0
votes
2answers
100 views

Algorithm to make entities closely follow one another?

I have a group of entities that I want to follow a leader very closely. A good example would be how the player's soldiers move in Cannon Fodder. Any suggestions for achieving movement like this?
0
votes
1answer
83 views

How can I implement a percentage chance to perform some action? [duplicate]

Let's say that there is an X% chance that a character will shoot a target, or some other action. How do I determine if the action should be taken or not (how do I implement the percentage chance)?
21
votes
6answers
3k views

Algorithm to modify a color to make it less similar than background

I'm creating a demo of 20 balls bouncing each other, with a background filled with a solid color. Color for each ball is chosen randomly with randint(0, 255) for each R, G, B tuple component. Problem ...
1
vote
1answer
141 views

How to represent a map in a top-down perspective game with low algorithm complexity?

This is the first time I develop a video-game, and I am kind of lost. I would like to know about ways on representing 2D maps on a top-down perspective game... (Like this one: ...
0
votes
1answer
141 views

Surface creation algorithm using points cloud

I am looking for a realtime algorithm to create a 2D mesh using points. But I am quite confused. It seems that Delaunay triangulation can help me create mesh using point clouds, but Meta-balls seems ...
6
votes
3answers
336 views

How do I generalise Bresenham's line algorithm to floating-point endpoints?

I'm trying to combine two things. I'm writing a game and I need to determine the grid squares lying on a line with the floating-point endpoints. Moreover I need it to include all the grid squares ...
4
votes
1answer
90 views

Determining a sensible gear-like hierarchy for a series of connected objects

I would like a series of objects to behave in similar manner to a series of connected gears. This means that each black object in the diagram below will rotate at a speed based on the ratio of their ...
4
votes
2answers
350 views

Can I use an AI engine written in C++ in my Unity game? If yes, how can I do this?

I am studying some chess and others AI algorithms and the majority of these implementations are made in C and C++, my question is, if I make a chess board and all the graphic thing in Unity, can I ...
0
votes
1answer
34 views

Hash Distance & Angle To Produce Unique Value

I have many vertices drawn on my Unity3d C# application window (thousands). I am attempting to come up with a fast way to detect which vertex has been clicked. My idea is to use a sorted list. The ...
2
votes
1answer
50 views

Detect which object conceals another one

I've searched for a while for a good solution and if I'd have found one I wouldn't be here. So there are the details: I have been working on my 2D game using XNA, and I'm aware of the way XNA renders ...
0
votes
1answer
44 views

Bounds Queries for Simplex Noise Function

How do I construct a Bounds Query for 3D Simplex Noise? [This is more or less a follow-up to my last question] Simply put, for an arbitrary octree node (cube) in my volume (a section of Unity3d ...
2
votes
1answer
98 views

Best practice for organizing the physics of objects?

Apologies because this is a long post and I am inexperienced. I would really appreciate the input from some experienced developers. These are my two goals for this project: To learn the best ...
1
vote
2answers
220 views

Efficiently detecting objects inside multiple radius

I would like to create a game for mobile that require to calculate multiple time by seconds which moving objects are in the radius of moving points. The game is highly inspired from Gratuitous Space ...
0
votes
2answers
298 views

match 3 Shuffling

I'm interested in hearing about to implement similar functionality to Candy Crush's shuffling. I have an algorithm to determine if there are any matches available and if there aren't, I want to ...
2
votes
1answer
250 views

Procedural terrain generation

Currently I have a procedurally generated planet using multiple octaves of perlin noise. The thing is, that I don't generate heightmap, but rather get the values of perlin function and apply them ...
3
votes
1answer
209 views

How can I determine the extreme color values in a texture?

I am looking for a way to determine the most extreme color values for all of the texels in a texture. So for a texture consisting only of black and white texels, the extreme values should be (0,0,0) ...
2
votes
1answer
126 views

Is it more efficient to use an A* algorithm or a line system drawn in pathfinding in C#?

I was recently introduced to the A* algorithm when I asked a friend about making AI/NPC's in video games move to certain points and it sounded very interesting. I am building an FPS and it has AI that ...
1
vote
2answers
112 views

GA - Genetic Algorithm for Enemy

So I'm starting a project which aims to make a good AI for my game monsters. So far I have set up the GA and got some results. There's two genes, with one chromosome each. The monster either ...
0
votes
1answer
26 views

Is there an equation to determine when to invoke extrapolation in response to lag?

I've implemented interpolation to smooth character drawing in my networked game. But now I want to fall back on extrapolation if too much time has passed from a user sending an update and the ...
2
votes
2answers
161 views

How can I simulate the sun's position for 3D lighting?

I'm using a directional light as a light source. It dosn't have a positon, only a direction, represented by a vec3. I'm trying to figure out how to make the light direction to simulate sun movement ...
0
votes
0answers
86 views

Libnoise producing completely random noise

I am using libnoise in C++ taken and I have some problems with getting coherent noise. I mean, the noise produced now are completely random and it doesn't look like a noise. Here's a to the image ...
0
votes
0answers
103 views

Sun & Moon Movement

I'm creating a 2D HTML5 Canvas Game and am stuck on how to go about animating my Sun & Moon. The current setup is basically setting the moon at -1024 on the X-axis and the sun at 0 and animating ...
0
votes
0answers
73 views

Pixel alignment algorithm

I have a set of square blocks, I want to draw them in a window. I am sure the coordinates calculation is correct. But on the screen, some squares' edge overlap with other, some are not. I remember ...
1
vote
1answer
68 views

Creating blur with an alpha channel, incorrect inclusion of black

I'm trying to do a blur on a texture with an alpha channel. Using a typical approach (two-pass, gaussian weighting) I end up with a very dark blur. The reason is because the blurring does not properly ...
3
votes
2answers
301 views

Non-perfect maze generation algorithm

I want to generate a maze with the following properties: The maze is non-perfect. Means it has loops and multiple ways to reach the exit. The maze should be random. The algorithm should output ...
1
vote
1answer
57 views

Draw a rotated rectfill in Allegro 4.2?

I'd like to use Matricies to transform primitive geometric shapes and draw them using the Allegro library using version 4.2 (I can not switch to 5.x just yet). This works fine for non-filled objects ...
1
vote
2answers
55 views

Server side random selection of players

Assuming I have a simple client-server game, where the server picks random players on a very frequent base, I was wondering what is the best way to select a random player (According to the following ...
0
votes
0answers
44 views

How is the “continues road” from 80's games called and done? [duplicate]

i like to test the "continues road" effect from 80's racing games . i call it like this i have no idea how it really called the effect that a car is in front of you , and the road is Approaching to ...
1
vote
0answers
31 views

Any tips on developing an RTS unit movement collision? [duplicate]

so I am developing an RTS and I am a little stuck at this. I am not talking about pathfinding algorithms like A*. The problem is moving units in bulk and their collision along the way. Can anyone give ...
0
votes
1answer
90 views

How to store and use different AI behaviours

I'm coding a space shooter on three.js (WebGL) and since the game I'm doing is rather simple, plus I want to keep controll of the structure, I'm not using a game engine. I'm using oop classes and ...
14
votes
5answers
2k views

Networking for Real Time Strategy games

I'm developing a real time strategy game for a computer science course I'm taking. One of the harder aspects of it seems to be client-server networking and synchronization. I've read up on this topic ...
3
votes
0answers
89 views

Learning game and effect related mathematical tricks [closed]

I'm trying to learn how to code some "effects" more succinctly. For example, I have sprite clouds in my game, and their transparency is determined with the following formula on their update-method, ...