Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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
vote
1answer
111 views

Solvable mazes that have contained cells

Is it possible to create a random maze that is solvable and uses a group of cells or single cells that do not depend on the cells around them? I am using a visual language that uses self contained ...
2
votes
1answer
227 views

Triangle Texture Packing Problem

I'm trying to create a texture atlas where each triangle face is laid separately from each other (i.e. it is not typical mesh parameterization). In order to do this, I would have to pack the triangles ...
7
votes
2answers
240 views

Generate random people with demographics

I would like to have random people with preferences generated for an economic strategy game. For simplicity, lets say each person has age(number), home area and its type (city,village,...) and ...
0
votes
1answer
398 views

minimax AI code stuck in a loop

Disclaimer: First time trying to implement a AI using minimax approach (its a turn-based game). There are not many good resources available online to learn AI (specifically minimax in C#) so I am ...
0
votes
1answer
786 views

How can I manage weapon recoil?

I have some trouble to do a Recoil routine. I've a Tank, a turret cannon on it. I want that after shot, turret fast recoil back, than (slowly) get back to start position. This is the code I've ...
3
votes
1answer
826 views

How to smooth jagged pixel edges in Unity?

So I am reading an image from a png file into a 2D sprite. This sprite serves as a "province" in my game. Currently, I am getting this: If you look closely, you will notice that you are seeing the ...
1
vote
1answer
192 views

Path finding: avoid being surrounded by enemies

I'm building a bot that plays a simplified version of Pac-Man. The bot does a pretty good job, but sometimes it chooses a path where it ends up surrounded by enemies. Here is an example: ...
0
votes
1answer
407 views

A* algorithm works silly with heap

I'm trying to use A* and visualised it, but when i add a heap optimization it start looking in incredeble ways sometimes normal(better then next to be sure), somtimes he looks on few columns. Normal ...
1
vote
2answers
2k views

HPA* Pathfinding, building the hierarchical graph is too slow

So I have a graph, roughly grid shaped, that is about 300*300 nodes large. Even at this size, however, traditional a star takes 20 seconds to run in some cases. So I implemented an HPA* algorithm to ...
0
votes
1answer
188 views

Möller-Trumbore false positive result in specific point

I copied code from this whitepaper and i can't figure out while it gives me false-positive intersections. Here's problematic values: Triangle points: (100.0, 100.0, 100.0), (-100.0, 100.0, 100.0), (-...
1
vote
2answers
69 views

What is the best practice to handle event with order?

When you play card games, you always face some abilities and effects will be triggered at the same time. To resolve this, players relies on the rules. For example, if a minion dies, it triggers ...
1
vote
1answer
83 views

Creating an Array of 1s and 0s (with all 1s touching)

I am a novice programmer trying to add an unnecessary and complicated element to a text adventure! ...and I've run into a question I am not sure how to research further (I suspect due to lack ...
0
votes
1answer
54 views

Recognize that user has traced a path of vector points with mouse

How can I check if a player has traced a closed vector shape from an arbitrary starting point all the way around to the beginning? Setup Given are the vector points A through E, which form a closed ...
2
votes
2answers
279 views

Avoid unreachable rooms in duengons

Good evening. Im currently trying to create a Dungeon Generator . First I place randomly some rooms. Right after that I dig in a randomized maze. But sometimes it happens that some rooms or even ...
2
votes
0answers
57 views

Representing a high-resolution deformable solid in 3D

I am currently working on a design that will incorporate an object that can change size and shape. For an example, I'll use a brick of clay. It starts out with normal dimensions of 1"x3"x6", but that ...
3
votes
2answers
449 views

How can I make a “paint” effect?

I am wondering how one could implement "paint" in games. As a reference, I have two games I am specifically thinking about which are Super Mario Sunshine with its "goo" and Splatoon. I'm wondering ...
-1
votes
1answer
95 views

Implementation of A* Algorithm in a 3D Cube Array

I am working on making a program that finds the most efficient way to a goal from a starting point, with a few random debris set around. The entire thing is a 25x25x25 3d array of Cube objects, which ...
3
votes
2answers
264 views

Does anyone know what terrain generation algorithm is used here?

Does anyone know what this terrain generation algorithm is called? I saw it in two places. One was on YouTube, and the other, on Wikimedia.
4
votes
3answers
244 views

Creating a “world” for evolution of programs

I am trying to create a "world" where "copies of programs" are allowed to evolve, proliferate and fight for resources. Organisms copy information with errors and memorize the results. It seems like ...
1
vote
1answer
173 views

Turn Based AI Algorithm (Small Board, Two Steps)

This is my Game-Board: -> The Red Balls are the AI-Controlled Actors. -> The Blue Balls are the Player-Controlled Actors. -> The Yellow Cells are the locations, from which the Red Balls can attack. ->...
0
votes
2answers
431 views

How to get a smooth path for a vehicle in a 2D top down map?

I am making a 2D tile based game which involves having AI that needs to traverse the map avoiding obstacles in a natural and smooth path (NOT NECESSARY THE SHORTEST) The orientation of the vehicle is ...
3
votes
2answers
175 views

How to calculate building cost with production per hour?

I know that it may not detailed thread title but I will give more detail about my question. I'm working on a strategy game, and can't find a solution about building cost or training cost. I spent 1 ...
6
votes
2answers
3k views

How to find a safe path for an AI snake?

I have been working on a game in which a player can compete with a snake ai to get the most apples. The current path finding technique i use (A* Pathfinding) works fine. But I am struggling with ...
0
votes
2answers
94 views

Ball jumping algorithm

I'm still starting out anf i'm making a 2d game where a ball which jumps through different blocks. The ball jumps a fixed height when i place the blocks that the ball should dodge i place them ...
0
votes
0answers
116 views

Testing for connected maze cells

I'm currently in the middle of writing a game where there is a maze. The maze itself is already drawn ok, and once I have the layout I randomly rotate all the pieces. I have a 'start' cell that is a ...
0
votes
2answers
50 views

Calculate line intersecting most points, based on random points in a grid

I have been struggling with a math issue for a game I've been developing. I am in need to find the best starting and ending point for a straight line so that it intersects most of the circles (the ...
0
votes
1answer
46 views

Homing Fireball - Seiken Densetsu 3 style

I'd like to reproduce the fireball spell of Seiken Densetsu 3. The Fireballs don't follow the target directly, but encircle it more or less until they hit the target. I have no idea how to ...
0
votes
1answer
73 views

Best practices for simple physics?

looking for most optimized ways of handling simple physics. By "simple" I mean not more than 1-2 actions per object, and most algorithms are linear. For example, I have an UI element that implements ...
4
votes
2answers
2k views

Pathfinding in non-quantized space?

Pretty much whenever anyone thinks about pathfinding, they think about algorithms like A* and DFS - graph search algorithms, which also just so happen to work as pathfinding algorithms when you ...
2
votes
2answers
240 views

Strategies for using Dijkstra's Algorithm on “larger” (4096+ node) graphs (tower defense)

I am using Dijkstra's for pathfinding in my 2d game, my game is similiar in style to a tower defense game which has waves of monsters trying to reach a goal. I am currently building the paths while ...
0
votes
1answer
83 views

Simultaneous line of sight for hundreds of individual agents on a grid?

I have a large grid with hundreds of individual agents, each of which is moving around based on its own visual inputs and a fast control algorithm. My question is: How can I efficiently provide each ...
4
votes
3answers
617 views

How to make my Diamond-Square-algorithm less 'random'?

I'm currently writing a world generator for a Tilemap-Engine in C++. But there is a little problem concerning the Water to Land ratio. My DiamondSquare-class returns a field of random float-values ...
6
votes
1answer
152 views

render text inside countries

I have a map of the world and I want to place text on top of each country. The text can be anywhere from 0 to 1000 symbols long, and can often be changed. I'm looking for an algorithm to layout text ...
1
vote
0answers
608 views

“Solve” a game algorithmically — creating bots (and making them smart) [closed]

EDIT : at first I gave a lot of context for this question, explaining why I wanted to create a bot. I'm sorry it distracted people from my "actual" question. My question is pretty simple : how does ...
3
votes
1answer
209 views

how to create an outlined polygon with vector3 coordinates?

I have a set of vector3 coordinates and I use them to draw a polygon in another app, my question is: how can I calculate a second set of coordinates to make it look like the line is outlined. in ...
3
votes
2answers
94 views

Make a cell's content 'listens' to another cell (the closest cells)

I'm a newbie in programming and in java and I need some lights and help.I'm developing a game in which two players have to play with tokens (say red and blue) by placing them in cells (75x75 grid). ...
3
votes
1answer
423 views

How do I calculate hex coordinates from a ring and index?

I am trying to implement field of view (FOV) in a hex grid. I am using the cube coordinate system from here. Then, I am using shadow casting to find FOV as from here. I have a system like in the ...
0
votes
2answers
174 views

Best algorithm for different shapes maze

Based off my previous question here Maze or puzzle algorithm for something similar to noodles are there specific algorithms that would be best suited to building a maze with only 1 solution for A ...
1
vote
2answers
280 views

Calculate 8 different directional input based on arrow keys combinations

Considering I have four variables event binded to each arrow key, that can be 0 or ...
1
vote
1answer
1k views

C# Minesweeper - When cells with no mines nearby gets clicked

I'm currently making a Minesweeper in C#. I've already done the basics (generating minefield, rules and ui) but I don't know how I should implement when the user clicks a cell and the cell has no ...
1
vote
1answer
72 views

Word Puzzle: Less or more difficult [closed]

I'm working on an app which is a Word Puzzle. Player has to arrange about 10 words in correct order to solve it. I have two options to build it: Give user feedback (right or wrong) when he has put ...
0
votes
1answer
69 views

Maze algorithm with field counter

I am new to algorithms but currently creating a little game with the need for some. I have a 2d grid/board with a start and a finish field. Between those two fields are several platforms which can be ...
2
votes
2answers
81 views

Picking cells which form a completed line between to 2d grid cells

I'm using Bresenham's line algorithm to calculate a "line" of cells between a start and end point on a 2D tile grid. However, I'm using this during terrain generation to create a visible pathway, ...
4
votes
1answer
643 views

How to generate Bayer matrix of arbitrary size?

In ordered dithering Bayer matrix is used. How is that matrix generated? What algorithm can be used to generate matrix of arbitrary size?
0
votes
1answer
125 views

Better streaming economy algorithm?

Does anyone here have experience making games with streaming economies? I am working on a game and am looking for a better way to handle the economy. I feel like there must be a better algorithm than ...
1
vote
0answers
333 views

Path finding algorithm for (x,y) coordinates in c++ [duplicate]

I am trying to code a path finding function in c++ . It should work like that, you supply the start point (x1,y1) and the end point(x2,y2) and it returns a list of points for the shortest path. ...
7
votes
1answer
4k views

What is the fastest algorithm to check if two cubes intersect (where the cubes are not axis aligned)?

I am looking for an algorithm to check if two cubes intersect. One can check if each of the 6 faces of cube A are intersected by each of 12 edges of cube B, but that is 72 checks. I've heard there is ...
2
votes
1answer
385 views

How does Hierarchical Pathfinding deal with obstructions in the same chunk?

Aigamedev.com provides this visualization of HPA*: All the nodes within the same chunk connect to each other. What if there was an obstruction between nodes in the same chunk? For example: What ...
1
vote
2answers
182 views

Board Game Pathfinding - Finding optimum valid path with limited path distance?

I'm building the very earliest stages of piece movement in a digital board game I'm planning to make. It's a browser based javascript system. Basically the players roll to move and need to traverse ...
11
votes
2answers
625 views

How is structural analysis done in games (e.g.: bridge building, Dig or Die, and 3D)?

From what I understand a typical interactive truss system would need substantial calculations since every component affects the entire system. I think you could arbitrarily stop at a given number of ...