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 ...
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.
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
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 ...
38
votes
5
answers
27k
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 ...
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 ...
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
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 ...
30
votes
2
answers
25k
views
Quad tree vs Grid based collision detection
I'm making a 4 player co-op r-type game, and I'm about to implement the collision detection code. I've read a lot of articles and stuff about how to handle collision detection, but I'm having a hard ...
30
votes
5
answers
4k
views
How do I avoid "too" lucky / unlucky streaks in random number generation?
I'm currently dealing with a multiplayer combat system where the damage dealt by the players is always multiplied by a random factor between 0.8 and 1.2.
In theory, a truly random RNG may eventually ...
29
votes
4
answers
26k
views
Simple noise generation
I'm looking to generate noise that looks like this:
(images courtesy of Understanding Perlin Noise)
I'm basically looking for noise with lots of small "ripples". The following is undesirable:
Are ...
29
votes
1
answer
13k
views
Methods for generating a map
I'm looking to create a simple, "randomly" generated map for a small game.
The game consists of a top-down view of a world, with land-mass and ocean areas. Think of a simple outline map of the world ...
28
votes
7
answers
30k
views
Algorithm for generating a 2d maze [closed]
What algorithm have you used in the past to generate a simple 2d maze?
27
votes
2
answers
3k
views
How do I produce "enjoyably" random, as opposed to pseudo-random?
I'm making a game which presents a number of different kinds of puzzles in sequence. I choose each puzzle with a pseudorandom number. For each puzzle, there are a number of variations. I choose the ...
24
votes
11
answers
4k
views
What are your favourite game-specific coding gems? [closed]
I'll start off with John Carmack's the Fast Inverse Square Root in Quake III:
...
24
votes
3
answers
13k
views
How to quickly calculate the sight area in a 2D tiled game?
I have a matrix of tiles, on some of that tiles there are objects. I want to calculate which tiles are visible to player, and which are not, and I need to do it quite efficiently (so it would compute ...
23
votes
3
answers
10k
views
Efficiently pathfinding many flocking enemies around obstacles
I'm working on trying to improve the pathfinding for my game's enemies. Right now, they basically just constantly move towards the player's exact position by calculating the angle between themselves ...
23
votes
6
answers
22k
views
What is the simplest method to generate smooth terrain for a 2d game?
What is the simplest method to generate smooth terrain for a 2d game like "Moon Buggy" or "Route 960"?
I got an answer at stackoverflow.com about generate an array of random heights and blur them ...
23
votes
2
answers
17k
views
How can I generate a navigation mesh for a tile grid?
I haven't actually started programming for this one yet, but I wanted to see how I would go about doing this anyway.
Say I have a grid of tiles, all of the same size, some traversable and some not. ...
21
votes
3
answers
37k
views
How to implement A.I. for checkers/draughts?
I saw this checkers game and I wondered how the A.I. was implemented.
How should I implement an A.I. for checkers (draughts, dama, dame)? Are there any known algorithms?
Very thnaks full to all. I m ...
21
votes
4
answers
23k
views
Calculating minimum velocity of the projectile 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?
20
votes
5
answers
13k
views
Calculate random points (pixel) within a circle (image)
I have an image that contains a circles at a specific location, and of a specific diameter. What I need to do is to be able to calculate random points within the circle, and then manipulate the pixels ...
20
votes
3
answers
10k
views
How do history generation algorithms work?
I heard of the game Dwarf Fortress, but only now one of the people I follow on Youtube made a commentary on it... I was more than surprised when I noticed how Dwarf Fortress actually generates a ...
19
votes
3
answers
6k
views
How can I generate floating land masses for a Minecraft-like engine?
I am creating a Minecraft-like engine in XNA. What I want to do is create floating islands similar to the one shown in this video:
http://www.youtube.com/watch?v=gqHVOEPQK5g&feature=related
...
18
votes
14
answers
4k
views
Does Big O really matter?
In academia worst case Big O is taught over everything else. Compared to space complexity, normal case analysis, simplicity over complexity, etc.
In particular to game programming and industry, what ...