Stack Exchange Network

Stack Exchange network consists of 174 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
2answers
170 views

How do people implement pathfinding movement?

I understand how A* works, but I don't understand how movement is implemented, e.g. creating a list of directions and then going through that list until every direction is empty. How does that work? ...
1
vote
0answers
26 views

Algorithm for clipping convex quadrilaterals

I'm dealing with hardware that uses quads as its polygonal primitive. Not triangles. A triangle can be expressed by setting 2 of the 4 equal to each other for a degenerate quad. For the 3D engine, I'...
4
votes
3answers
901 views

Ray tracing and Z buffering in graphics

I am a high school student taking computer science as a subject, and someone who is very interested in the game development industry. I am currently writing an essay on Raytracing and Z-buffering by ...
0
votes
1answer
74 views

What is the simplest way to calculate energy earned based on time?

A player has 0 energy, and gains 5 every 15 minutes, but has a maximum of 100 energy. How would I be able to both store this in a database, and then recall the data later, to figure out how much ...
2
votes
1answer
800 views

merging box colliders for optimizing

Look at the picture. The figure on the left shows the individual box collders in green. The yellow boxes on the right are the results of the optimization of the original box colliders. What is the ...
6
votes
2answers
198 views

Limiting number of user clicks to reduce micro: best method of implementation?

I'm making a client-server game where the user can select armies and move them from one place to another. In a bid to reduce the advantage of "being able to click faster" I've decided to implement ...
1
vote
0answers
29 views

Creating Smooth Corners when Converting 2D Polylines to 3D Models

Part of my game takes SVG polylines (which are just basically a set of x,y coordinates that define a multi-segment line) and converts them into 3D 'paths' (ie. a line created as a set of faces all ...
2
votes
2answers
230 views

Using a vector to measure an angle relative to the screen / camera

My game is supposed to have an object that changes it sprite depending on which way the mouse faces. programming this has become a challenge, because I want to calculate the angle relative to the ...
8
votes
3answers
2k views

How to optimize pathfinding on a very large dynamic 2d grid?

I have a large 2d tilemap, ranging anywhere from hundreds to thousands in size. The map is formed by 8x8 chunks. I am currently using A* but it isn't quite efficient because I may have as many as a ...
2
votes
1answer
539 views

How does D* pathfinding work?

I would like to understand on a fundamental level the way in which D* pathfinding works. Any code or psuedo-code implementations as well as visualizations would be helpful.
2
votes
1answer
248 views

Is this a suitable “pathfinding” algorithm for a tower defense game?

Note: I put "pathfinding" in quotes because I'm not sure if it's the proper term for this. My goal is to create a 2D tower defense game with HTML5/JavaScript. It's mostly for learning purposes, so I'...
3
votes
2answers
159 views

What algorithm can I use to distribute energy between connected nodes?

I'm creating a game where every user has a network of connected nodes that each have a specific amount of energy. The nodes will try to distribute energy evenly amongst themselves. If a node has more ...
5
votes
2answers
1k views

How can I fill the interior of a closed loop on a tile map?

In my game the player can dynamically modify terrain. The map is stored within a 2D array of prefabricated 3D objects. This is working well for now. The player modifies terrain by selecting what ...
7
votes
0answers
69 views

Is there an algorithm to move vertices along a planar mesh to give an area more vertex without destroying the shape too much?

Currently, I am playing around with a terrain technique called Vector-Field terrain as created and used for the game Halo Wars. I have successfully recreated the technique. However, I'm having ...
1
vote
2answers
64 views

Find points inside a closed area

I have a 2D rectangular grid (100x100) with 3 types of cell (Empty, Base and Outline). I need to find cells inside the territory formed by Base and Outline cells. For example, in this scheme: I need ...
2
votes
1answer
72 views

Numerical differentiation to calculate size of circular buffer

I'm using Allegro 5 to create a software-generated "motion blur" effect for my 2D sprites. I basically just have a boost::circular_buffer of some length which holds "snapshots" of the sprite going ...
0
votes
0answers
144 views

Smart algorithm to find clusters in matrix of numbers

I´m developing in C, a solver for puzzles like this game Bubble Popper (https://play.google.com/store/apps/details?id=com.bytesequencing.bubble_popper_ads). Fast explanation: we have to find clusters ...
4
votes
1answer
529 views

How to convert a premade mesh into voxels so I can use algorithms such as marching cubes

I have a mesh that was created in a 3D program which is the terrain the player will walk on. I want to allow the terrain to be deformable by the player, but for it to be smooth (not like Minecraft). ...
1
vote
1answer
178 views

How to calculate a projection of 360° equirectangular slides?

My goal is to have a light source inside of a transparent sphere that has an equirectangular texture to act as a 360°-slide. I want to get the projection on arbitrary objects as a texture image on ...
1
vote
0answers
184 views

Letting an Pathfinding Algorithm generate movement paths for all possible Connections in a Starsystem-based Universe

First of all I want you to forgive me when I make mistakes in my writing, english isn't my first language, and also: If this is the wrong place to ask, please direct me to the right place then. So, ...
5
votes
1answer
494 views

Train-like movement in a 2D game

I am developing a 2D game using Cocos2d-X in C++ language. In my game, I need to implement train movement. Here is the image about the output I want to achieve: I tried to do the above moment using ...
4
votes
3answers
2k views

How do modern game engines handle many shadow casting lights?

This is a very general question, and not aimed at any particular language or graphics API; I am more interested in the theories & algorithms behind the solutions. I'm reasonably familiar with the ...
1
vote
0answers
68 views

Generating vertices for group of hexagons

I'm working on the map editor of a game, where you can create a grid of hexagons to paint. An example of a grid of radius 6: What I want Once map creation is done, I would like to generate a mesh ...
3
votes
1answer
348 views

Creating a Simple Puzzle resolution Algorithm

I develop a (really) simple puzzle game that asks you to join a point A to a B (enter/exit) using a ball and mechanisms that you can rotate to give the correct direction to the ball in order to join ...
3
votes
2answers
2k views

How does transvoxel algorithm work and how can I implement It?

After wasting over three days of researching on DuckDuckGo/Google, trying to understand transvoxel paper and existing implementation, I come here to clarify the subject for me and made it easier for ...
3
votes
3answers
264 views

Drawing roads on heightmaps

I've been running into walls for the past week or so on my toy project in UE4. My goal is to draw procedural roads on a procedural landscape (eventually getting to intersections and buildings). The ...
0
votes
0answers
36 views

Drawing a possible movement area in a tiled map [duplicate]

I've been developing what's meant to be my first of many Game Maker projects, and here's my biggest problem until now: I'm trying to draw a grid depending on the "move" variable from a unit (the ...
4
votes
1answer
137 views

Convert 2d generated level to graph or analyze

Do you have any idea how to extract graph data from this type of procedurally generated level? Well, actually we need to analyze only top level (gray). Background (black) does not matter. What I am ...
0
votes
1answer
140 views

A* Implementation broken?

I tried implementing Wikipedia's version of the A* pathfinding algorithm, but when I run it in Unity the object which the script is applied to does nothing and Unity ends up taking 15% of my CPU. I ...
1
vote
1answer
104 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 ...
3
votes
1answer
189 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
233 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
303 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
562 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
725 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
165 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
0answers
662 views

Unity quick walk detection

I am making a google cardboard game and want the player in the game to move whenever the person walks. Person can be actually walking or just in place walk, we'll move the player. So I need to detect ...
0
votes
1answer
354 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 ...
0
votes
0answers
582 views

Zebra puzzle generator algorithm

I made an open source zebra puzzle generator, also known as an Einstein puzzle. When I generate a table, I have to obfuscate (make obscure) it, and make some letters hidden with the good indication ...
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
165 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
65 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
77 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
51 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 ...
3
votes
2answers
254 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 ...
0
votes
0answers
38 views

How to compute forces on objects

Say I have N bodies that moves and potentially collide. I can then compute the net force as ...
2
votes
0answers
55 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 ...
4
votes
2answers
414 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 ...
-2
votes
1answer
90 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 ...
4
votes
2answers
248 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.