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.

0
votes
2answers
144 views

User Leveling System

I've already asked this before, but I just wanna encode this again with a new leveling format. What I want to do is that, the user will gain exp and once they leveled up, their previous experience ...
0
votes
3answers
107 views

Algorithm for a dense crowd of people who avoid the player?

I want to make a game like this. When player moves other humans will move too. And other humans will push people around. Are there any algorithm for this ? How can i solve this very efficient way ? I ...
1
vote
1answer
88 views

What is a good algorithm for a stock market simulation?

I am making a text game about investing in the stock market, however I need a better algorithm, as the current simulation just goes up and down randomly. How can I make it so that its a more realistic ...
1
vote
1answer
59 views

How to make rhythm game long notes in Unity?

I'm making a rhythm game for a university course and I can't figure out a way to make the long/sustained notes. For reference, this is what I mean taken from Guitar Hero: I already have a system ...
2
votes
0answers
43 views

How to create landscape image from 2D map?

I created a 2D map using Perlin Noise. Based on the value on x,y, I determine an altitude and so a color to apply to my map (8 levels map). Now, I don't want my player to see the map but I would like ...
5
votes
2answers
235 views

Ordered dithering between “discrete” colors?

I want to achieve color dithering between discrete colors like this: As you can see, there is no gradient, or technically there is, but very discrete as it's only a 3 color image (right bar). So I ...
7
votes
1answer
88 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 ...
2
votes
4answers
653 views

How to order points on a 3D grid such that we can connect them in a line loop correctly

I want to recreate an effect as close as possible to X-Com: Enemy Unkown's movement range feedback: (source: gameinformer.com) The blue line delimits the tiles which the soldier can reach using a ...
0
votes
2answers
44 views

Score multiplier based on lowest time

I'm making a score system that will be based on several factors, how many collectibles you have obtained, how few hits you have taken, etc. I want to add in a multiplier based on how quickly the ...
3
votes
1answer
1k views

Merging box colliders for optimization

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

Trying to understand the range of Improved Perlin noise

I've been implementing Improved Perlin Noise for a small library I'm writing. Everything was hunky dory when it was just in the 3rd dimension, but I recently expanded to the 1st, 2nd, and 4th ...
3
votes
3answers
103 views

How to make obstacles spawn randomly but still leave a way for player to pass?

I'm trying to make a game like Crossy Road: In this game, you control the character(the frog in this case) to go across the streets, and you have to prevent your character from being hit by a car. ...
1
vote
1answer
565 views

Recursive backtracking sometimes missing a tile?

I have a basic recursive backtracking algorithm for a maze. It pretty much works but occasionally leaves some tiles in the corners untouched. This is the recursive function: ...
0
votes
1answer
40 views

Algorithm for finding edge vertex points on a tilemap

I have a 2d tilemap array contains 1 or 0. 0 corresponds empty tile, 1 corresponds solid tile. If tile is 1 I draw a texture. I have to find edge vertices and coordinates that 1's grouped. I couldn'...
0
votes
0answers
45 views

Keeping track of moving sprites in 2D grid

I'm working on a 2D tower defence game in C++. The game world consists of a grid of Cells, that are managed by a Map: ...
0
votes
1answer
105 views

Acceleration in Unity

I am trying to emulate acceleration and deceleration in Unity. I have written to code to generate a track in Unity and place an object at a specific location on the track based on time. The result ...
0
votes
1answer
46 views

Dealing with curved lines in GJK

I'm currently using a GJK implementation (supported by EPA for penetration) and I'm trying to optimise the calculation times of distance calculations. One of the biggest hits is trying to solve for ...
4
votes
3answers
254 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. I ...
1
vote
1answer
55 views

How can I divide a grid map into clusters for path finding algorithm?

I am trying to implement HPA algorithm for finding the shortest path between two point. I came across the paper Near Optimal Path Finding Algorithm (by Botea, Müller & Schaeffer) but I am stuck at ...
2
votes
1answer
565 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, ...
0
votes
1answer
35 views

Efficient algorithm for simultaneously updating game objects which need to be updated

I have a grid of objects like this: 1 + F 1 is equal to the constant 1, ...
0
votes
1answer
118 views

Unity3D: activeSelf issues

I've been trying to script some basic AI for a Unity Roll-A-Ball game, which involves two balls collecting cubes for points (one controlled by the player and the other controlled by AI. Everything ...
0
votes
0answers
57 views

Algorithm for Circle with fixed radius to cover most points

I'm in need of an algorithm to find the best spot for a circle with a fixed radius r to cover as many points as possible on a 2D grid, preferably O(n). Currently I tried 2 different approaches: The ...
0
votes
0answers
22 views

Implement an “xprevious” in LibGDX

I have used Gamemaker Studio 2 before, briefly, and found that the xprevious and yprevious variables are extremely useful. ...
0
votes
0answers
12 views

Tron type game AI algorithm [duplicate]

Im looking for a tron AI algorithm on snap!/scratch. If not can you help me develop an AI for this game?
19
votes
5answers
10k views

Calculate random points (pixel) within a circle (image)

I have an image that contains a circles at a specific location, and of a specific diameter. What I need to do is to be able to calculate random points within the circle, and then manipulate the pixels ...
1
vote
1answer
34 views

Find friend groups in a virtual social graph

In my game, "people" form bonds through common interests. A person may have 1 or more interests, and a certain weight (0f - 1f) attached to it. Every now again, when 2 people are close to one ...
1
vote
1answer
58 views

Algorithms for Automated Game Levels Creation ( 2D )?

I am trying to algorithmically create a game like the one in the picture below I am trying to Create random levels from an algorithm. Ideally, the algorithm will take into account the desired ...
24
votes
2answers
8k views

How can I generate a lightning bolt effect?

Is there an algorithm to generate a lightning bolt? I would like an algorithm that generates a list of segment or point objects specifying where the bolt will land. The method would need a start ...
0
votes
0answers
28 views

Unity Waypoint system

I am trying to code a way to choose between multiple paths using the waypoint system. I tried it with if statements but it was just very inefficient. Can anyone suggest me some ways to get this done? ...
1
vote
1answer
65 views

Finding islands from array

Say I have an two dimensional array with values 0 or 1. How would I construct an algorithm (preferably in C#) to work out which ones are separated or islands. The algorithm would transform the left 2d ...
2
votes
2answers
181 views

Most efficient way to get the closest point to a 3d rectangle

I have a 3D rectangle, with 4 points (x,y,z) And I have a player, who can be anywere (inside the rectangle, outside, not even in the plane, in the corner...). I would like to get the closest point in ...
0
votes
1answer
72 views

Instantiate prefabs at particular vectors using text file (Unity3D game)

I need to read a text file containing two pieces of information on each line, and use that information to instantiate a prefab at the correct location in a Unity3D game (c# script). The locations are ...
0
votes
1answer
84 views

Bulk level when user gets bulk exp

I've been working with this for the entire week now, this is about a leveling system of my application. When a user gets the enough exp needed, it gets leveled up, everything works fine. But, when a ...
1
vote
2answers
71 views

Binary space partitioning with floor as an object

I have a conceptual problem. The problems comes with the floor I'm rendering and the count of objects. The idea was to reduce rendering with BSP implementation, but the problem that I hit was that the ...
0
votes
0answers
34 views

Chess AI Finding Checkmate Using MinMax

I have implemented a chess AI using a Mini-Max(With a partially working AB pruning) implementation. At the moment, it can search a depth of 5 and it is capable of playing a good middle-game. It pretty ...
1
vote
1answer
98 views

A* heuristic for use with Goal Oriented Action Planner

Many of the high-level descriptions I've found for GOAP and similar planners suggest using A* for their path-finding, but I'm struggling to implement it for my own planner. Specifically, I'm ...
1
vote
2answers
55 views

Timed Line Drawing

I'm trying to program a remake of the classic Missile Command Atari game from scratch, but I've run into a problem. So I have a function that can draw a line from one point to another. I figured I ...
3
votes
1answer
1k views

How can I tell if an object in a tile grid is surrounded?

I'm making a game which uses a 10x20 matrix to store the position of the objects. I have a castle object, represented by a number in a matrix. It is randomly deployed in some cell of the matrix. I ...
0
votes
1answer
86 views

A* Quad/Oc Tree path-finding vs Navigation Mesh path-finding

Main What are the differences between those path-finding algorithms. Is Navigation Mesh faster in finding the path? Is it more correct than Quad/Oc Tree? Does Navigation Mesh use Quad/Oc tree under ...
0
votes
1answer
72 views

Get a Jump normal gravity based on Attractor Points, lines or Quad placed in the Level Design (in a Mario galaxy like gravity)

I have an algorithme to find. I have a player in a 3D space on a random planet. My goal is to have an oriented gravity toward my planet. And when I jump: Find the right normal direction. BUT I can't ...
24
votes
11answers
3k views

What are your favourite game-specific coding gems? [closed]

I'll start off with John Carmack's the Fast Inverse Square Root in Quake III: ...
1
vote
1answer
154 views

Diamond Square Algorithm - How to fix horrible diamond shaped artefacts and spikes?

I was attempting to follow this article explaining the implementation of a wrapping version of the diamond square algorithm. I tried running it with dimensions of 128x128 and a "feature size" of 16, ...
1
vote
1answer
65 views

Composing Game Metrics

So I'm running into a bit of a roadblock with the way I'm currently keeping track of game metrics. By "metrics", I mean little bits of information that I can compose together to get useful information ...
0
votes
0answers
31 views

Detect how many blocks can be moved given a grid of blocks

Let G be a grid of booleans where true means a block is there and false means there isn't a block there. Let P be the player, ...
67
votes
7answers
14k views

How does A* pathfinding work?

I would like to understand on a fundamental level the way in which A* pathfinding works. Any code or psuedo-code implementations as well as visualizations would be helpful.
0
votes
0answers
37 views

Unity — Proper algorithm for a Character Controller that automatically fits mesh?

I'm trying to make an algorithm that will automatically generate a CharacterController component (on a parent-GameObject) which should automatically resize to whatever the current mesh size is. To ...
4
votes
2answers
2k views

What algorithm to use to fill a KenKen square board with cages?

I am working on recreating KenKen, a popular math puzzle involving a blank grid that is divided into "cages". Each cage is just a collection of adjacent squares and has a clue which is generally a ...
20
votes
4answers
20k views

Calculating minimum velocity of the projectile 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?
0
votes
1answer
45 views

Steering constantly turning in circles

I've been working on a fish system in a compute shader but bugs have been drowning me. The latest bug had me strip almost all the functionality to track down: Fish keep turning in circles. It starts ...