# 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.

33 views

### Z-order curve — how to query all nearest neighbors?

TLDR: How to query all nearest neighbors with the least effort? (Iterating over a bigger neighboring area that's continuous and filtering out elements that are not immediate neighbors?) Suppose the ...
69 views

### How to fill a canvas with triangles that are seemingly random?

Given a canvas say, 1000 X 1000 unit. I would like to fill the canvas with triangles. The triangles can be of any type right angle, equilateral...etc. To avoid big chunks of triangles lets say all ...
51 views

### Image-Space coherence of the z-buffer algorithm

I'm reading Hierarchical z-Buffer Visibility by Ned Greene et al. and they state that traditional Z buffering makes reasonably good use of image-space coherence in the course of scan conversion. ...
598 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 ...
509 views

### Cavity map generation

I am looking for an algorithm how to generate cavity (or curvature) map. There seems to be no refernce to it, only final solutions like xNormal software, but that is not what I want. I am looking for ...
187 views

### Graph search with a high number of actions

I have implemented A* to reach a goal state from a start state. My state is position X,Y, angle and others state variable. I have a number of actions. What I call actions is : A* on a grid has 4/8 ...
139 views

### Level of detail for the map of stars

I have a large list of points (millions) in 2d. Let's say it's a star map. Each star has a radius and position in space. I want to render this map at different level of details. From a single star to ...
74 views

### Delay when moving elements

How you can see my mouse goes little bit faster than widget. My movement algorithm is: cursorPositionPrev.set(cursorPosition); cursorPosition.set(getCurrentPos()); ... Vector2f delta = new ...
47 views

### Algorithm for 2d AI aiming to compensate for gravity

In a 2d side-view scenario I have two riflemen aiming at each other. By normalizing the x and y difference they know the direct path to the enemy. However, gravity will pull the projectiles downwards,...
467 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 -(void)callDfs:(int)...
104 views

### What's the best way to deal with platformer tile collisions?

I am starting with game development and creating a basic platformer game. I already have searched a lot and found some ways to implement the platformer aspect to the game, like apply a gravity, ...
1k 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 ...
26 views

### Optimize field of vision algorithm in a grid tiled map

I am trying to implement Field of View algorithm in my game and I followed the great tutorial here : sight-and-light and here is what I got so far : As you can see it works fine for me :) And then ...
40 views

### What's an optimal procedure to create a connected cyclic grid of nodes and edges for A* pathfinding

like the title says, I'm trying to create a grid of nodes that hold edges or connections to each other so I can perform A* algorithm to have objects traverse across them as seen in your standard RTS. ...
19 views

### Calculating the poly vertices based on the result of Connected Component Labeling

I am making a tile based game. And now I can find all the connected area using the Connected Component Labeling algorithm. But now the problem I am having is how to calculate the poly vertices of ...
125 views

### Integrating specular, diffuse reflection and refraction

I am implementing an MLT bidirectional path tracer. I have a problem integrating diffuse, specular reflection and refraction. 1) The first problem is diffuse and specular reflection. Diffuse ...
95 views

### Calculating unique ID number from a set of bitmasked tiles

So I write this kind of match3-style game where you as a player need to match tiles with three or more of the same type and I'm thinking what is the best method to recognize the shapes without writing ...
40 views

### Combining lots of small polygons to one (some) big poly(s)

I am looking for algorithm to merge lots of relatively small 2d polygons to one or some big polygons. In case two small polygons are touching or overlapping, they should be merged to one polygon. My ...
110 views

### Isometric scene in SpriteKit

I tried play with spritekit in isometric grid. But i can't understand how to fix level. import SpriteKit import XCPlayground let view:SKView = SKView(frame: CGRectMake(0, 0, 1024, 768)) ...
80 views

### How do I reference one gameObject with script attached to other?

this is all in Unity 3D with C#. Thing is, I have attached a script to my player that should Destroy TreeGroup (as in forest) whenever I press 'Q' and Instantiate them when I press 'E'. Here is the ...
350 views

### How to calculate delta time with SDL?

I have heard that you can calculate delta time with two functions called SDL_GetPerformanceCounter and SDL_GetPerformanceFrequency. I'm not sure how they work completely, but I heard it is a bit ...
51 views

### How to combine dynamic asset reload and texture atlases? (rectangle packing with removal)

Usually texture atlases are built either: as a seperate content pre-processing step or once when the game starts What I want to do is create and update atlases on the fly when: A new texture ...
103 views

### Texture Mapping to procedurally generated geometry

How can I calculate texture coordinates of such geometry? The angle shown in the image (89.90 degree) may vary, therefore the geometry figure is changing and is not always such uniform.(maybe like ...
46 views

### AI parameters for Tetris like game

I am building an AI to play a variation of Tetris. The rules are changed in that there are 19 different types of pieces, rotation is not allowed, and the pieces can be placed anywhere in a 10X10 grid. ...
54 views

### Evaluate 2D point in a 3D triangle?

Given three points, (x1, y1, z1) (x2, y2, z2) (x3, y3, z3) and given a point "A" at (x, y), how would I find "A'", at (x, y, z)?
48 views

### midpoint displacement algorithm in sdl

I am trying to implement moving random hills in SDL. I am using midpoint displacement algorithm to create some random terrain and I have also accomplished to move the terrain too. But the problem is ...
19 views

### rendering moving terrain using midpoint displacement algorithm in sdl

This is in addition to the question I asked over here. midpoint displacement algorithm in sdl. The answer there helped me but I am facing another problem regarding the moving part. The terrain ...
1k views

### 2D Drag Racing Algorithm

What algorithm can I devise for a 2D drag racing game to simulate a race? The gameplay is 2D and the camera's perspective is from the right side of the cars i.e. cars are seen from their right side ...
191 views

### How do I calculate paths for objects with limited acceleration?

For example, say I have a car and a car has a specific minimum turning radius and I want to drive that car from point a to point b, but the car isn't facing point b. How do I compute a path to point ...
97 views

### Is there a way to make this better? [closed]

So was experimenting in making a rotating ring puzzle like the one to get into the mechanical age in Myst. I came up with a solution that will rotate the rings and when the button is released it ...
2k views

### How can I ensure a grid can be filled with Tetris-like pieces?

I'm thinking of making a puzzle game where the objective is to fill a grid with shaped puzzle pieces (for example, the classic Tetris shapes). How can I go about generating a set of pieces that can ...
11k 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 ...
415 views

### How do I generate solar systems for a 2d universe map, but still look random

I need to generate 64 systems separated into 16 sectors, each with 4 systems. Each system must have another system within 10 units in it's own sector, but no closer than 3. One system in a sector ...
172 views

### How do game engines mitigate CPU cost for many trigger zones & entities? [closed]

It's a rather simple question, but a somewhat fundamental in computing in general. Let's say we have a player controlled character in an open world. The world is large. In this game-world we have a ...
32 views

### AI: Turn-Based Movement with 2 actions per Unit

I am currently building a turnbased tactics game. The Board is a small (about 4*6) tiled grid. The AI plans all moves of its units, each unit can move 2 times move and attack or attack at ...
106 views

### How to create a believable swimming fish animated Sprite in 2d?

I want to create a fishing game in which fish needs to be swam across in the ocean. I put static fish which just progresses across ocean but it does not look very realistic and interesting to attract ...
25 views

### Automatic audio segmentation and find the most energetic segments

What algorithm can be used for audio segmentation? I want to divide song to segments and find the most energetic segments (begin and end in seconds). It is needed for the rhythm-game. Examples: ...
91 views

### C++ Data structure pattern preferability?

So im looking at ways of handling large amounts of data in situations such as an entity manager or particle system. So i have concluded to use an object pool, and there are two things that I could do ...
113 views

### Java, spawn algorithm that gets harder each level

I am currently in the process of making my 3rd Java game (everything I have learned is from YouTube videos, so I may be doing some things wrong) named "Blocked". But I have run into a problem: how do ...
102 views

### How can I remove unnecessary nodes from my path?

How do I remove the unnecessary nodes from the path to make it as short as possible? Idealy I'd like the result path to look like the green line. The red thingy is not walkable. var ...
42 views

### Algorithm to propagate internal Physics force in a structure of building

Scenario: A floating structure composes of many nodes (or in more visual meaning - a cubic block). Every node is snapped to the same 3D grid. (similar to a minecraft castle) There are external ...
44 views

### How can I make cars drive navigate an intersection without colliding?

I'm trying to create a 2D game with a traffic intersection: My car game-objects need to pass through the intersection without colliding with each other, and without stopping, if possible. How can ...
1k views

### How can I develop a Lights Out solving algorithm?

I am programming the game that named Lights Out. The purpose of this game is turning all the lights out. There's a flash version of the game here. I want to develop a way of solving the game. How can ...
61 views

### How to constraint random spawn points to a road? [closed]

I have a terrain and a road. I would like for spawn points to randomly appear on the road, and not outside on the terrain. How to assign the spawn points to only be between the road and in random ...
1k views

### Algorithm to make groups of units

In Age of Mythology and some other strategy games, when you select multiple units and order them to move to some place, they make a "group" when they reach the desired location: I have a Vector ...
532 views

### Tongue pull effect

I've been searching on the net for several days and can not find nothing about this effect. Even a name for this effect. I want to make a character that can use his tongue to pull objects objects it ...
20k 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?
376 views

### Finding a moving target in a maze

I'm making a game that is a bit of a mix of snake and pacman. Basically, two players go through the maze and each time they pick up a piece of candy, a cube is added to their tail. If one player ...