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

4
votes
1answer
70 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 ...
-1
votes
0answers
32 views

collsion issues with quadtree [on hold]

So i implemented a Quad tree in Java for my 2D game and everything works fine except for when i run my collision detection algorithm, which checks if a object has hit another object and which side it ...
0
votes
1answer
52 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 ...
-1
votes
0answers
42 views

Algorithm to shift the car [on hold]

I have a track that can be divided into n number of tracks and a car as GamObject. The track has transforms such that some part of the track's width lies in negative x axis and other in positive. ...
0
votes
1answer
24 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
17 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 ...
2
votes
1answer
117 views

How do I convert a partially transparent image into polygons?

I'm using GLEE2D, a level editor allowing me to import images, scale them, rotate them, and position them onto layers and export the data into XML format. However, it does not tell me objects' ...
12
votes
1answer
759 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
92 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?
8
votes
4answers
4k 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?
2
votes
1answer
228 views

How do I avoid pathfinding characters getting stuck in corners?

I used A* pathfinding to return a list of Tiles to get from an enemy to the player. After that, I wasn't sure how to actually move the enemy. What I ended up doing was get the first Tile in the path. ...
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 ...
10
votes
1answer
1k views

How do Raymarch shaders work?

I have been looking at shaders found here shadertoy.com and most of the cool ones have noise and raymarch in common. I do not understand the source code at all but I really want to. How do these ...
0
votes
1answer
72 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)?
1
vote
1answer
121 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
80 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
226 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 ...
14
votes
3answers
14k views

How can I create a random “world” in a tile engine?

I am designing a game that is working on a classic tile engine, but whose world is generated randomly. Are there existing games or algorithms that do this? The procedural generation algorithms I have ...
4
votes
2answers
317 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
29 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
49 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
37 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
85 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
202 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
221 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
196 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
205 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
121 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 ...
22
votes
2answers
10k views

Understanding Perlin Noise

I'm toying with Perlin Noise after some work with Diamond Square. I followed the implementation by Hugo Elias that basically, makes a series of functions with x,y as input to throw each coordinate ...
1
vote
2answers
98 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
78 views

What is the simplest algorithm or pattern to continues ground/Floor

Im beginner in 3d gaming , i have basic question not Language specific. Say i have ground model for example terrain i modeled what is the common way to load the terrain and use it again Or load ...
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
144 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
68 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 ...
6
votes
2answers
189 views

How can I generate Sudoku puzzles?

I'm trying to make a Sudoku puzzle generator. It's a lot harder than I expected and the more I get into it, the harder it gets! My current approach is to split the problem into 2 steps: Generate a ...
0
votes
0answers
94 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
69 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
60 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 ...
2
votes
2answers
199 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
2answers
53 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 ...
1
vote
1answer
44 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 ...
37
votes
3answers
13k views

How to generate random level from a seed? [closed]

How would I go about using a random seed to generate a game level? The same seed should always generate the exact same level. For this example it would be a Worms style level. So each level would ...
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 ...
0
votes
1answer
293 views

Random/procedural generation of puzzle-platform levels

I have an idea for a puzzle-platform game where the levels would be randomly generated. Creating a random generation is relatively simple. What's not easy is checking that randomly generated level to ...
7
votes
2answers
944 views

Choose tile based on adjacent tiles

I am working on a tiled map editor, and I need to choose tiles automatically, based on the adjacent tiles. For example, when placing a road tile, next to another road tile, the two need to be oriented ...
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 ...
0
votes
1answer
89 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 ...
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 ...
2
votes
2answers
98 views

Connecting two arbitrary points with 2 lines

DEFINITIONS: Any "Point (x, y)" mentioned below is really the bottom left coordinates of a 1 unit by 1 unit rectangle. A "Line" is a defined as a rectangle that is either 1 unit tall and 1 unit or ...
3
votes
0answers
85 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, ...