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.

learn more… | top users | synonyms

5
votes
2answers
1k views

Tile pair matching algorithm

I'm trying to make a tile matching game. User can select a pair of tiles from a square grid, and if they match, both are removed from the grid. Tiles are matched if: they are of the same type ...
4
votes
2answers
166 views

What is the best way to store temporary selected characters and their insertion order?

I'm developing word game similar to word mole. I'm having a hard time determining how to store temporary selected character (and in turn will changed into word). Here's the situations. Say, I have ...
3
votes
2answers
363 views

How to place objects/entities randomly in JS?

I'm making a game and I have a script (running it with Node) on the server that currently just randomly places things on the map... I'd like to change that. I saw something about Perlin noise but I'm ...
5
votes
1answer
3k views

Generate islands/continents with simplex noise

Managed to get something like this using a simplexnoise port i made from the original javacode to php: Used some tips from other post: Understanding Perlin Noise basically, lowered the frequency ...
2
votes
1answer
514 views

Help me to fine tune my diamond-square algorithm

Check this map i generated: I seeded a sine wave to act as a mountain range. The lower portion of the sine wave looks fine, but the upper side is thin, the algorithm did not do its magic there ...
3
votes
1answer
239 views

How can I organize code for views efficiently?

I'm making a video game for the Android platform and I need advice on the overall set up of the activities and views in the code. I don't need actual code, psuedocode will do, but actual code always ...
3
votes
2answers
392 views

Balancing a binary tree continuously

In my game I have a tree of objects in 3D space, to which new objects are frequently added. Over time, the binary tree becomes unbalanced which is a big problem for efficiency as the tree can become ...
2
votes
2answers
794 views

Algorithm to generate small tree-like branches?

I'd like to seed a void map with "branches" of sine waves or any other waveform. Something like: Know of any algorithm? Has to be one to generate trees or something like that.
4
votes
1answer
735 views

Find sub-graphs in a graph

The initial problem I'm trying to solve is for pac-man, but of course there must be thousands of other situations with the same problem. I consider the pac-man grid to be a graph (two ways of doing ...
4
votes
3answers
977 views

Simple speed deceleration with variable time step?

When you use a fixed time step you can call speed=speed*0.95 to emulate speed deceleration in a simple way. I want to do the same thing with variable time step. I wish to have a simple function ...
17
votes
4answers
6k 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: ...
3
votes
1answer
186 views

Math behind simulating a simple light source for rotated rectangle?

Say I have a 2D Rectangle. By offsetting its position by x y and rendering a shadow by an offset, it gives the illusion of a shadow. If I rotate the rectangle Z degrees and try it with the same ...
1
vote
2answers
350 views

Learning C++, algorithms and vectorial algebra [closed]

I need your recommendations for a good study source about videogame orientated C++, algorithms and vectorial algebra. I will be applying to a videogame programmer course in January so I need to start ...
3
votes
2answers
818 views

Score Based on Game play Time and a Int

I'm trying to do a score that is based on the time taken and number of manipulators used. The faster you do it, with the fewest manipulators, the higher the score. I've managed to get it working with ...
26
votes
2answers
3k 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 ...
7
votes
3answers
534 views

Algorithm for Randomized Weather

I'm having a hard time modeling weather. Modeling a single aspect is trivial - some sinusoidal pattern + random noise. However more than 1 is blowing my mind. I cannot have wind, falling leaves, ...
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
399 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
703 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
621 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
321 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
544 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
812 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
442 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
300 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
545 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
214 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 ...
20
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
580 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
2k 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
585 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 ...
15
votes
3answers
15k 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
11k 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
868 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
679 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
667 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
652 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
227 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
621 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 ...
10
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
568 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
415 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
776 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
274 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
468 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
691 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 ...