Questions tagged [algorithm]
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.
1,167 questions
82
votes
5
answers
39k
views
Procedural... house with rooms generator
I've been looking at some algorithms and articles about procedurally generating a dungeon. The problem is, I'm trying to generate a house with rooms, and they don't seem to fit my requirements.
For ...
69
votes
7
answers
22k
views
How does A* pathfinding work?
I would like to understand on a fundamental level the way in which A* pathfinding works. Any code or psuedo-code implementations as well as visualizations would be helpful.
62
votes
9
answers
58k
views
Texture packing algorithm
What is a good texture packing algorithm? Technically, bin packing is NP-hard, so a heuristic is what I'm really after.
56
votes
1
answer
41k
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 ...
52
votes
11
answers
59k
views
What path finding algorithms are there? [closed]
I'd like to read up on path finding algorithms. Is there a primer available or any material or tutorials on the Internet that would be a good start for me?
49
votes
3
answers
11k
views
How can I generate Worms-style terrain?
I'm working on a Worms-styled game and want to generate some terrain procedurally. I've previously done a lot of terrain generation using perlin noise, and this is what I started out using for this ...
49
votes
3
answers
46k
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 ...
40
votes
9
answers
14k
views
How can I quantify a drawn line's straightness?
I'm working on a game which requires players to draw a line from a point A(x1,y1) to the other point B(x2,y2) on the screen of an Android device.
I want to find how well that drawing fits to a ...
38
votes
5
answers
28k
views
In 2D, how do I efficiently find the nearest object to a point?
I have a sizable game engine and I'd like a feature for finding the nearest of a list of points.
I could simply use the Pythagorean theorem to find each distance and choose the minimum one, but that ...
37
votes
5
answers
38k
views
How to generate caves that resemble those of Minecraft?
I've been working on a 3D procedural world for a while now and am wanting to start adding cave systems. I'm currently using 2D/3D Perlin Noise for the terrain generation in combination with Marching ...
34
votes
12
answers
10k
views
How can I make A* finish faster when the destination is impassable?
I am making a simple tile-based 2D game, which uses the A* ("A star") pathfinding algorithm. I've got all working right, but I have a performance problem with the search. Simply put, when I click an ...
33
votes
7
answers
4k
views
Elegant way to simulate large amounts of entities within a game world
Assume you have a game in which there are many (many many) entities serving some functions, not all of which are constantly needed or need to be considered in every frame. The concrete problem I am ...
32
votes
5
answers
77k
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 ...
32
votes
2
answers
13k
views
How can I generate a lightning bolt effect?
Is there an algorithm to generate a lightning bolt?
I would like an algorithm that generates a list of segment or point objects specifying where the bolt will land. The method would need a start point ...
32
votes
2
answers
30k
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 ...