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,167 questions
0
votes
1
answer
58
views
Is an assumption of Welzl’s algorithm valid?
The stated assertion that a point outside some intermediate Minimum Enclosing Sphere is on the boundary of the final Minimum Enclosing Sphere seems unsupportable. It is true only for the first point ...
4
votes
1
answer
241
views
Train simulator - approach to cars movement
I'm prototyping a train simulator and running into design issues with physics and train car movement. The scope is similar to games like Run8, SimRail, or Derail Valley.
Requirements:
Realistic train ...
0
votes
1
answer
217
views
Coding a customizable JRPG random action system in Godot 4? [duplicate]
I'm making an open source turn based JRPG in Godot 4.3, I want any programmer to be able to very easily create new enemies with different behaviors by simply customizing export variables in the editor,...
0
votes
0
answers
121
views
Strategies for making NPCs respond to player queries based on the NPC's knowledge or activity
I'm developing a finite state machine AI where some interaction with the NPC can be made through a popup window with some choices. The image below shows how it looks:
The player (on the right in this ...
2
votes
2
answers
255
views
Is using values from a cryptographic hash function for Perlin/Simplex noise innapropriate?
The permutation maps are usually the numbers from 0 to 255 arranged in a random order. If I were to use a cryptographic hash function to convert a string, and then use the result's individual integers ...
2
votes
2
answers
126
views
Improving local collision avoidance to navigate around large obstacles
For my collision system I’m using a boids-like method that works fine for "small" obstacles (like other characters) where the character can turn slightly left or right to avoid the obstacle ...
2
votes
2
answers
401
views
How would you intentionally create overlapping rooms with procedural generation?
It seems like every procedural dungeon generation tutorial focuses on how to avoid overlapping rooms, so how would one go about intentionally overlapping those rooms instead, possibly treating the ...
0
votes
0
answers
87
views
How can the A* algorithm revisit the same node twice in multi-agent pathfinding(MAPF)?
I am attempting to solve a MAPF-like problem using the Conflict-Based Search (CBS) algorithm. My specific problem is based on a grid graph where some edges are not connected.
For example, in the ...
1
vote
2
answers
370
views
A*, what to do about duplicate items in the min-heap, if anything?
I'm trying to implement A*.
I'm storing the queue of nodes to visit in a min-heap, and I'm seeing the same node being added more than once to it (with different priority). Wikipedia's pseudocode ...
7
votes
2
answers
10k
views
How to calculate player damage in a game
I'm developing an RPG and I want to do the damage calculation in my game.
I have for example the following situation:
Player 1 Stats:
...
82
votes
5
answers
38k
views
Procedural... house with rooms generator
I've been looking at some algorithms and articles about procedurally generating a dungeon. The problem is, I'm trying to generate a house with rooms, and they don't seem to fit my requirements.
For ...
10
votes
3
answers
3k
views
Maintaining unit formation while following path
I'm currently working on a 2D Age of Empires style RTS game.
Here's my problem:
I'm currently using the A* algorithm (via Path finding package) to move my units.
When you select a "group" of ...
1
vote
1
answer
169
views
How to properly split damage against armor?
I am developing a third-person shooting style game and I want to implement an armor system. The system that I have envisioned does not reduce the damage to 0, but by half. So the incoming damage is ...
1
vote
0
answers
215
views
Dynamically generating the layout of a skill tree
How would I go about automatically generating the layout of a skill tree?
Skill tree nodes have at least one parent, but they can have more. Ideally I'd have a root node that recursively creates its ...
4
votes
1
answer
594
views
Find a encircliement in Hexagonal grid (optimization issue)
I have a hex grid of 10000 cells (100x100). The player can grab a cell next to one of his cells (borders). If the player has formed a ring after placing a cell, I want to get a list of cells that ...
2
votes
0
answers
675
views
How can I add fake erosion in my infinite terrain generation?
I'm making a game where the terrain is infinite and procedurally generated. I'm using Perlin noise with octaves to make the terrain shape. I would like to implement some sort of erosion to make the ...
23
votes
3
answers
10k
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
2
answers
641
views
How to get area of 2D shape bounded by vertical and horizontal line segments?
I am making a game similar to Volfied using Unity:
The player outlines an area using straight lines, either horizontal or vertical.
I am stuck at the algorithm to decompose the area into rectangles ...
0
votes
1
answer
2k
views
In Unity, how can I render borders of provinces from a colored province map in a grand strategy game?
I am kind of a beginner of Unity and I am trying do work on a grand strategy game. I already have a province map, colored by unique rgba for each province, looks like something below:
I know that the ...
0
votes
1
answer
103
views
I'm trying to find a way to iterate through a list of game objects to find furthest object in the list. Then re iterate if path is blocked
I've got the first part of the code working. It iterates and does a check through the gameobjects to find the furthest nav point to hit. Then it calculates path to see if its valid or not. Now I'm ...
0
votes
0
answers
151
views
How to turn adjacent squares on a grid into larger rectangles? [duplicate]
I want to know what's the best way to combine individual squares on a grid (tilemap) into larger rectangles. I need this to simplify my physics collision detection/resolution, so that collision doesn'...
0
votes
1
answer
110
views
Getting the scalar speed from an X and Y velocity [duplicate]
Given a Vector2(x,y) that represents an object's velocity, like so:
...
1
vote
1
answer
613
views
Find possible paths in a grid
I want to make a simple maze with colour-coded cells:
white denotes a blank space,
black denotes a wall,
green denotes source and
red denotes destination.
So, my idea was to write an array of ...
52
votes
11
answers
59k
views
What path finding algorithms are there? [closed]
I'd like to read up on path finding algorithms. Is there a primer available or any material or tutorials on the Internet that would be a good start for me?
3
votes
1
answer
3k
views
How can I morph between images in real time?
So, I need to be able to make a picture slowly transition into another picture, not as a transparency fade, but as a morph.
And I need that in real time.
More on "morphs":
When you outline ...