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
vote
0answers
16 views
Integrating specular, diffuse reflection and refraction
I am implementing an MLT bidirectional path tracer. I have a problem integrating diffuse, specular reflection and refraction.
1) The first problem is diffuse and specular reflection. Diffuse ...
-1
votes
1answer
74 views
How can i fix my Ground detection code?
My ground detection works by checking if the player's x position is between the range of a sprite xpos+16 and xpos-16 if it is,then it uses a separate axis theorem on the y axis to see if the player ...
0
votes
1answer
32 views
Iteration over grid with randomly moving entities [on hold]
So, I tried to write this Wator-Simulation thing and everything works fine, except for the random movement and so the spreading of breeding fishes/sharks.
Instead of spawning more and more in every ...
-1
votes
1answer
38 views
Is there any easy way to understand the Alpha Beta for Othello?
I'm stuck with coding the Alpha Beta algorithm for a console-based game I'm developping at the moment. I tried to understand how it works for a week but still no idea how to get started with it.
Here ...
2
votes
1answer
139 views
Pathfinding in a 2D “sidescrolling” strategy game
I've been thinking up a real-time strategy game that plays on a platformer type of map. The collidable portion of these maps will be made up of square tiles. I've done A* pathfinding in top down tile ...
31
votes
9answers
6k views
How can I quantify a drawn line's straightness?
I'm working on a game which requires players to draw a line from a point A(x1,y1) to the other point B(x2,y2) on the screen of an Android device.
I want to find how well that drawing fits to a ...
0
votes
1answer
34 views
Assigining weights to numbers before random number generation [closed]
Say if you have a 2 identical arrays of n elements say with numbers from 1 to 10. You randomly pick an item from each array and check if they match. For one iteration the right match can be (10,10) or ...
0
votes
1answer
33 views
Texture to Painted Vertex Algorithm
I want to generate some game textures into coloured vertex arrays.
Is there a known algorithm to transform texture/bitmap data into an optimised vertex array. Much like how the Homeworld skyboxes ...
1
vote
0answers
76 views
Recursive backtracking sometimes missing a tile?
I have a basic recursive backtracking alghorithm for a maze. It pretty much works but ocasionally leaves some tiles in the corners untouched. This is the recursive function:
void ...
-2
votes
2answers
83 views
Minesweeper number placement [closed]
My professor gave us a project: make a minesweeper clone. However, he said that he will give bonus points for the 3 fastest algorithms for board generation. I'm currently doing the algorithm that ...
0
votes
1answer
65 views
A* pathfinding not finding shortest path with weird behavior [closed]
NOTE I have read through this thread and have tried the implemented answer
The A* pathfinding algorithm works fine most of the time but in some specific cases, it seems to not use the shortest path.
...
-1
votes
1answer
101 views
Tile map optimization algorithm
I've read this artical on tilemap optimization https://www.scirra.com/blog/ashley/3/tech-blog-tilemap-tidbits and wondering what algorithm is used to achieve something like this.
I'm wondering ...
0
votes
2answers
72 views
Fast Ray Sphere collision code
I am looking at here and while it's well organized a lot of links are broken:
http://www.realtimerendering.com/intersections.html
I am trying to find fast code that will give me the hit point and the ...
0
votes
2answers
143 views
Space invader barrier implementation algorithm
I've been struggling with implementing the space invader bullet to barriers. I wanted right now to blast a circle around, when the bullet hits the barrier and modifies the circle. As shown in the ...
0
votes
2answers
56 views
In a grid based system, where users can build their own walls to create buildings, how do you determine which parts are indoors? [duplicate]
I've looked around for an algorithm to solve this problem, but I can't seem to find anything.
In a game I am working on, data is held in a grid. Certain squares within that grid can be set as walls, ...
0
votes
1answer
66 views
How to invert a damage formula?
I have created simple damage formula based on source percent, which return fixed percent of damage.
DAMAGE_PERCENT = Exp(Log(100) * (1 - (100 - SOURCE_PERCENT) / 150)
Here is the result:
...
0
votes
1answer
80 views
Collision Detection algorithm using Line Detection
For a 2D physics sandbox I am working on, I need a way of detecting detecting a collision using lines. This sandbox uses a class called Particle, which has a x and a y (stored as a struct called ...
0
votes
0answers
67 views
Isometric staggered multi tile buildings
I'm writing a isometric staggered rpg engine and i am at loss to how to make the buildings placement diamond show up.
What I mean is i have tile2screen and screen2tile functions and it works ok. I ...
0
votes
1answer
56 views
Paint game level algorithm
I have a game, and I have a level editor where you can build your level from blocks. Blocks positioned in cells. So blocks can have no neighbours or have one or few neighbours. My problem is that I ...
1
vote
2answers
96 views
Bubble shooter clone, structure for storing/adding of bubbles
Im having a few issues trying to figure out what the best data structure to use for storing bubbles on the grid, and how to connect new bubbles to the grid when a moving ball collides with a ball on ...
0
votes
1answer
65 views
How to calculate a score algorithm based on elapsed time?
I'm trying to calculate an alogirthm based on elapsed time to calculate score based on a music beat.
I have the music beat divided into 4 because that's the time measure of that beat.
So If the user ...
0
votes
0answers
15 views
Smoothly scaling positions of GraphicsItems on a 2D GraphicsScene
I layout a bunch of nodes on a QGraphicsScene(A 2D Canvas). The nodes are basic ellipses. It works reasonably well.
However I would like to know how to better size the ellipses. Currently I have a ...
0
votes
1answer
62 views
Planar scene graph
Suppose there are many line segments on a plane (2D scene) and I would like to redraw only small portion ("window") of the whole scene. The scene is dynamic, meaning one can add/remove/transform ...
0
votes
1answer
40 views
Most efficient way to hide out of bounds object in tile based environment [duplicate]
I am working on a desktop game in C#, with Monogame framework. I am storing the tile instances in a 2D Array, for the sake of easy collision detection. But the levels are big (often 100x100 or bigger) ...
0
votes
0answers
37 views
2D Platformer Pathfinding [duplicate]
First of all, I'm sorry, I know this is a really broad topic, but I've been trying to do this for days, I've looked at about a hundred different Google links, and I'm just not having any luck. ...
2
votes
2answers
280 views
How can I generate a 2D mountain landscape procedurally?
Every level in my game needs to have a different mountain landscape background generated automatically (but the landscape must be the same for each level).
How could I generate such a landscape ...
0
votes
1answer
63 views
Backtracking in A Star
Hello, can anyone tell me how can i implement backtracking in a a star search algorithm?
I've implemented the a star search according to wiki, but it does not backtrack, what i mean by backtrack is ...
0
votes
1answer
90 views
Trying to add a feature to my (basic) level parsing algorithm - not sure how to (JAVA)
Right now this method goes through a list of GameObjects (e.g. JetPack, Platform) with their respective x and y positions in a text file called level1.txt:
platform 840 280
platform 1130 280
coin ...
0
votes
1answer
51 views
which is the best approach or algorithm to calculate real-time ranking
I want to know the fastest and most efficient way to compute points and ranking in real time.
I'm doing a betting football game (a game where users try to predict the outcome of a game before it). In ...
0
votes
1answer
142 views
Cavity map generation
I am looking for an algorithm how to generate cavity (or curvature) map. There seems to be no refernce to it, only final solutions like xNormal software, but that is not what I want. I am looking for ...
1
vote
1answer
46 views
Implementation of finding an index in a 1D array for a triangular grid
Am using a while loop to find an index within a 1D array, is there an easier, less-time-consuming and/or mathmatical way to find the index?
Consider the next grid:
4 o
|\
| \
| ...
2
votes
2answers
96 views
How do I model diffusion and heat?
So I'm trying to solve a heat/diffusion equation for a continuous space, but I'm not opposed to a grid solution. I'm a little short on the maths needed but have made it work so far.
If I model ...
2
votes
1answer
164 views
Signed Distance Fields: How are different colour channels used to improve output of sharp corners?
The naive approach to implementing signed distance field font rendering suffers quality issues where sharp corners get softened (either outward- or inward-facing corners, i.e. convex or concave ...
0
votes
1answer
118 views
Separation of axis theorem implementation at normals
This might be more of a math question, but it relates to the development of a simple physics engine I am trying to create.
I have been stumped on this for about a week now, and have been unable to ...
5
votes
3answers
235 views
How can I do optimal pathfinding for a Tetris piece?
Imagine a standard Tetris board (10x20) using the standard set of 7 tetrominos.
Given a Tetris game state and a target position, how can I find the optimal sequence of moves that will get the ...
6
votes
3answers
295 views
How can I check if a player-drawn line follows a path?
I want to draw an invisible path that the user must follow. I've stored that path as points. When a player draws a line, how can I test if it follows the path I've stored?
Here's an example for ...
23
votes
12answers
3k views
How can I make A* finish faster when the destination is impassable?
I am making a simple tile-based 2D game, which uses the A* ("A star") pathfinding algorithm. I've got all working right, but I have a performance problem with the search. Simply put, when I click an ...
1
vote
2answers
73 views
Algo for Minimum no of solving in a level like Bubble Blast2
Is their any way to make a algo to know minimum no of way to solve in Bubble Blast 2. I am trying to make a clone of it. My real problem is only to determine the minimum no of tap to finish the game. ...
1
vote
2answers
50 views
Translating Objects in Worldspace
Given the worldspace coordinates of a collection of arbitrarily positioned objects, how do I translate them while preserving their relative placement? For instance, I have a table and a few bowls that ...
1
vote
1answer
72 views
2d parallax edges
I'm writing a mini 2d game, the scene background is based on two images with parallax effect.
I want the right edge of both images, finish at the same time matching the right edge of the canvas. But ...
1
vote
1answer
48 views
Checking whether moving object has reached target position
So I have a fast-moving object in my game, let's say a bullet. At each iteration of the main loop I update the object's position based on the delta time value dt and draw it at the new position.
I ...
3
votes
1answer
157 views
How can I tell if an object in a tile grid is surrounded?
I'm making a game which uses a 10x20 matrix to store the position of the objects.
I have a castle object, represented by a number in a matrix. It is randomly deployed in some cell of the matrix. I ...
0
votes
1answer
58 views
Need help creating points in an array
I'm creating a lightning geometry shader using hlsl that creates an array of points based on an arbitrary number of generations.
The gist of what I want to accomplish is here:
...
0
votes
1answer
139 views
Finding a moving target in a maze
I'm making a game that is a bit of a mix of snake and pacman.
Basically, two players go through the maze and each time they pick up a piece of candy, a cube is added to their tail. If one player ...
16
votes
5answers
423 views
How can I detect connected (but logically distinct) bodies of water in a 2D map?
I have a 2D hexagonal grid map. Each hex cell has a height value used to determine if it's water or ocean. I'm trying to think of a good way to determine and label bodies of water. Oceans and inland ...
1
vote
4answers
156 views
How to order points on a 3D grid such that we can connect them in a line loop correctly
I want to recreate an effect as close as possible to X-Com: Enemy Unkown's movement range feedback:
The blue line delimits the tiles which the soldier can reach using a single action. We also are ...
1
vote
1answer
51 views
Algorithm that cover one mesh by another mesh
Suppose I have two meshes (Let call me first MeshShirt and second - MeshBody)
Meshes are aligned (if i render both MeshShirt "covers" MeshBody). But some parts of the body are not "under" the ...
4
votes
2answers
239 views
Bevel outline algorithm in 2D
I'm writing a program that creates animated blobs in 2D, to simulate cells. In order to beautify these objects, I'd like to give them a 3D look by adding a bevel-effect. How can this be achieved?
...
5
votes
3answers
262 views
How can I ensure a grid can be filled with Tetris-like pieces?
I'm thinking of making a puzzle game where the objective is to fill a grid with shaped puzzle pieces (for example, the classic Tetris shapes).
How can I go about generating a set of pieces that can ...
3
votes
1answer
158 views
Fastest way to find closest triangle of mesh from specified point
I have two triangle meshes (let me call them A and B). The meshes may be really big (10.000 - 100.000 polygons). I want to find for every point in A the closest triangle from mesh B.
Is there fast ...