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
0
answers
76
views
How to optimally transfer between nodes when each connection can only handle a certain number of things at a time?
Let's begin with a picture:
I am currently making a turn-based strategy game set in space where you can settle colonies and have to transfer minerals from the colonies ("foo", "bar&...
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,...
3
votes
2
answers
188
views
How to make a digger-like procedurally generated maze that can be queried at coordinates without having to generate?
I would like to procedurally-generate ant farm-style layouts on a grid: long horizontal spaces connected by short vertical spaces. Also similar to cave systems formed by water erosion.
Every tile in ...
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 ...
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 ...
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 ...
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 ...
0
votes
0
answers
104
views
How to efficiently hash canonized structs
Say I have a canonized struct:
{
health: 100,
items: ["apple", "knife"],
name: "Bobby"
}
"Canonized" here means ...
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
110
views
Find the best attack position
I'm doing what this thread is doing except that it's not very satisfactory. What this does is finding the "closest" attacking position. But typically you want the attacker to attack from as ...
0
votes
2
answers
228
views
How to compute XP thresholds when scaling changes for each level range?
I am developing mobile game and I am stuck on an issue regarding proper player stats scaling based on level.
As a parameters for the computation we have:
base XP value
multiple increment values (for ...
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
0
answers
54
views
How to quickly traverse bi-directional nodes without repetition?
I want to optimize a bidirectional node traversal algorithm.
Because the node is bidirectional, it may cause an infinite loop. The current algorithm uses memory records.
However, memory writing will ...
2
votes
0
answers
87
views
Generate coastal line from water tiles
I have a 2D tiles map. Some tiles are water (black tiles on image). I can compute which tiles are coastal when it's 4 neighbors are not water (black dots on image).
I would like to compute coastal ...
1
vote
1
answer
245
views
Getting coordinates within a bezier space
I have created an object that is comprised of two bezier curves (constructed of an identical finite segments equal to a variable named resolution). The two curves ...
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 ...
1
vote
2
answers
344
views
Why is my negamax algorithm returning negative infinity scores?
I'm currently in the process of writing my own chess engine in java and am having a little trouble with negamax. I've opted for negamax since its easier on the eyes and reduces the number of lines of ...
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 ...
0
votes
1
answer
57
views
Make linear parameter change seem chaotic
I'm trying to solve a challenge with linearity of my animation. Let say we have a Tug of war mechanic. One team is much stronger and it moves line from point A(0) to point B(10) with a speed of 1 unit ...
0
votes
1
answer
298
views
Implementing a bot to find the player in a grid
I have a 2d array with ground represented by 0s and the walls represented by 1s.
Player can use a LOOK command or a MOVE command. Look command returns a 5x5 array centered around the player and the ...
1
vote
1
answer
151
views
Randomly distribute damage among allies
Let's say I have regiments of varying sizes, 500, 1000, 4000 troops.
I want to distribute 1000 troops worth of losses to them so that in aggregate they lose 1000 troops. I want to do it as a ...
0
votes
0
answers
62
views
Wheel position on surface
I have a bicycle with suspension and need to find the contact point of the wheel on the "road". If the front fork was pointing straight down, it would be as easy as doing a raycast down the ...
1
vote
0
answers
50
views
How to limit the character movements to a delimited area
Consider the below images get from the Final Fantasy VII and Alone In The Dark games:
I assume that the above scenes are composed by a set of layers composing the background image (allowing thus the ...