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

3
votes
1answer
171 views

How to create a grid based on random shapes?

How to create a "grid" using actionscript like the image below? Basically you have an area of 1100x615 which should be filled with shapes that could be rotated and scaled... Collision detection ...
0
votes
4answers
303 views

Carve river beds into existing 3d procedural generated terrain

Ok, I've read many threads around about procedural terrain generation with rivers and roads but they suggest approaches from zero to result. I'd like to know if exists an algorithm to apply to an ...
3
votes
1answer
231 views

Verify which bubble is connected to top using DFS

I am working on a bubble shooter game in this game i have implemented searching using DFS as suggested in this link, and this is working fine. Update Here is my code for DFS ...
1
vote
1answer
142 views

Angular velocity from 2D Collision

I have been working on a 2D physics engine for my A Level computing project and I am having trouble calculating the angular velocity from a collision. I have managed to workout each objects linear ...
2
votes
3answers
150 views

How control probability of win-lose in tile-matching games?

In a random puzzle game, such as a match-three game, how can you control the probability of a winnable starting condition?
1
vote
1answer
138 views

Scanning a 2D tile map and detecting regions?

I have access to all points/tiles on the map with top-right most point being (0,0). Simplest way to traverse the map would be using for loops, one nested within the other to traverse the x axis, and ...
2
votes
1answer
56 views

How can I cut a graph representing 2D positions into two sub-graphs?

I have a graph where each node is associated with a 2D position. I would like to use a finite line to "cut" this graph into two halves, as shown below: Note that the cutting line does have a ...
2
votes
1answer
285 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 ...
5
votes
3answers
145 views

Pathfinding Search for Path of Specific Length

I am creating a roguelike. This question applies to random map generation. First, I generate areas using a BSP algorithm, where I randomly divide the map into areas. Then, I generate a graph of the ...
4
votes
2answers
172 views

Exists a dedicated non-O(n²) Algorithm for avoiding to have overlapping elements?

I am generating positions in a random fashion. In the game world, instantiated elements have a radius, and shouldn't overlap. The problem is that they will overlap because I use a usual random ...
4
votes
2answers
295 views

How can I adapt “random walk” generation to very large maps?

The random (or drunkard's) walk is a great, simple algorithm that can generate very organic-looking maps, such as this: Unfortunately it seems to have poor scalability, making it unsuitable for ...
11
votes
1answer
595 views

How does the Simple Stupid Funnel Algorithm work?

Working with the funneling algorithm shown on Digesting Duck I'm not sure how the detection of the funnel works. Can someone explain the method clearly to me or suggest an alternative way of ...
2
votes
2answers
108 views

Calculation: Is a sphere/square/plane visible from a certain point?

I'm searching for a way to detect if a form (shape can be changed if algorithm requires it) is visible from a single point in a 3D tile-based world. This should be used as some kind of wall-hack ...
1
vote
1answer
315 views

Pipe connection game algorithm - Java/Andengine

I am creating a game based on Pipe Dream/Pipe Mania using java/andengine for android. I have a square grid of tiles each representing a type of pipe. The player needs to swap tiles to connect the ...
1
vote
3answers
160 views

Simulating (Human) Needs? [closed]

How can I simulate the vegetation (of a human being)? To simulate Hunger for example, I use some kind of saturation based system now. Means that every food-object saturates differently and the ...
1
vote
3answers
259 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 ...
3
votes
3answers
359 views

Algorithm for game difficulty/pacing curve generation in single player RPG

I'm looking at this article about pacing in entertainment and games. It suggests that all good entertainment roughly follows a pacing/engagement curve like Star Wars(below). I'm interested in how I ...
0
votes
1answer
95 views

Tennis game algorithm and maths

Tennis courts are real dimensions and game is 3D Ball has position (x,y,z), speed(vx,vy,vz) and acceleration (ax,ay,az) Game has 30 fps and on each update (1/30sec) it has these properties vx +=ax; ...
3
votes
1answer
397 views

How can I optimize this flood fill algorithm?

I'm creating a sprite and animation editor like this one. I'm having performance issues with my flood-fill algorithm. Basically, I open an image with the different modules that are part of a frame of ...
10
votes
1answer
947 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 ...
1
vote
2answers
248 views

Filling in gaps in a grid

I have a set of terrain sprites available to represent terrain: Flat North-South Straight Cliff (x 2 allowing for slope direction either way) West-East Straight Cliff (x 2 allowing for slope ...
1
vote
1answer
94 views

Where can I find info on grid based algorithms for stateless AI? [closed]

There seems to be an overwhelming amount of info out there on AI of all kinds, and it's kind hard to digest at once. For my testing purposes, I'm creating a "typical stateless AI", as described in ...
1
vote
3answers
214 views

Randomly generating the hallways between a network of rooms [duplicate]

So here's my base map: (It won't necessarily be 5x5, just using this as an example.) It's kinda boring the way it is with all the rooms connected. I want it to be more of a randomly generated ...
1
vote
1answer
298 views

How should I generate the board for a match-3-style game?

I am trying to create a "match 3" game. I'm stuck figuring out a good algorithm to fill up the game board. My game's board is 8x8. EDIT: A few things: The board should always be solvable. for ...
0
votes
1answer
151 views

How to find a free patch of area in a tiled map?

I've been trying to formulate the question and try to find some information on Google, but didn't managed to, so here it is... We've got a nice tropic-themed game that is about to be released soon, ...
0
votes
0answers
36 views

Sprite rotation algorithm [duplicate]

I'm making a game where you have to plot a function to hit certain objectives. I already made the plotting function and the animation to display a tiny missile that travels above the function. My ...
1
vote
3answers
271 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 ...
4
votes
5answers
532 views

Goalkeeper Jumping Algorithm?

This may be a "best way to" question, so may be susceptible to opinion-based answers (which is ok for me). But I would also like if there are any tutorials , research papers , etc. I'm trying to make ...
2
votes
3answers
94 views

Divide rectangular image into fixed number of random sized rectangles + 1 fixed size rectangle

I'm trying to divide a rectangular image into a fixed number of smaller rectangular image parts (of random but bounded width / height), with the exception of 1 rectangle which is predefined in ...
1
vote
3answers
225 views

Send info about gun shots via UDP

I am writing a small multiplayer game in C++. But I am confused about how to send info about gun shots to achieve best performance. I am thinking of different ways to do that: Let's say we have a gun ...
8
votes
1answer
242 views

Algorithm to produce 'Lady or Tiger' puzzles?

What my problem is: There is a puzzle by Raymond Smullyan that works something like this: You are in a room with many doors. Behind some of those doors, there are ladies; behind the others, there are ...
0
votes
0answers
21 views

C# 2d array value check [duplicate]

I've managed to create a 2d array, then made it fill up with random numbers, like this: int[,] grid = new int[5, 5] ; Random randomNumber = new Random(); var rowLength = ...
11
votes
3answers
278 views

How to divide hex grid evenly among n players?

I'm making a simple hex-based game, and I want the map to be divided evenly among the players. The map is created randomly, and I want the players to have about equal amount of cells, with relatively ...
4
votes
1answer
244 views

Problem with SAT collision detection overlap checking code

I'm trying to implement a script that detects whether two rotated rectangles collide for my game, using SAT (Separating Axis Theorem). I used the method explained in the following article for my ...
0
votes
1answer
258 views

About the A* algorith(pathfinding)

We have a formula of f=g+h wherein g is the path cost and h is the distance left to the goal. Given that I only want to move my unit in 4 direction (N,S,E,W), my question is: Can we consider h as ...
6
votes
3answers
1k views

A-Star Pathfinding Not Giving Shortest Path

I'm attempting to implement the A* pathfinding algorithm in Java. I thought it was working well, but then I found instances where it doesn't follow the shortest path Green = start, red = target, ...
2
votes
0answers
157 views

Pathfinding with portals? [closed]

I'm not making a game with portals in it (one way or bidirectional). These portals instantly teleport characters from one location to another. How would I implement pathfinding? Here's an animation ...
5
votes
3answers
257 views

Algorithm for creating tree-like network structures

I'm trying to procedurally model tree-like network structures with the following properties: A root with variable number of nodes A variable depth of nodes When graphically laid out, edges or nodes ...
3
votes
1answer
191 views

Placing nodes in a graph in a random but readable way

I'd like to create a simple map from vertices and lines - you know, like a usual graph. A tree, to be precise. To select the location of the next point that comes from one, I use a simple ...
6
votes
1answer
346 views

Implementing David Silver's Cooperative Pathfinding in Real-Time

I'm currently implementing David Silver's Cooperative Pathfinding algorithm for a 2D game with grid-based movement (all eight directions). The issue I'm having trouble wrapping my mind around is the ...
6
votes
3answers
410 views

Need ideas for an algorithm to draw irregular blotchy shapes

I'm looking to draw irregular shapes on an x,y grid, and I'd like to come up with a simple, fast method if possible. My only idea so far is to draw a bunch of circles of random sizes very near each ...
2
votes
1answer
421 views

Path finding in hex grid based game

I'm making a TBS with hex grid. Player can move units from one hex to another using bridges, which will be randomly generated. I'm using cubic and axial coordinate system for my grid, it's well ...
1
vote
1answer
370 views

How to simulate cylinder shape in collision detection?

AFAIK, many physics engines like Physx and Havok don't incorporate cylinder as basic shape because it is expensive than sphere, box and capsule. But bullet engine does incorporate cylinder as a basic ...
-1
votes
1answer
121 views

What to change when neural network is not classifying correctly?

I'm designing a learning algorithm for a simulation. In this simulation, there are minesweepers/tanks and also mines. Tanks are supposed to avoid collisions with mines, I'm using a neural network for ...
2
votes
2answers
367 views

Canting of track in a racing game

I am trying to create a small racing game in which the track would be modeled using a BSpline curve for the path's center line and directional vectors to define the canting of the track at each point. ...
4
votes
2answers
412 views

Building triangle adjacency data

Given a list of triangle indices, how exactly does one go about converting that to a list of indices with adjacency for a geometry shader? Note that we're strictly talking about indices here - ...
2
votes
2answers
197 views

How to choose inputs to an artifial neural network?

I have to implement, as part of an assignment, a learning method that enables minesweepers to avoid colliding with mines. I have been given the choice to choose between a ...
2
votes
2answers
89 views

Decomposing a collision grid into a set of boxes

I'm looking for a decent algorithm to decompose a collision grid (e.g. bool[w,h])... ...into a non-overlapping set of boxes (e.g. List<Rectangle>). The solution does not have to be the ...
5
votes
1answer
195 views

What makes a path finding heuristic Monotonic vs. Non-monotonic?

I am currently working on an algorithm that solves a path through the maze. So far I have implemented a Manhattan and Pythagorean Heuristic. I was wondering what makes a heuristic monotonic and how ...
2
votes
2answers
124 views

How should I provide a navigation system for a world with infinite space?

The world is generated by perlin noise chunks and will only be saved once that chunk has been generated. It will also not necessarily have one obvious (to the user) central point anywhere in the ...