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

7
votes
5answers
3k views

What rendering techniques would I use to draw a drop shadow effect for cards in a card game?

What type of shading algorithm might be used to create shadows like these? the one I'm making is similar but it is all done with a 2D drawing API powered by OpenGL so there is no Z coordinate. In ...
2
votes
1answer
397 views

How can I make a car follow the terrain in a 2D (side-view) game?

I'd like to create a game where a car drives over a 2D terrain. Which algorithm to use so the car will follow the mountain incline?
6
votes
1answer
681 views

Finding which tiles are intersected by a line, without looping through all of them or skipping any

I've been staring at this problem for a few days now. I rigged up this graphic to help me visualise the issue: http://i.stack.imgur.com/HxyP9.png (from the graph, we know that the line intersects ...
0
votes
1answer
615 views

MiniMax function throws null pointer exception

I'm working on a school project, I have to build a tic tac toe game with the AI based on the MiniMax algorithm. The two player mode works like it should. I followed the code example on ...
2
votes
1answer
318 views

Moving two objects proportionally

I'm trying to move two objects away from each other at a proportional distance, but on different scales. I'm not quite sure how to do this. Object A can go from position 0.1 to 1. Object B has no ...
19
votes
6answers
534 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 ...
11
votes
4answers
782 views

How do I get AI Agents to move along a curve?

Currently my very basic AI framework has agents that move along a a jagged path made up of a series of points. They do this by simply moving their position from one point to the next. When they ...
11
votes
4answers
441 views

Fastest way to group units that can see each other?

In the 2D game I'm working with, the game engine is able to give me, for each unit, the list of other units that are in its view range. I would like to know if there is an established algorithm to ...
2
votes
1answer
295 views

Dynamically creating astar node map by triangular polygonal map

My game's map format uses a bunch of triangles to make up the platforms and terrain in 2d. Right now I can set up a 2d array of nodes for the astar algorithm that basically is a bunch of rectangles ...
3
votes
1answer
518 views

Better data structure for a game like Bubble Witch

I'm implementing a bubble-witch-like game (http://www.king.com/games/puzzle-games/bubble-witch/), and I was thinking on what's the better way to store the "bubbles" and to work with. I thought of ...
12
votes
2answers
1k views

How to implement an intelligent enemy in a shoot-em-up?

Imagine a very simple shoot-em-up, something we all know: You're the player (green). Your movement is restricted to the X axis. Our enemy (or enemies) is at the top of the screen, his movement is ...
0
votes
1answer
101 views

How do you map a 3D scene to a stero image pair?

I'm a novice. I'm working in XNA studio with simple models. How can I turn a 3D image into two images meant for the left and right eyes respectively? Note: I'm not referring to "magic eye" - I'm ...
5
votes
2answers
213 views

How to evaluate a user against optimal performance?

I have trouble coming up with a system of assigning a rating to player's performance. Well, technically there is is a trivial rating system, but I don't like it because it would mean assigning ...
19
votes
7answers
2k views

Optimizing gravity calculations

I've got a bunch of objects of varying size and velocity which gravitate towards each other. On every update, I have to go over every object and add up the forces due to gravity of every other object. ...
10
votes
2answers
573 views

Evolving a Terrain Generator

I just recently asked this question and the conclusion seems to be that using genetic programming (GP) for Procedural Game Content Creation hasn't really been done. I want to change that. I'm fairly ...
6
votes
3answers
1k views

Evolutionary Procedural Generation

Are there any examples of companies or papers using evolutionary algorithms (EA) or genetic programming (GP) in procedural generation of content for games? Does this exist in the industry? This is ...
3
votes
1answer
1k views

How many moves to think ahead for chess minimax AI?

I am thinking of making a chess game, and I read up on minimax trees. How many moves should the AI think ahead so that the player doesn't have to wait a long time? If there are 25 possible moves ...
5
votes
2answers
571 views

How could I improve this random map?

following my previous post on random world map generation, I used several algorithms and obtained results similar to this: http://i.imgur.com/CKL2R.png (the height values are quantisied for viewing ...
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 ...
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 ...
3
votes
3answers
855 views

tic tac toe computer opponent

I am just starting to do some very very very basic game dev(in java), i'm trying to create a game of tic tac toe but i am having some trouble implementing an a computer opponent.I just wanted to know ...
-2
votes
2answers
668 views

Why is my Diamond-Square implementation producing blocky, banded results?

Do you know why my diamond square algorithm is giving me this such "ragged" results? I used to render it in a way that concealed the roughness (basically asigning color ranges instead of fractional ...
10
votes
5answers
636 views

How would one determine the length of a path?

I have a game that requires each player to move along one specified path. I draw the path using Bézier curves. How can I determine the total real (not linear) length of the path and the distance that ...
4
votes
3answers
627 views

Implementing recoil in a realistic and balanced way?

To clarify, I've seen this post already I really like the idea that the chosen answer suggests, yet when I go to implement it the recoil still doesn't "feel" right. The problem is mainly the fact ...
7
votes
2answers
224 views

Determining if player-created structure matches a template in a 3D block-based game

Disclaimer: this is one of those dreaded Minecraft-style questions, but I feel it's more a data structures and algorithms question I'm really new to 3D data structures and am wondering what the best ...
7
votes
7answers
597 views

Random looking item placement that's deterministic?

I'm working on a sidescrolling game and I want to generate a forest for the background. I want the background to be the same for every one to make sure the quality is the same. I don't have access ...
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?
6
votes
1answer
567 views

Linking nodes algoritm for Visual Design

I'm developing an editor for my game, and now it's time to make a visual scripting system to let designer modify behaviours. This video shows what i have done and the problem to resolve the link ...
2
votes
1answer
401 views

All Pairs Shortest Paths in Weighted Undirected Graph

I'm currently working on path-finding for my game and need help with finding an efficient algorithm to calculating the all-pairs shortest paths in a weighted undirected graph (each vertex in the graph ...
4
votes
2answers
762 views

How can I implement shader lookups for my material system?

I have been working on a material system and for the most part everything works just fine, however, I hard code the shader that will be used. Obviously this causes a problem when I want to have the ...
2
votes
2answers
271 views

How can I animate a recursive algorithm?

Say I have a recursive algorithm, for example one that generates a random tree: // Pseudocode, just a simple algorithm: it isn't perfect. function generate_branch(angle, length, current_depth, ...
4
votes
2answers
455 views

Enemy mathematical behavior

I'm really trying to up my game in game mathematics and now I'm working on enemy movement and a bit of AI. I have an enemy with two modes attack and avoid, based on an integer avoid variable that's ...
2
votes
1answer
2k views

How do I generate a torus mesh?

I'm trying to programmatically generate vertices and indices for a torus. I found this piece of code somewhere, and it looks like it works, but I'm not certain it is correct. With my little knowledge ...
10
votes
1answer
669 views

Algorithm for a tool to theorycraft stats based on a game(league of legends)

I would like to create a simulator(basically for testing purposes) for a game(League of legends). The basics of the game: you have a hero which has some stats: Health Point Attack Damage Attack ...
-2
votes
1answer
557 views

Dungeon map generator not working in javascript

I am trying to convert this dungeon algorithm from java into javascript, however, my script works 70% of the time. When it works, the rooms are missing a wall on one side, and when it does not work, ...
9
votes
3answers
2k views

Networking in real-time strategy games

What is the current state-of-the-art to network real-time strategy games? I seem to recall that a few years ago, some AAA titles only transmitted the player inputs (Starcraft 1, Age of Empires). ...
0
votes
1answer
571 views

What is the difference between the marching cubes algorithm and metaballs?

After doing some research, I found out about the marching cubes algorithm and "metaballs". How exactly do they differ?
6
votes
2answers
437 views

Is it possible to have concurrent collision detection where every entity acts at exactly the same time?

There are many algorithms that can be used for collision detection. In many cases we check for an overlap in coordinates of an entity. If we make a triangle a,b and c. We have 2 entities at a and b ...
11
votes
3answers
8k 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 ...
1
vote
2answers
687 views

Why isn't my player movement code working properly?

I'm making a text-based RPG. One thing I've been trying to implement for a long time now is the ability for the player to move North, South, East, or West. I have my code placed in a MoveBehavior ...
12
votes
1answer
323 views

Detecting a sequence of nodes in a grid

Given the image below, I need to detect the most optimal sequence on the board (the green line). The blue/red lines represent possible, but not the best moves. Here are the rules: You can move to ...
4
votes
1answer
711 views

Issue with implemented Minesweeper algorithm

So I'm attempting to learn Python by way of Minesweeper. I've got experience with SDL, so I figured playing around with PyGame sounded like a fun way to learn the syntax of the language. Anywho, I'm ...
4
votes
2answers
352 views

How do I find the contour points of a png?

In my game, I need a way to produce convex polygons from pngs of objects. For example, a maple leaf would result like this: Essentially right now, the way my algorithm works is by putting all ...
5
votes
3answers
2k 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 ...
9
votes
6answers
732 views

Solving maze without return ability

I need to write a program that will solve maze. Maze has graph structure, where each node - some room, and edges - exits to other rooms: Specification: We start from a random room. Maze has ...
23
votes
2answers
827 views

Algorithm for spreading labels in a visually appealing and intuitive way

Short version Is there a design pattern for distributing vehicle labels in a non-overlapping fashion, placing them as close as possible to the vehicle they refer to? If not, is any of the method I ...
8
votes
2answers
422 views

Manage a large number of independent actors in real-time

I am working on a large scale real-time strategy game - ideally with thousands of units active at once - but I am having trouble managing all of the units at once without it becoming astonishingly ...
3
votes
2answers
525 views

How does Half Life's covering work?

Enemies in this game take cover. AFAIK HL uses some logical decisions for enemy to start searching for cover and to abandon cover, and I am able so far to find them; but how does he find a cover ...
49
votes
2answers
3k views

How can I get textures on edge of walls like in Super Metroid and Aquaria?

Games like Super Metroid and Aquaria present the terrain with the other facing parts having rocks and stuff while deeper behind them (i.e. underground) there's different detail or just black. I ...
2
votes
2answers
497 views

Best way to traverse triangles in a mesh

I'm implementing non-projective decals. As described in many places (ie: lengyel in the gpg2) I first need to detect all triangles that lie within some sort of frustum. Besides obvious brute-force ...