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
0answers
27 views

How to fill with empty space with retangles

I have a 'square' class with the representation of its limits from the variables x1, y1 and x2, y1 these variables define points 1 and 3 of the same, in this case the coordinates would be (0,0), (10, -...
0
votes
0answers
73 views

Java Game: Using minimax or similar algorithm for AI battles

Game Info: Type: grid based ship game; where ships are one-directional (meaning they can only use the allowed moves in the direction it is facing) Allowed Directions: NORTH,SOUTH,WEST,EAST Allowed ...
1
vote
1answer
39 views

Determining first voxel ray intersects

I'm trying to implement the Fast Voxel Traversal Algorithm on a uniform grid of axis-aligned rectangles. Having read the paper, I understand how the traversing works, but not the initialization. I've ...
0
votes
0answers
31 views

Seamless tiling?

I'm creating a simple grass/dirt tileset. I'm able to create a seamless tileset by creating 1 unique piece per "direction"... however, this breaks down when trying to create more than one ...
4
votes
3answers
87 views

Calculate min number of moves (no path involved)

I'm looking to implement an algorithm that will calculate the minimum number of moves based on the rules below. Let's say that we have a grid (NxM), as exampled in the image below. Each cell will be ...
2
votes
1answer
64 views

Supercover line algorithm from corners instead of the square's center?

I need to check whether a cell in a 2D grid is visible to the starting cell. I'm currently using amit's supercover line algorithm, this one https://www.redblobgames.com/grids/line-drawing.html#...
0
votes
1answer
39 views

How to generate fixed amount of health points in every interval when the data is in database?

Most of the common example of that in the game is stamina regeneration to control the activity of the players. For example, genshin impact, they have something called resin system, and it regenerates ...
1
vote
1answer
59 views

Given a 2D array, how do I generate a random path of fixed length from a random point at length 0 to a random point at max length?

I'm trying to generate a random path on a 2D grid given that: The width and height of the grid are given The length of the path to generate is given The path can't move "back" The path ...
0
votes
0answers
36 views

Qix diagonally adjacent movement

I'm implementing a Qix clone game and I do not have any problems with implementation but rather with possible scenario. Is this a valid scenario for this game and if yes how exactly should gameplay go ...
1
vote
1answer
96 views

How do I procedurally generate rivers on a tilemap with thickness?

I have read numerous articles on the subject but can find none that can explain to me how it is that procedural river generation achieves a certain amount of thickness to the river. I have managed to ...
0
votes
0answers
19 views

Triangle area selection using BVH raycasting

Let's assume I'm already storing a BVH acceleration structure per mesh on my engine and I'd like start making area selection like on many DCC tools out there, for instance, blender. With blender you ...
1
vote
2answers
57 views

fastest way to check for surrounding tiles

I'm working on a tile map where each type of tiles has 12 states with 12 different sprites associated with it, what I'm trying to say is that whenever I place a tile let's say a road tile, that tile ...
1
vote
2answers
57 views

How do I calculate/weight a diminishing damage formula based on N targets?

I'm making a game and had a look at the questions about calculating damage/diminishing returns here and here but I haven't quite been able to come up with a logarithmic function that satisfies this ...
0
votes
0answers
33 views

“Blind” PathFinding for fleeing agent

I know there are plenty of algorithms for finding a path from A to B. There's also a good few articles on how to avoid an enemy in a 2D space. I can't find anything on escaping from an enemy in a ...
0
votes
0answers
47 views

how to order entities by their distance from 0 on the x axis

I'm creating an infinite runner game in which you control several characters at once. Right now when you press the spacebar, they all jump at once but, I want them to jump at separately, one after ...
0
votes
1answer
67 views

Looking for a market price algorithm for a turn based game [duplicate]

I am new at game development and am now facing the problem for a market price algorithm in a turn based game. What I try to achieve: the market starts with fixed bidding and asking prices for one ...
0
votes
3answers
95 views

How to calculate best move in Match-3 game?

I am having a hard time identifying how to approach this problem. If you have a match 3 game and the objects can only be swapped horizontally and vertically, and only swapped if it will result in a ...
0
votes
1answer
168 views

How to make good combinations of xp tables and xp rewards?

Is there a known step by step (automatable) to define mean xp reward formula/table to bases specific challenges rewards (generically, not only defeating enemies) and total xp table that set character ...
1
vote
1answer
77 views

How can players randomly - and secretly - choose 5 cards out of 25 that match a specific condition

So this is a less a coding question and more a 'there's gotta be a way'... I have a Clue-like logic/deduction board game that has 25 cards - 5 of each color and 5 of each taste. Each card is unique, ...
0
votes
1answer
46 views

How to make score points based on time

So the idea is simple. a) Players why finish the level faster, should get higher score. b) The levels (1 to N) where every next becomes more difficult should impact the score. So it's kind of mix of &...
3
votes
1answer
58 views

How can I detect enclosed areas in an arbitrary set of overlapping lines

I have game where there can be arbitrary lines, these lines can overlap. I want to find out first if there are any enclosed shapes created by overlapping lines, and then I want to fill the enclosed ...
2
votes
1answer
226 views

Fully destructibility in 2D

I would like to create a small game about battles in the Middle Ages. Imagine a procedurally generated 2d map with rivers, fields, and a small castle. Two sides. One player will attack the castle, and ...
1
vote
1answer
119 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 ...
0
votes
1answer
86 views

Getting points inside a circle with a given radius in a 2D array?

Let's say you have a system that removes everything within a square made up of 4 position points. This square is calculated by taking the center point and adding or subtracting the range from this ...
0
votes
0answers
23 views

Algorithm for simulating collision between circles of different mass

First of all, I'm not sure if this is the right site for this question, as it's actually a game I'm developing. However, I thought that this would be a common thing to need to know in games, so I put ...
4
votes
1answer
178 views

How to make Minesweeper always reveal a large area on first click?

I'm making a Minesweeper app. I read that if you click mine on the first turn, Windows Minesweeper moves that mine to the top left corner. It's simple, but I can't find an easy way to always reveal a '...
0
votes
2answers
46 views

How do you disable frame skips in a game, in SFML preferably

by frame skip off i mean that the game should just slow down if the fps drops, just like in terraria, i got this code currently and want to implement it to it: ...
0
votes
1answer
76 views

Heuristic Cost in A* algorithm

I have been learning about the A* path finding algorithm and I can't understand the heuristic cost in this algorithm. What is it and what is its use in the algorithm?
0
votes
0answers
25 views

Calculate the starting position of a turning aircraft with inertial force to make it stop at desired position and heading

Continued from the answer here, I have some problem when the aircraft in my game has inertial forces after going forward and turning itself. To illustrate, from the following image (https://imgur.com/...
1
vote
0answers
26 views

Low Level Audio Engine Sample Rate Conversion

First off, there seems to be a sparse number of audio programming tutorials out there so if anyone knows of some good resources I would be very appreciative. Now on to the topic at hand! I am using ...
1
vote
3answers
76 views

2D Finding an algorithm to check pizza toppings positions

Using unity 3D I am creating a 2D pizza game and I am stuck at finding an algorithm to solve this problem which is Detecting if the pizza is half and half taking into consideration that the user can ...
2
votes
1answer
126 views

Shifting Skill Tree

I have been thinking of implementing a system like Wolcen does for their skill tree, however I want to use it for level unlocks. Nodes grouped in segments and multiple segments from a ring (see ...
3
votes
0answers
84 views

Calculate the aircraft's movement path in which its side speed is required

I am working on an implementation problem in which given an aircraft and the objective of the system is to find the quickest route (optimal in terms of time) from point A (contains the information of ...
3
votes
1answer
79 views

Calculating the flavour of a dish in a cooking game

I'm currently working on a game that sees players cook dishes and are scored on their performance. To determine whether a dish is good or not, I will be looking to see if these elements are balanced: ...
0
votes
0answers
33 views

Polygon filling algorithm

Share your methods or algorithms for painting areal objects, I will be very grateful. I have points List <Vector2> or ...
1
vote
0answers
46 views

A system that figure out the fastest (not shortest) navigation method between points for 2D spaceship with 2 axes propulsion

I am working on a space themed game with space being a 2D pane. The player issue order by clicking on the coordinate for his/her ship to navigate to a certain point on the pane. The player ship can: ...
2
votes
1answer
59 views

Reducing adjacency bookkeeping work in constrained Delaunay triangulation

I'm using the Sloan algorithm for constraining a generated Delaunay triangulation. This primarily consists of edge flipping for the edges that overlap the constrained edges. In order to flip an edge, ...
1
vote
0answers
44 views

How to create a random, warped 2D grid?

How do you create a random grid where the lines aren't orthogonal (and cells aren't a perfect square), but are warped? Here's an example of what I mean: (Credit: screenshot taken from a video by ...
0
votes
1answer
177 views

Godot: How do I create a temporary invincible state or invincibility frames?

My issue I have been racking my head around how to achieve invincibility frames. Working in the Godot Engine I have considered a few methods for this: Setting a Timer Node when damaged to trigger the ...
0
votes
1answer
42 views

Match-3 should pieces store their location in the matrix?

I'm making a match-3 game. I have a TileManager script which stores all the tiles in a matrix, it's a singleton and it handles tile swapping and basicly everything regarding the management of tiles. I ...
1
vote
1answer
73 views

How to correctly solve a procedurally generated puzzle?

I'm creating a puzzle game where the player must remove all colored blocks from a grid. When the player selects a block, all adjacent blocks of the same color are removed. Any blocks that have empty ...
1
vote
0answers
45 views

How to search through large numbers of discrete objects that interact with each other, like Minecraft blocks?

Imagine you had a world like Minecraft, but wanted to bake in some sort of physics (okay, I was playing minetest actually). For example, blocks under too much pressure might break, limiting how many ...
2
votes
1answer
57 views

How can I position a large amount of boxes to prevent overlap efficiently

I've been working on an asset to position labels like they do in Diablo or Path of Exile, but I'm having trouble finding an algorithm to position the labels efficiently. Currently I just boxcast in ...
0
votes
0answers
257 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 ...
6
votes
1answer
256 views

How can I create a six sided tillable perlin noise image?

I'm attempting to create a tillable hex shaped terrain map using c++. As part of the process I'd like to use perlin noise, but it seems that in order to make it tillable I'll need to generate it 5 ...
4
votes
2answers
113 views

Room Detection on a Tilemap

I am working on a 2D top-down game inspired by Prison Architect. What I just can't wrap my head around is recognizing rooms built by the player. The game is built on a tilemap, meaning the map is ...
0
votes
0answers
34 views

timebased scoring algorithm for game

i am developing a game where user has to find target number using 5 given numbers and 4 operators. the score depends on the type of operators and number of operators used and time. ...
0
votes
0answers
41 views

How to implement an arbitrary rules engine with interaction

Suppose that I have a game that has fairly simple rules, but may have any number of rules modifiers. For boardgames, the classical example would be Cosmic Encounter, but Slay the Spire or any number ...
1
vote
1answer
55 views

Finding equivalent axial coordinates for a wrapping hexagonal map of radius n

I'm creating a wrap around hexagonal map that will potentially render infinatly. With the method I'm using, I have an x-y coordinate I use to find it's equivalent axial coordinate with the equations:...
3
votes
0answers
38 views

How to find the smallest distance between two 4-sided objects in 3D space?

I was wondering if there is a way to calculate the smallest distance between two 4-sided objects in space. In this specific scenario, the only information I know about both of them are the 4 points ...

1
2 3 4 5
22