# Tagged Questions

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.

4k views

### Smoothing found path on grid

I implemented several approaches such as A* and Potential fields for my tower defense game. But I want smooth paths, first I tried to find path on very small grid ( 5x5 pixels per tile) but it is ...
1k views

### Is there a known most efficient version of A* search algorithm?

Is there a known 'most efficient' version of the A* search algorithm? I know some people write papers on the most efficient way to compute common operations, has this been done for A*?
676 views

### Help understanding Simplex Noise

Introduction This is less of a "how to" on using 2D simplex noise and more of a quest to understand what is happening both in the math and visually. I would rather not copy and paste the code I've ...
3k views

### Which algorithm used in Advance Wars type turn based games

Has anyone tried to develop, or know of an algorithm such as used in a typical turn based game like Advance Wars, where the number of objects and the number of moves per object may be too large to ...
171 views

### Generating 'Specially' shaped rooms for a Dungeon

I've made a fairly simple dungeon generator but now I want to expand on it so that I can procedurally generate a dungeon with irregular shaped rooms. I don't just want any old crazy shapes popping up ...
2k 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 ...
336 views

### Best 2d AI movement system

I'm creating a top-down rpg (no tile-based) using libgdx. Now I need to make enemies move on map with obstacles. What is the best approach to realize that? A*(I think, if enemy see player, he should ...
581 views

### How do I approximate the result of battle between two armies with known strengths?

I need a simple algorithm to calculate the outcome of two differently sized armies battling. Each army has 1-100 troops and every troop is the same value on the battlefield. The troops do not have ...
757 views

### What algorithms can I use for bullet movement toward the enemy?

I'm developing 2D strategy game. There are weapons that shoot at enemies. From what I've read in this, this, this and this post I think that I need linear algebra, but I don't really understand what ...
723 views

### Finding direction of travel in a world with wrapped edges

I need to find the shortest distance direction from one point in my 2D world to another point where the edges are wrapped (like asteroids etc). I know how to find the shortest distance but am ...
2k views

### How do I determine the draw order in an isometric view flash game?

This is for a flash game, with isometric view. I need to know how to sort object so that there is no need for z-buffer checking when drawing. This might seem easy but there is another restriction, a ...
1k views

### 2D helicopter game, how to create corridor walls?

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 walls-generation engine. Any pointers ...
2k views

### How can I add and subtract convex polygons?

I have two 2D convex polygons overlapping each other. I am looking for an algorithm to subtract and add them. The result must be a single concave polygon or (even better) a set of biggest convex ones ...
511 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 ...
833 views

### How to generate portal zones?

I'm developing a portal-based scene manager. Basically all it does is to check the portals against the camera frustum, and render their associated portal zones accordingly. Is there any way my editor ...
2k 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 ...
3k views

### How can I generate a terrain heightmap from the perlin algorithm?

How can I generate a terrain heightmap from the perlin algorithm? I am trying to make a terrain generator (like World Machine). This is the source code I have for the perlin. The only thing that I can'...
679 views

### How can I do optimal pathfinding for a Tetris piece?

Imagine a standard Tetris board (10x20) using the standard set of 7 tetrominos. Given a Tetris game state and a target position, how can I find the optimal sequence of moves that will get the ...
1k views

### Algorithm to make groups of units

In Age of Mythology and some other strategy games, when you select multiple units and order them to move to some place, they make a "group" when they reach the desired location: I have a Vector ...
2k views

### Bubble shooter falling algorithm

To complete this question about the same color search algorithm, I would like to know if someone knows which is the best implementation for making other bubbles fall when they are no longer attached. ...
1k views

### Repairing back-facing triangles without user input

My 3D application works with user-imported 3D models. Frequently, those models have a few vertices facing into the wrong direction. (For example, there is a 3D roof and a few triangles of that roof ...
2k views

### Collision detection of convex shapes on voxel terrain

I have some standard convex shapes (cubes, capsules) on a voxel terrain. It is very easy to detect single vertex collisions. However, it becomes computationally expensive when many vertices are ...
1k views

### How do I apply different probability factors in an algorithm for a cricket simulation game?

I am trying to write the algorithm for a cricket simulation game which generates runs on each ball between 0 to 6. The run rate or runs generated changes when these factors come into play like skill ...
622 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. ...
246 views

### Algorithm for approximating sihlouette image as polygon [duplicate]

Possible Duplicate: Is there any heuristic to polygonize a closed 2D raster shape with n triangles? I want to be able to analyze a texture in real time and approximate a polygon to represent a ...
580 views

### In a semi-infinite procedural (chunk based) map, how do you handle objects larger than a single chunk?

I'll use an example to try and be more specific. Assume this is for a 2D top-down game. Chunks in this are made up of 32x32 tiles. If procedural buildings were to be generated based on some kind of ...
2k views

### How does flocking algorithm work?

I read and understand the basic of flocking algorithm. Basically, we need to have 3 behaviors: 1. Cohesion 2. Separation 3. Alignment From my understanding, it's like a state machine. Every time we ...
837 views

### Match-3 algorithm to fill empty space left from removing matches

I am currently creating a match 3 game. I am at the point where I have objects dropping down in the column when only one item is removed. So if an item is removed, the above item moves into its old ...
612 views

### Why can't my A* implementation find a path out of an open room?

I tried to follow this article with the following example, but in my attempts it always ends up with a dead end. If we take G being 10 in a straight line or 14 in a diagonal, and H the distance in ...
2k views

### How can I ensure a grid can be filled with Tetris-like pieces?

I'm thinking of making a puzzle game where the objective is to fill a grid with shaped puzzle pieces (for example, the classic Tetris shapes). How can I go about generating a set of pieces that can ...
169 views

### trapped inside a Graph : Find paths along edges that do not cross any edges

This is a graph based platformer level and the round shapes are creatures. I am looking for a path traveling along edges that does not cross other edges(To simulate the creature crawling on the ...
208 views

### How do I generate random mountains in a sidescroller?

So I'm trying to make a simplified Terraria style world using Perlin noise. I got that working and the terrain is randomized. However the terrain always looks like like a weird cosines curve. Hills ...
278 views

### Create shape from points / lines in editor and mathematically calculate nearest points within shape

If I want an editor that accepts "points" of a minimum of three (a triangle) and I just add some points first, like this: how can I mathematically connect these corners (points) into an object of ...
376 views

### Line draw on “even-q” vertical flat topped hex grid

I'm trying to implement a Line Draw or Line of Sight algorithm for my hex boardgame. Upon reading several different solutions from most common places like the Hex Bible none of the algorithms adapted ...
2k views

### Why would someone chose midpoint displacement over perlin noise for 3D terrain generation?

I myself am creating a terrain generation algorithm and would be interested in knowing why others have chosen midpoint displacement over perlin noise. Minecraft is an example where midpoint ...
102 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 co-...
315 views

### How to order points on a 3D grid such that we can connect them in a line loop correctly

I want to recreate an effect as close as possible to X-Com: Enemy Unkown's movement range feedback: The blue line delimits the tiles which the soldier can reach using a single action. We also are ...
2k views

### Data structure for bubble shooter game

I'm starting to make a bubble shooter game for a mobile OS. Assume this is just the basic "three or more same-color bubbles that touch pop" and all bubbles that are separated from their group fall/pop....
890 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 ...
47 views

### midpoint displacement algorithm in sdl

I am trying to implement moving random hills in SDL. I am using midpoint displacement algorithm to create some random terrain and I have also accomplished to move the terrain too. But the problem is ...
96 views

### Implementation of finding an index in a 1D array for a triangular grid

Am using a while loop to find an index within a 1D array, is there an easier, less-time-consuming and/or mathmatical way to find the index? Consider the next grid: 4 o |\ | \ | ...
643 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 ...
2k views

### What kind of shader is this?

Cube World uses a pretty good looking shader, I especially like the shading of the characters: Is this soft shading? I'd like to achieve this effect in Unity 3D Free, but since the free version ...
61 views

### Random equidistant points like a tree branch (JS)

I'm working on an algorithm to generate a "graph" like array of points in my game world. See Image Below: Here is what i'm working on so far, which will generate the black line.. but this may not ...
25 views

TL;DR: My interstitial ads in my game are successfully loading, but when I call .show() on them, they don't show up! I have followed these directions, and the ads load succesfully, but don't show ...