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

584 views

### Why can't my A* implementation find a path out of an open room?

I tried to follow this article with the following example, but in my attempts it always ends up with a dead end. If we take G being 10 in a straight line or 14 in a diagonal, and H the distance in ...
889 views

### Goalkeeper Jumping Algorithm?

This may be a "best way to" question, so may be susceptible to opinion-based answers (which is ok for me). But I would also like if there are any tutorials , research papers , etc. I'm trying to make ...
233 views

### Divide rectangular image into fixed number of random sized rectangles + 1 fixed size rectangle

I'm trying to divide a rectangular image into a fixed number of smaller rectangular image parts (of random but bounded width / height), with the exception of 1 rectangle which is predefined in ...
357 views

### Send info about gun shots via UDP

I am writing a small multiplayer game in C++. But I am confused about how to send info about gun shots to achieve best performance. I am thinking of different ways to do that: Let's say we have a gun ...
322 views

### Algorithm to produce 'Lady or Tiger' puzzles?

What my problem is: There is a puzzle by Raymond Smullyan that works something like this: You are in a room with many doors. Behind some of those doors, there are ladies; behind the others, there are ...
515 views

### How to divide hex grid evenly among n players?

I'm making a simple hex-based game, and I want the map to be divided evenly among the players. The map is created randomly, and I want the players to have about equal amount of cells, with relatively ...
536 views

### Problem with SAT collision detection overlap checking code

I'm trying to implement a script that detects whether two rotated rectangles collide for my game, using SAT (Separating Axis Theorem). I used the method explained in the following article for my ...
448 views

We have a formula of f=g+h wherein g is the path cost and h is the distance left to the goal. Given that I only want to move my unit in 4 direction (N,S,E,W), my question is: Can we consider h as ...
3k views

### A-Star Pathfinding Not Giving Shortest Path

I'm attempting to implement the A* pathfinding algorithm in Java. I thought it was working well, but then I found instances where it doesn't follow the shortest path Green = start, red = target, ...
335 views

### Pathfinding with portals? [closed]

I'm not making a game with portals in it (one way or bidirectional). These portals instantly teleport characters from one location to another. How would I implement pathfinding? Here's an animation ...
392 views

### Algorithm for creating tree-like network structures

I'm trying to procedurally model tree-like network structures with the following properties: A root with variable number of nodes A variable depth of nodes When graphically laid out, edges or nodes ...
505 views

### Placing nodes in a graph in a random but readable way

I'd like to create a simple map from vertices and lines - you know, like a usual graph. A tree, to be precise. To select the location of the next point that comes from one, I use a simple ...
800 views

### Implementing David Silver's Cooperative Pathfinding in Real-Time

I'm currently implementing David Silver's Cooperative Pathfinding algorithm for a 2D game with grid-based movement (all eight directions). The issue I'm having trouble wrapping my mind around is the ...
984 views

### Need ideas for an algorithm to draw irregular blotchy shapes

I'm looking to draw irregular shapes on an x,y grid, and I'd like to come up with a simple, fast method if possible. My only idea so far is to draw a bunch of circles of random sizes very near each ...
1k views

### Path finding in hex grid based game

I'm making a TBS with hex grid. Player can move units from one hex to another using bridges, which will be randomly generated. I'm using cubic and axial coordinate system for my grid, it's well ...
1k views

### How to simulate cylinder shape in collision detection?

AFAIK, many physics engines like Physx and Havok don't incorporate cylinder as basic shape because it is expensive than sphere, box and capsule. But bullet engine does incorporate cylinder as a basic ...
220 views

### What to change when neural network is not classifying correctly?

I'm designing a learning algorithm for a simulation. In this simulation, there are minesweepers/tanks and also mines. Tanks are supposed to avoid collisions with mines, I'm using a neural network for ...
425 views

### Canting of track in a racing game

I am trying to create a small racing game in which the track would be modeled using a BSpline curve for the path's center line and directional vectors to define the canting of the track at each point. ...
1k views

Given a list of triangle indices, how exactly does one go about converting that to a list of indices with adjacency for a geometry shader? Note that we're strictly talking about indices here - ...
424 views

### How to choose inputs to an artifial neural network?

I have to implement, as part of an assignment, a learning method that enables minesweepers to avoid colliding with mines. I have been given the choice to choose between a ...
135 views

### Decomposing a collision grid into a set of boxes

I'm looking for a decent algorithm to decompose a collision grid (e.g. bool[w,h])... ...into a non-overlapping set of boxes (e.g. List<Rectangle>). The solution does not have to be the ...
335 views

### What makes a path finding heuristic Monotonic vs. Non-monotonic?

I am currently working on an algorithm that solves a path through the maze. So far I have implemented a Manhattan and Pythagorean Heuristic. I was wondering what makes a heuristic monotonic and how ...
142 views

### How should I provide a navigation system for a world with infinite space?

The world is generated by perlin noise chunks and will only be saved once that chunk has been generated. It will also not necessarily have one obvious (to the user) central point anywhere in the ...
792 views

### Painting terrain with a selection circle

I don't mean putting a circle under a unit like done in an RTS, that's fairly simply done with a scenegraph(-like structure). What I'm referring to is selection circles for things like Area of Effects ...
80 views

### Translate velocity to mouse curos position

I have particles, with a velocity (x and y) per tick. I would like to to make my cursor a gravity force, so particles fly to the cursor's position. How can I apply gravity (that is towards my cursor ...
762 views

### Multiplayer matchmaking algorithm

I'm building a game in which there are tournaments. During the tournaments we want players to play against each other in an efficient way. What I'm looking for is a generic algorithm that will match ...
55 views

### Tetris-like wall-kicking not working [duplicate]

So I'm making a falling-block puzzle game. It's not a Tetris clone, but the block clusters move in a similar fashion. I want to make it so that if you rotate against a wall, or against another ...
865 views

### How do you construct a node map for pathfinding in a non-tiled 2D environment? [duplicate]

A* and Dijkstra's pathfinding algorithms work by navigating a node map. In a tile-based 2D environment, these nodes could easily be inferred to be the literal x,y positions of the map. For example, ...
92 views

### Symmetry preserving path simplification

I'm using the Douglas peucker (DP) algorithm to simplify some (2d) closed paths forming a shape. This works pretty good, but not so much for closed paths that have some symmetry. Take for example a ...
84 views

### Locating point on a closed path to maximize sum of distances to a sample of weighted points

I'm doing AI for a simple puzzled game and need to solve the following problem efficiently (less than 1 sec for the range specified since I need to do many iterations in a game). A sample of N (1 ...
193 views

### What's wrong with reversing an action like this?

I'm working on an undo and redo system map editor and have come across a major issue. If I place a tile down, move right a tile, and then move back to that tile I previously placed everything works ...
206 views

### Square collision: Detect which side of the wall it collided [duplicate]

I'm using a standard square collision in my 2D game. The player shoots little balls, and when they hit any wall it should bounce. The problem is that I know when it hits a wall but I don't know if ...
360 views

### Triangulating a partially triangulated mesh (2D)

Referring to the above exhibits, this is the scenario I am working with: starting with a planar graph (in my case, a 2D mesh) with a given triangulation, based on a certain criterion, the graph ...
360 views

### How do I make something I flash/blink more frequently as it gets closer to disappearing?

In my game when you kill an enemy they may drop something like a health pack or gold. I want this to have a time limit so that it eventually disappears if you don't pick it up. I want the item to ...
155 views

### Tangent basis calculation problem

I have the problem with seams with calculating a tangent basis in my application. I'm using a seems to be right algorithm, but it gives wrong result on the seams. What am I doing wrong? Is there a ...
213 views

### Enumerating full game tree for small board game

I am trying to list all the possible positions in a small board game (nannon) (using C++) So far I have decided to split it into two parts, the pieces that are in home positions and end positions ...
151 views

### AI discover algorithm

I am curious as to what algorithm/logic game AI/NPCs would use when discovering information about their environment. There are two scenarios that I could envision. The NPCs are all knowing in ...
84 views

### How to space actors in scene uniformly? [duplicate]

I have a Array data structure right now, which contains 10 soldiers in my army. They can setup initially in various formations - e.g. o o o o o o o o o o The user can move one of the ...
641 views

### How can I maintain a rectangular formation when units are added or removed?

I've got bots in a rectangular formation with rows and columns. A problem arises when a bot is added or removed from the formation. When this happens, the bots have to rearrange themselves so that the ...
1k views

### How do I apply different probability factors in an algorithm for a cricket simulation game?

I am trying to write the algorithm for a cricket simulation game which generates runs on each ball between 0 to 6. The run rate or runs generated changes when these factors come into play like skill ...
7k views

### Procedural river or road generation for infinite terrain

I should say paths, not roads as I'm thinking more medieval-like. Also, not looking for realism. The answer I'm looking for will be to fit into the mold I describe rather than realism. I am looking ...
169 views

### Precalculate the position of a rotating Aircraft

To start honestly, this question is probably mostly handling math. But thats only the road I tried to go and failed miserably, so maybe theres a much more simple way to do. Ok the game situation is ...
367 views

### Image Texture Tracing Algorithm - Cocos2D Box2D

Context: I am working on a 2D Destructible Terrain engine for Cocos2D with Box2D. All images, when a level loads, have their border's traced and cached for the purposes of forming Box2D b2EdgeShape ...
796 views

### Lightweight Simple Fast-Object Collision Detection Algorithm/Logic

I'm making a game where i need to give my objects collision, but i have many fast small objects and normal collision algorithms (Intersection of shapes and such) do not work, because the ...
565 views

### 2D sort for inventory items?

I asked this question some time ago. Now I ended up with just a sorter method that will sort the items based on their bulkiness/nSlotsRequired. Here's what I'm doing: I store all the items I have in ...
295 views

### Random 2D point in rectangle, but not in a polygon

I have a static rectangle and dynamic polygon. I need to generate a random 2D point in that rectangle, but not in a polygon. This is what I mean: Green is where random point can be generated and ...
1k views

### Multiplayer Network Game - Interpolation and Frame Rate

Consider the following scenario: Let's say, for sake of example and simplicity, that you have an authoritative game server that sends state to its clients every 45ms. The clients are interpolating ...
4k views

### Random/Procedural vs. Previously Made Level Generation

What the advantages/disadvantages of using random/procedural generation vs. pre-made levels? There seems to be few that I can think of, other than the fact that items may be a problem to distribute ...