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.

Filter by
Sorted by
Tagged with
0
votes
1answer
38 views

How to calculate the transformation such that two points with different position, orientation and origins line up?

Let's say you have two different 3D Objects which both contain a node that is off center (not at the origin) and have an orientation. How do you calculate the transform for one of the object so that ...
0
votes
0answers
59 views

Technique for Edge Detection Between Distinct Entities

I'm developing an application that renders large(-ish) scale graphs (i.e. nodes and edges) in 3D. We've recently been asked to add a flat shading mode, where the graph elements are displayed using a ...
0
votes
3answers
62 views

Finding an angle between two bodies

I am trying to find angle between vectors a and b. But the cosine for some reason is not within +/- 1, that means that it is not possible to find an angle between a car and a pedestrian... Any help ...
2
votes
1answer
110 views

How to calculate a perfect Super Mario speedrun?

I've dedicated my time to Super Mario lately, so eventually I ended up watching some speedruns. I thought to myself, how could one calculate the perfect set of minimal in-game movement? I considered ...
0
votes
0answers
41 views

How can I move balls along a rail?

I want to implement ball movement similar to that in the Puzz Loop 2 game. The goal consists of clearing all the balls moving on a rail, with the trailing one pushing all the others. You can watch a ...
0
votes
0answers
23 views

D* lite optimized: what is wrong in my implementation of Search() function?

I'm trying to implement the D*-Lite pathfinding algorithm, as described in the 2002 article by Koenig and Likhachev for grid-based navgraph. But I stuck with problem. My ComputeShortestPath (in my ...
1
vote
2answers
122 views

How can I make my race game fair with all players and keep it climatic?

I'm making a minigame where up to 5 players have to race against AI or another player(the "enemy"). The race consists of prompts, the current player is asked to press a key in a given amount of time ...
0
votes
0answers
91 views

How can I get a straight path using A*?

How to change A* work so that the path is more like a straight Euclidean distance? I read that you need to break some nodes, but how to implement this? I need heuristic like this: Is such a ...
1
vote
1answer
44 views

Codify user progress [duplicate]

I want to generate a string-code for the user that represents his progress in the game (so he can load this state somewhere else). I don't want him to be able to guess the system and thus load a state ...
4
votes
2answers
202 views

Make character following another

What's a solid way to have a character stuck to another one? I have a moving character (say followed) and I want a second one (say follower) to follow the first without chance of getting stuck into ...
0
votes
0answers
51 views

Modifying A* pathfinding based on size of moving object [duplicate]

I've implemented basic A* pathfinding in my top-down 2D game, and I'm almost ready to test it, but I thought of something while adding the movement code to my enemies that I think could affect the ...
0
votes
1answer
73 views

Update vs events

i would like your opinion on two different coding styles to solve the same problem, namely, react to user input actions. To do this, two solutions. Subscribe to events (usually "when"). Real time ...
0
votes
0answers
22 views

Bitboard rectangle detection

For a puzzle game with n columns and m rows, I store each piece on the board using a 64-bit bitboard. Every piece has ...
0
votes
0answers
22 views

Need help to find a way to make a image mapping

I need some help to find a way of creating a simple game in any language/software/technology. What I have to do is to map a png image in order to create a correct "path" for a player so he can make ...
4
votes
1answer
352 views

How to create characters randomly with a given skill and weighted abilites

I am trying to create random characters in my game. Each character has 33 abilities and one of 6 jobs. For each job you need to skill/increase other abilities. I am calculating an overall skill (...
0
votes
1answer
19 views

Updating connected states in a “build the pipeline” puzzle game

I'm trying to make the pulse system in a "build the pipeline" puzzle game to check if tiles are connected to the starting tile. There is a weird bug that prevents tiles on the right and tiles on the ...
0
votes
0answers
27 views

How to generate point based on a map

I am making a multiplayer game in Unity, with a socket.io server in NodeJS. I am using a globe, with a texture to represent the world in Unity. Let's say something similar do this. Now, there I am ...
2
votes
1answer
84 views

Modeling complex requirements for populating loot/drop tables

I have a set of items and a data structure that describes where and how those items may be dropped. I'm looking to implement a roguelike/randomizer element to the game and want to include the special ...
0
votes
0answers
27 views

How could I calculate the distance between the parent and neighbors node when there is a line of sight between two points?

I have completed my Astar algorithm in Python and now I need to convert it to a Theta star algorithm, I have built my line of sight algorithm below, but when I come to my Theta star algorithm I face ...
21
votes
3answers
7k views

Efficiently pathfinding many flocking enemies around obstacles

I'm working on trying to improve the pathfinding for my game's enemies. Right now, they basically just constantly move towards the player's exact position by calculating the angle between themselves ...
0
votes
2answers
68 views

How to find all possible destinations, within a certain walking distance of a unit?

I have a standard 2D grid that i use for pathfinding. I already use A* to find the path of my units when I want to move them around. What I need to implement now is a preview of all possible ...
0
votes
0answers
122 views

Theta Star algorithm with line of sight

I have finished my A star algorithm and I need to add the work of Theta star to it, but I need to call the line of sight algorithm. I'm working on path planning for a UAV and I have created a grid in ...
4
votes
1answer
247 views

Making a wrapping wire (like the Worms Ninja Rope) work correctly with moving geometry

I have implemented a 2D wire like the one described in this question which is made up of straight line segments between wrapping points. However, while the algorithms described in this answer work ...
0
votes
0answers
14 views

How to make scrollRect content bounce back if scroll threshold is not reached?

I have a scrollRect setup with two image(placed side by side) contents and everything works fine. But I don't want the user to be able to leave the contents scrolled halfway. What do I do to ensure ...
1
vote
2answers
138 views

How do I launch a ballistic projectile to hit a moving target, given: launch position & angle, target position & velocity?

This problem is in 3D space. My question is: How do you find the initial velocity of a projectile that flies under constant gravity, so that it hits a target moving with constant velocity, given the ...
0
votes
2answers
77 views

Detect walls in geometry

Is it possible to automatically detect walls in polygon soup? Of course it's hard to strictly define what a wall is, my slightly vague definition would be: A wall is a largest possible box (not ...
-1
votes
2answers
75 views

Problem making wave animation

I want to simple wave-like animation using mesh. I thought that it would look like a wave if there would be a point at the middle of the mesh and change z axis of that point, and after this I change ...
1
vote
2answers
99 views

How can I make a computer opponent for my board game?

I am trying to create a game, not exactly checkers, but the level of its interactivity is on par with checkers as opposed to something more complex (I think) like chess. Anyway, according to my ...
1
vote
3answers
190 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
244 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 ...
3
votes
0answers
51 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 ...
0
votes
2answers
166 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
0answers
32 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 ...
0
votes
0answers
65 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: ...
1
vote
1answer
188 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 ...
0
votes
1answer
58 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'...
3
votes
3answers
148 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. ...
0
votes
1answer
45 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, ...
1
vote
1answer
96 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 ...
0
votes
0answers
79 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
26 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
17 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?
1
vote
1answer
41 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
61 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 ...
0
votes
1answer
57 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 ...
0
votes
0answers
43 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
130 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
447 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
87 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
85 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 ...