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
1 answer
42 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 ...
Jakub M's user avatar
1 vote
1 answer
75 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 ...
Daniel Rudy's user avatar
0 votes
1 answer
26 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: ...
CAOakley's user avatar
  • 101
0 votes
0 answers
42 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'...
JorensM's user avatar
  • 101
1 vote
0 answers
37 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 ...
noodle_run's user avatar
0 votes
1 answer
124 views

Validate structure for a room escape game

In a game like a simple adventure or a room escape game, I would like to know if there are established algorithms to check for simple constraints on the layout. I would like some pointers so I could ...
john_smith's user avatar
2 votes
0 answers
53 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 ...
bux's user avatar
  • 147
0 votes
0 answers
78 views

Generating tris for concave polygon 2D

I have an arbitrary array of points that describe vertices of the polygon 2D, they ar in order. To generate plane mesh for that, I need to generate tris. For something like circle/hexagon/square it is ...
Kirikan's user avatar
1 vote
1 answer
74 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 ...
Magikarp's user avatar
0 votes
2 answers
174 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 ...
nicklowkc's user avatar
4 votes
1 answer
399 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 ...
ArtemiZ Studio's user avatar
0 votes
1 answer
126 views

How can I simulate lamp flicker in a Unity shader?

I want a game object to keep its brightness (modulating mainColor, like mainColor * brightness) most of the time, but sometimes ...
OtakuFitness's user avatar
0 votes
0 answers
210 views

Why is my chess engine so slow?

This is my second question regarding my chess engine. I can search up to depth 6 but it takes >=30 seconds for the AI to move. Currently my engine uses alpha-beta pruning, zobrist hashing, null ...
AF_'s user avatar
  • 11
1 vote
2 answers
243 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 ...
AF_'s user avatar
  • 11
1 vote
1 answer
243 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 ...
MAGS94's user avatar
  • 157
1 vote
0 answers
205 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 ...
Vincent's user avatar
  • 63
0 votes
1 answer
163 views

How do you resolve continuous collision in a multi body system?

I've been trying to figure this out for weeks but every resource only provides answers for a single body. As far as I can tell for a single body you Find the time of impact Step up to that time ...
gjh33's user avatar
  • 1
0 votes
1 answer
37 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 ...
Ardoos's user avatar
  • 29
1 vote
4 answers
185 views

How to increase difficulty of a catching game

I'm developing a game where products fall from the sky, and you need to catch them. A bomb also falls, and if you catch it, you die. I have 3 different products with 3 different scores. I want the ...
Diego Alcu's user avatar
0 votes
1 answer
150 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 ...
mathsymaths's user avatar
0 votes
0 answers
228 views

How to implement Glicko-2 rating system in a scalable way?

I have a multiplayer game that, similar to chess, will have a win/tie/lose outcome in a 1v1 setting. I've been looking at Elo versus Glicko & Glicko-2 and it seems Glicko-2 might be a good one to ...
K2xL's user avatar
  • 111
1 vote
1 answer
128 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 ...
Harry's user avatar
  • 167
0 votes
2 answers
159 views

Numbering sprites in a sprite sheet left-to-right, top-to-bottom

I'm using this program called Quadtastic which is a sprite sheet management tool that lets you define quads on a sprite sheet, name them, etc, and export to metadata with those names (+ position, size,...
Garflington's user avatar
  • 1,055
0 votes
0 answers
44 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 ...
Charl Cillie's user avatar
0 votes
1 answer
168 views

Scaling Weighted Loot Table

I'm working on an astroid mining game where there's the player controlled ship that can split astroids into smaller ore chunks to then collect and bring back to a base station for processing. I'd like ...
andrewwx10's user avatar
1 vote
0 answers
37 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 ...
Jean-Milost Reymond's user avatar
0 votes
0 answers
32 views

Merging smaller boxes into larger boxes in a 2D grid [duplicate]

Imagine a 2D Grid of boxes, each box is a square, like a chessboard. Each box can be marked or unmarked depending on player actions. I want to find an algorithm that groups marked boxes neighbouring ...
Allahjane's user avatar
  • 709
2 votes
1 answer
306 views

Movement system for thousands of entities

I want to implement a movement system for armies of multiple thousand units. However, I struggle to get the movement "stable" when there are more than a few hundred units. The problem: When ...
Gileos's user avatar
  • 23
-1 votes
1 answer
35 views

Calculate index of bottom left block on a mxn grid

I am working on a board game that requires me to color the bottom left corner of the board with random number of rows and columns a different color from the other blocks. Given an m x n grid, how do I ...
Eliot Kim's user avatar
0 votes
1 answer
37 views

Algorithm to get all the blocks to the top and right of the current chosen cell in Chomp game

If I have a grid of 4x4, I want to get all the blocks/buttons in java that are to the right and top of the chosen block, how would I write an algorithm for it? For instance if the user picks the block ...
Eliot Kim's user avatar
0 votes
1 answer
152 views

Trying to generate a Tile labyrinth in Unity

So I have a generator code that renderes a TileMap on the scene, but It keeps creating a sollid block of walls Where I want it to have empty cells(This is not the final algorythm(Recursive ...
koogel's user avatar
  • 79
9 votes
3 answers
2k 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 ...
GauthierBee's user avatar
0 votes
0 answers
91 views

How to quickly calculate the number of tiles between buildings in a tile system

my friend and I are currently working on a city builder game like Anno/Cities Skylines but with some own ideas and tweaks. (of course, on a much smaller scale) Currently, we are struggling a bit with ...
Bizes's user avatar
  • 1
1 vote
1 answer
106 views

Determine if a triangle is on the screen

I am working on a small software renderer, and I want to discard invisible triangles from the drawing process. Let's say I have a screen with resolution of 200x100 pixels. The triangle is defined with ...
Netherwire's user avatar
1 vote
1 answer
464 views

Find closest open space in grid of rectangles?

I'm making a builder game where you snap arbitrarily sized rectangles into a 2D grid. I want the player to be able to drag and drop these rectangles anywhere on the grid, but prevent collisions (i.e., ...
Andrew's user avatar
  • 13
1 vote
1 answer
61 views

Detect if a chain of tiles form an enclosed shape/contour [duplicate]

I'm looking to determine if in a tilemap if a set of tiles of same color in a chain (either right next to cardinally, or diagonal) is forming a closed shape and to detect the tiles inside the said ...
Mustafa Ahmed's user avatar
1 vote
1 answer
83 views

Determine if a static mesh is lit by directional light

I want to determine if a mesh is lit by the directional light on my scene in editor to automatically disable its "dynamic shadow casting" property (let's say I have one light source in my ...
Netherwire's user avatar
0 votes
2 answers
266 views

How to find words on a hex grid

I am trying to make a hex grid based word game. Currently the words are placed from a list of pre-defined words(a list of animals in this case). All colored cells make a word that was placed, while ...
Daniyal Ibrahim's user avatar
1 vote
1 answer
1k views

How to generate boards for a game like GamePigeon's Word Hunt?

Naively, I would assume that there's an even probability of any of the 26 given letters appearing in a tile and that each tile is generated independently. After playing around a hundred times, though, ...
suburb1a's user avatar
1 vote
1 answer
75 views

How can I implement an algorithm to mix potions?

I would like to build something that allows me to obtain potions using two identical lists of ingredients. ...
Pitto's user avatar
  • 257
0 votes
0 answers
69 views

Finding connected values of the same type within a 2D array

I am currently working on a puzzle game where blocks drop and you match nearby colors Blocks are stored within a int 2D array that stores with a value between 1-3 once placed, and it should find ...
user avatar
0 votes
1 answer
94 views

In a portal-based engine where Items are owned by a room, how to do inter-room collision detection?

My engine consists of Rooms. Rooms are connected via Portals. Items have a roomNumber field to indicate which room they belong to. And rooms have a linked list of ...
Raildex's user avatar
  • 703
0 votes
0 answers
139 views

Balancing random chance

I'm working on a text-based RPG incremental/clicker game. One of the features I'd like to implement is a 'bloodline' system; Every user gets a one time random chance to 'roll' for a bloodline. ...
Pazzle's user avatar
  • 113
1 vote
2 answers
158 views

Understanding use of "localUp" in planet mesh generation code

I'm following a tutorial on YouTube about procedural generation of planets. I'm puzzled in some aspects of the code shown. If any of you could explain the following points, I would be very pleased. ...
nicolas osorio bustos's user avatar
0 votes
2 answers
224 views

How to check multiple rings of tiles around a center tile on a 2D grid

In my game project I create the terrain programmatically by creating tiles on a 2D grid as the player moves around the game map. I have it working where I select the current tile and check all 8 ...
peacetype's user avatar
  • 145
1 vote
0 answers
71 views

Fast way to test whether a point is over a 3D mesh

I have a map with islands, and I need to detect whether the player is on an island or not. The player can be flying far above the island, so a fixed-distance raycast is not sufficient, and firing long ...
Robotex's user avatar
  • 251
1 vote
1 answer
305 views

Optimal way to find the closest entity to player with a restricted set of functions

The scripting engine of Skyrim (and Fallout 4) has an interesting function called FindClosestActor(x,y,z,radius). If you call it with x,y,z center coordinates and a radius, it returns the closest ...
Bálint Juhász's user avatar
-1 votes
1 answer
155 views

Best way to save game in story game

In a while I plan to create a story game that would have different routes and endings and I was wondering what would be the best way to save a game of a game like this, if it would be a folder, ...
Noel's user avatar
  • 1
7 votes
2 answers
8k 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: ...
Crazy's user avatar
  • 197
0 votes
1 answer
32 views

Given a set of points with color values, finding a gradated color value from a given position

I guess the verb form of gradient is "gradate" and not "gradiate"? Hi! I have a set of 2D points (actually 3D, but we can ignore the Y axis unless it's trivial) bound to color ...
Johnny Cage's user avatar

1
2 3 4 5
23