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
2answers
17 views
Algorithm for using two types of HP, where one can be undefined
First of all, pardon for a question that I myself think is a bit stupid, but I'd love some ideas and input if someone would provide.
In my game, each unit has two types of HP: Hard and Soft. Soft ...
0
votes
1answer
30 views
How to get connect tiles in hexagonal Grid system
I've been developing a game where a number of tiles can drag into a hexagonal gird background.
But some purpose i need to find the location of same tiles into a array and marge them.
Data Layer
...
0
votes
0answers
16 views
Algorithm for Match making range value
I'm searching for an algorithm where if currentPlayer.matchMakingPoints is low .. then match it would opponents with +- for example 500 .. but as the currentPlayer's matchMakingPoints increases, the ...
1
vote
0answers
61 views
Z-order curve — how to query all nearest neighbors?
TLDR: How to query all nearest neighbors with the least effort? (Iterating over a bigger neighboring area that's continuous and filtering out elements that are not immediate neighbors?)
Suppose the ...
5
votes
2answers
153 views
Level of detail for the map of stars
I have a large list of points (millions) in 2d. Let's say it's a star map. Each star has a radius and position in space.
I want to render this map at different level of details. From a single star to ...
0
votes
0answers
52 views
Algorithm for 2d AI aiming to compensate for gravity
In a 2d side-view scenario I have two riflemen aiming at each other. By normalizing the x and y difference they know the direct path to the enemy.
However, gravity will pull the projectiles downwards,...
3
votes
2answers
75 views
Delay when moving elements
How you can see my mouse goes little bit faster than widget.
My movement algorithm is:
cursorPositionPrev.set(cursorPosition);
cursorPosition.set(getCurrentPos());
...
Vector2f delta = new ...
1
vote
0answers
29 views
Optimize field of vision algorithm in a grid tiled map
I am trying to implement Field of View algorithm in my game and I followed the great tutorial here : sight-and-light and here is what I got so far :
As you can see it works fine for me :)
And then ...
3
votes
1answer
24 views
Calculating the poly vertices based on the result of Connected Component Labeling
I am making a tile based game.
And now I can find all the connected area using the Connected Component Labeling algorithm.
But now the problem I am having is how to calculate the poly vertices of ...
1
vote
1answer
54 views
What's an optimal procedure to create a connected cyclic grid of nodes and edges for A* pathfinding
like the title says, I'm trying to create a grid of nodes that hold edges or connections to each other so I can perform A* algorithm to have objects traverse across them as seen in your standard RTS.
...
0
votes
1answer
43 views
Combining lots of small polygons to one (some) big poly(s)
I am looking for algorithm to merge lots of relatively small 2d polygons to one or some big polygons. In case two small polygons are touching or overlapping, they should be merged to one polygon.
My ...
0
votes
1answer
47 views
AI parameters for Tetris like game
I am building an AI to play a variation of Tetris. The rules are changed in that there are 19 different types of pieces, rotation is not allowed, and the pieces can be placed anywhere in a 10X10 grid. ...
0
votes
1answer
54 views
Evaluate 2D point in a 3D triangle?
Given three points,
(x1, y1, z1)
(x2, y2, z2)
(x3, y3, z3)
and given a point "A" at (x, y),
how would I find "A'", at (x, y, z)?
2
votes
0answers
104 views
Texture Mapping to procedurally generated geometry
How can I calculate texture coordinates of such geometry?
The angle shown in the image (89.90 degree) may vary, therefore the geometry figure is changing and is not always such uniform.(maybe like ...
0
votes
0answers
20 views
rendering moving terrain using midpoint displacement algorithm in sdl
This is in addition to the question I asked over here.
midpoint displacement algorithm in sdl.
The answer there helped me but I am facing another problem regarding the moving part. The terrain ...
1
vote
1answer
48 views
midpoint displacement algorithm in sdl
I am trying to implement moving random hills in SDL. I am using midpoint displacement algorithm to create some random terrain and I have also accomplished to move the terrain too. But the problem is ...
0
votes
1answer
97 views
Is there a way to make this better? [closed]
So was experimenting in making a rotating ring puzzle like the one to get into the mechanical age in Myst. I came up with a solution that will rotate the rings and when the button is released it ...
0
votes
0answers
36 views
AI: Turn-Based Movement with 2 actions per Unit
I am currently building a turnbased tactics game.
The Board is a small (about 4*6) tiled grid.
The AI plans all moves of its units, each unit can
move 2 times
move and attack
or attack
at ...
-1
votes
1answer
74 views
How to fill a canvas with triangles that are seemingly random?
Given a canvas say, 1000 X 1000 unit. I would like to fill the canvas with triangles. The triangles can be of any type right angle, equilateral...etc. To avoid big chunks of triangles lets say all ...
3
votes
0answers
27 views
Automatic audio segmentation and find the most energetic segments
What algorithm can be used for audio segmentation? I want to divide song to segments and find the most energetic segments (begin and end in seconds). It is needed for the rhythm-game.
Examples:
...
1
vote
1answer
93 views
C++ Data structure pattern preferability?
So im looking at ways of handling large amounts of data in situations such as an entity manager or particle system.
So i have concluded to use an object pool, and there are two things that I could do ...
0
votes
2answers
114 views
Java, spawn algorithm that gets harder each level
I am currently in the process of making my 3rd Java game (everything I have learned is from YouTube videos, so I may be doing some things wrong) named "Blocked". But I have run into a problem: how do ...
1
vote
0answers
42 views
Algorithm to propagate internal Physics force in a structure of building
Scenario:
A floating structure composes of many nodes (or in more visual meaning - a cubic block).
Every node is snapped to the same 3D grid. (similar to a minecraft castle)
There are external ...
-1
votes
1answer
62 views
How to constraint random spawn points to a road? [closed]
I have a terrain and a road.
I would like for spawn points to randomly appear on the road, and not outside on the terrain.
How to assign the spawn points to only be between the road and in random ...
1
vote
0answers
45 views
How can I make cars drive navigate an intersection without colliding?
I'm trying to create a 2D game with a traffic intersection:
My car game-objects need to pass through the intersection without colliding with each other, and without stopping, if possible.
How can ...
8
votes
3answers
197 views
How do I calculate paths for objects with limited acceleration?
For example, say I have a car and a car has a specific minimum turning radius and I want to drive that car from point a to point b, but the car isn't facing point b. How do I compute a path to point ...
2
votes
1answer
122 views
2D infinite grid data structure
I'm currently developing a game, and I'm in a process of experimenting with various data structures to support my game model and simulation.
Here are some of the requirements:
Grid structure where ...
4
votes
0answers
81 views
Depth of Field Blur - Weighted sampling?
I've been studying Intel's fantastic article titled "An investigation of fast real-time GPU-based image blur algorithms" (here), where-in they state that Gaussian blur would need to be customized for ...
1
vote
1answer
88 views
Procedural generation of evenly distributed random points (2d)
I am coming here because I've have a performance problem with my current implementation of an algorithm. I am the idea of Voronoi diagrams to distribute patches on an infinte 2d layer.
For a Voronoi ...
13
votes
3answers
167 views
How do you handle loss aversion in probability-based games?
The psychological phenomenon of loss aversion refers to how players feel losses twice as powerfully as victories.
For example, Bite Fight's PvP is a simulation based on probabilities related on ...
0
votes
0answers
33 views
Defining camera/view space
Im working on expanding my camera class, but having trouble defining camera/view space in the manner of this diagram:
What Im trying to achieve is to define the camera as a true object much like a ...
3
votes
1answer
114 views
How to create a believable swimming fish animated Sprite in 2d?
I want to create a fishing game in which fish needs to be swam across in the ocean. I put static fish which just progresses across ocean but it does not look very realistic and interesting to attract ...
1
vote
1answer
50 views
Circular fighter motion algorithm
Is there an algorithm to make ships take semi-circular patterns? I need something like the below image:
Big Blue- Command Ship
Small blues - fighters
Red lines - path of movement
I want the ...
3
votes
1answer
76 views
Locust Swarm algorithm for path finding (devour and move on)
I need to model a locust swarm that devour food stacks and move on to next stacks. I searched for articles and found few articles. These papers is about optimization applications but I want to convert ...
1
vote
0answers
36 views
Dynamic Mesh Generation Algorithm
I was recently given an assignment to generate a mesh from code, in Unity.
At runtime, the player will click at random positions on the screen.
An array will store all these points. There must ...
1
vote
1answer
86 views
How do I correctly shift arrays on a Tetris line clear?
I'm writing a Tetris clone in C++ and I am at the last stage, I need to delete a row when it is full. Once a piece falls it is stored in a boolean array grid[20][10]. For example I check which row is ...
0
votes
2answers
82 views
How do I reference one gameObject with script attached to other?
this is all in Unity 3D with C#.
Thing is, I have attached a script to my player that should Destroy TreeGroup (as in forest) whenever I press 'Q' and Instantiate them when I press 'E'.
Here is the ...
0
votes
1answer
116 views
Isometric scene in SpriteKit
I tried play with spritekit in isometric grid. But i can't understand how to fix level.
import SpriteKit
import XCPlayground
let view:SKView = SKView(frame: CGRectMake(0, 0, 1024, 768))
...
1
vote
1answer
103 views
Pathfinding to unknown destination point
Usually you need path finding algorithms to find one or the best path between two points. Do you know if path finding algorithm where you don't know the destination point exists?
I have a graph made ...
0
votes
2answers
52 views
Fastest way to neutralize scale in the transform matrix?
Let's assume we have 4x4 3D transformation matrix, that is the result of scale, rotation, and translation transforms. How to set its scale to (1,1,1) in the fastest way? Assume also that the matrix is ...
0
votes
0answers
33 views
How do I turn a vector map into a nav mesh?
I have the following path finding problem: I have a map that is described as a set of polygons that are traversable and need to somehow write path finding for the system. The current data is that the ...
1
vote
0answers
37 views
How to find grid cells not seen by an object
I am writing a VB.NET program.
I have a grid view which is made of multiple small cells called grid cell.
On the grid view, I have placed an obstacle (red box) and an observer (blue box).
My task ...
0
votes
0answers
25 views
Ads are loading, but not showing?
TL;DR: My interstitial ads in my game are successfully loading, but when I call .show() on them, they don't show up!
I have followed these directions, and the ads load succesfully, but don't show ...
1
vote
1answer
51 views
Image-Space coherence of the z-buffer algorithm
I'm reading Hierarchical z-Buffer Visibility by Ned Greene et al. and they state that
traditional Z buffering makes reasonably good use of image-space coherence in the course of scan conversion.
...
0
votes
2answers
104 views
Dijkstra's Algorithm - Infinite loop
While running Dijkstra's Algorithm to assign a direction to every tile and when an object land on the tile, follow the direction to a goal. I encountered an infinite loop (or I think it is). The ...
2
votes
1answer
84 views
Forward A-star pathfinding vs Reverse A-star pathfinding
Under what condition does doing Forward path finding or Reverse pathfinding get better result? Most tutorials for open grid tower defence games says to pathfind from the Goal to the monster. Why is it ...
1
vote
3answers
145 views
Finding dead ends in maze
I am creating a maze type puzzle game where there is a grid and the user can create their own maze but I need help in writing an algorithm which finds the following things:
How many dead ends are ...
0
votes
1answer
56 views
Why is my bullet disappearing after I release the shoot button?
I'm making a game using DirectXTK for my university project. When I press space bullet moves forward like I wanted, but when I let go it stops my bullet from moving. How do I keep the bullet moving ...
3
votes
3answers
144 views
Increasing chance of good loot after multiple tries
I'm looking for a way to make chances of getting better loot increase the more you've looted. I do not want it to be possible to get a rare item the first 5 times and not being able to get an epic ...
4
votes
1answer
212 views
How do I generate random mountains in a sidescroller?
So I'm trying to make a simplified Terraria style world using Perlin noise. I got that working and the terrain is randomized. However the terrain always looks like like a weird cosines curve. Hills ...