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.

learn more… | top users | synonyms

1
vote
0answers
44 views

Map generation, issues with midpoint displacement algorithm

I'm trying to generate an endless 2d terrain. So the terrain isn't random per say as the random function I'm using is a hash based on an X,Y coordinate. static public float rand (System.UInt32 x, ...
0
votes
0answers
37 views

Any algorithm for leveling system based on difficulty

so I'm trying to create a leveling system for a sport we play in town. However, I'm kinda having trouble thinking of the correct way of implementing the algorithm. These are a few things I want to ...
1
vote
1answer
67 views

Swept AABB Collision and Response Problems

I am working on a simple 2D game, and I am having problems with collision detection and response. I am using code adapted from this article: http://www.gamedev.net/page/resources/_/technical/game-...
0
votes
1answer
93 views

What's the best way to deal with platformer tile collisions?

I am starting with game development and creating a basic platformer game. I already have searched a lot and found some ways to implement the platformer aspect to the game, like apply a gravity, ...
6
votes
2answers
180 views

Finding cells within range on Hexagonal Grid

First up - I know I'm being super-dense here. With that out of the way, I'm trying to write a C# implementation of this algorithm: var results = [] for each -N ≤ dx ≤ N: for each max(-N, -dx-N) ≤ ...
2
votes
0answers
128 views

Recognize pattern in 3D building environment

I'm currently developing 3rd person building game (as bacheleor thesis). I need to recognize constructed patterns co I can mark corresponding structure as some building (so player can start using that ...
-1
votes
2answers
82 views

Help with drawing a polygon with N sides [closed]

I am at university on my games development, and I have been given work to fill in an empty pixel plotter program using the methods they have supplied for it to teach us the algorithms used in 2 ...
0
votes
1answer
56 views

Random equidistant points like a tree branch (JS)

I'm working on an algorithm to generate a "graph" like array of points in my game world. See Image Below: Here is what i'm working on so far, which will generate the black line.. but this may not ...
4
votes
2answers
707 views

How to do placeable electricity cables that work like the ones in “Prison Architect”

I would like to know one (of the probably many) ways to code a (sort of) Prison-Architect-ish electricity cable building system. Here's a picture of what I mean: How can I detect that cables are ...
3
votes
2answers
132 views

understanding spatial hash function behaviour and Knuth for int64

I implemented open-indexing sparse 2D spatial HashMap, and I'm quite satisified with performance ( ~30-70 CPU cycles to get object at particular location for size ~16 Milion objects ). However, I ...
1
vote
1answer
94 views

Calculating unique ID number from a set of bitmasked tiles

So I write this kind of match3-style game where you as a player need to match tiles with three or more of the same type and I'm thinking what is the best method to recognize the shapes without writing ...
1
vote
1answer
51 views

How to combine dynamic asset reload and texture atlases? (rectangle packing with removal)

Usually texture atlases are built either: as a seperate content pre-processing step or once when the game starts What I want to do is create and update atlases on the fly when: A new texture ...
4
votes
1answer
92 views

How to solve Sweep and prune false positives concerning large floor plane

I am developing a 3d sweep and prune module for a project, and it is producing false positives. The pair generation code is as follows: for (unsigned int i = 0; i < mXExtents.size(); i +=2) ...
3
votes
3answers
70 views

Computing a full revolution for an arbitrary orbit?

I'm making a game in which the goal is to get as many planets as possible to orbit around a star. The user launches planets at any distance away from the sun (as long as it's on-screen), and in any ...
6
votes
1answer
126 views

Minimum number of moves algorithm in Java

I'm looking to implement the minimum number of moves algorithm for the java game I'm developing but I can't quite figure it out. Here's an example picture: There are also some specifications ...
3
votes
0answers
40 views

What algorithms are used for force dispersal between rigid objects attached by joints?

I have in mind a 2d, side-scrolling game which requires the construction of vehicles and/or structures built of conjoined rigid structures, like beams or platforms. These structures will be impacted ...
2
votes
1answer
98 views

How can I remove unnecessary nodes from my path?

How do I remove the unnecessary nodes from the path to make it as short as possible? Idealy I'd like the result path to look like the green line. The red thingy is not walkable. var ...
4
votes
2answers
190 views

Generate Geodesic Sphere from Hex and Pentagons

I have two polygonal meshes, a hexagon and a pentagon (They are tiles in a strategy game). I want to use them to construct a geodesic sphere (https://upload.wikimedia.org/wikipedia/commons/e/e7/G%C3%...
0
votes
0answers
21 views

Timed Line Drawing

I'm trying to program a remake of the classic Missile Command Atari game from scratch, but I've run into a problem. So I have a function that can draw a line from one point to another. I figured I ...
0
votes
1answer
95 views

Liang-Barsky Line Clipping Algorithm

Is it possible to generalize Liang-Barsky Line Clipping Algorithm for n-dimensional space ?
2
votes
2answers
116 views

How do I find the set of regions that are fully enclosed by a color?

How do I get all areas surrounded by a certain color in a multidimensional array? For example, this map has three regions that are fully enclosed by red tiles. They are highlighted enclosed in pink. ...
3
votes
1answer
121 views

Transparency sorting in 3D world with different render types

I am rendering a world, object, and models from an older game format. The world is presented in a BSP tree so I can quickly iterate through. The opaque surfaces are rendered front to back. Then ...
5
votes
2answers
211 views

Diamond square algorithm

I'm working on generating terrain on already generated landmass. The landmass and ocean around it consist of hexagons. Hexagons aren't really a concern for me, because I can always interpolate the ...
6
votes
1answer
405 views

How is Signed Distance Field Ray Marching implemented for a dynamic world?

I think I understand the basics of Signed Distance Field Ray Marching. You model your scene with a bunch of distance fields (such as these: http://iquilezles.org/www/articles/distfunctions/...
0
votes
2answers
105 views

Connect phone to computer? [closed]

In order to test out my game, I need to use my real life device. The problem is, android studio isn't recognizing my device plugged in: The problem: My device isn't getting detected in android studio ...
0
votes
1answer
44 views

Generating Formulas for glDrawElements with Tile Grids

glDrawElements can be used to save you from uploading a lot of vertices to the GPU. Many 2D games use tiles, which are rendered in grids. I have done some experimenting with the indices array. For a ...
1
vote
1answer
183 views

How do you rotate all the objects around the camera?

If I'm correct, the way that you can "look around" in an environment is that you rotate all the objects around the camera. This is the code that I've created using JavaFX 3D. So what's the algorithm? ...
3
votes
2answers
170 views

How to avoid Walls in A*

Well I had a problem with the implementation of my A* algorithm in C# for unity, and I don't realize how to prevent the diagonal movement and the cross walls, I had the next code, the print line's are ...
3
votes
1answer
86 views

How to make “Shaky mouse cursor” Before shoot the target Like in a Dart Game?

I develop a shooting game. To make it harder I want to make the reticle shaky/move randomly. I use Robot class to move random as suggest here. But I modified it by adding an infinity loop and by ...
2
votes
0answers
54 views

3D Zoom To Mouse Cursor accounting for Change in Camera Pitch

Overview: Simply put, I'm trying to make a zoom to cursor algorithm. This would normally be very simple, but the implementation of the camera is making it difficult. As the camera zooms in and out, ...
3
votes
5answers
634 views

Want to play 1 of 3 tracks depending on current level

I want to play a gameplay music track depending on what the current level is. E.g. 1 - Play track 1 2 - Play track 1 3 - Play track 2 4 - Play track 2 5 - Play track 3 repeat... 6 - Play track ...
4
votes
2answers
313 views

How to calculate delta time with SDL?

I have heard that you can calculate delta time with two functions called SDL_GetPerformanceCounter and SDL_GetPerformanceFrequency. I'm not sure how they work completely, but I heard it is a bit ...
2
votes
0answers
187 views

How do i add a rain effect to a top down design game in Java, using no external libraries?

I'm creating a top-down game for my A-level/college computer science project, and I'm trying to implement rain. The game needs to be usable on any platform, so the use of external libraries is out of ...
2
votes
1answer
30 views

Returning a List of coords for a sphere in order of inside to outside

I'm looking for any algorithm that can return a list of Vector3 coordinates that form a sphere. If you read the list from the beginning it would appear the sphere was expanding. The only algorithms ...
1
vote
0answers
65 views

Movement algorithm for Pocket Civ game

I am developing a Pocket Civ game engine. (You can check the process at www.pocketciv.com). Basically there is maximum of 8 Areas (round nodes in the pic) that have Tribes (number inside the node). So ...
1
vote
1answer
79 views

common math algorithms that aren't physics/object based [closed]

I'm starting to customize my game a lot more beyond just the engine and I'm curious what sorts of algorithms and concepts exist. There are a ton of solutions for physics and geometry-like questions, ...
2
votes
0answers
54 views

GPU Spatial Clustering

I have a around 100k points on the screen (that might update). 2D points. The goal is to cluster them into groups, by a constant distance. Meaning, finding groups of points that the distance between ...
3
votes
2answers
227 views

How to compare different states of my game? (rpg)

I'm working on a rpg, the battle system. I want to compare different scenario with each other. For example, what if I play move A then move B ? or two times move A ? or ...? I'm using a tree-...
3
votes
2answers
90 views

Putting items into a 3D space

Imagine a fridge and a bunch of random foods. I want to take one food item, automatically put it somewhere in the fridge, and repeat. I can stop at any time. Basically, the filled fridge should look ...
2
votes
2answers
99 views

Algorithm for spending x points on y things divided by n people

I'm trying to devise an algorithm to spend a given amount of points on a randomly generated list of items each with their own cost in a way that results in having a number of items that is divisible ...
4
votes
1answer
167 views

Generating 'Specially' shaped rooms for a Dungeon

I've made a fairly simple dungeon generator but now I want to expand on it so that I can procedurally generate a dungeon with irregular shaped rooms. I don't just want any old crazy shapes popping up ...
0
votes
2answers
154 views

Exponential EXP Curve | FIXED TIME -> MAX LEVEL

I have yet another experience equation question, with a slight twist. Problem Situation Player gain experience from Level 1 - 80. Time to level from Level 1 to 80 grows exponentially. There is a ...
0
votes
1answer
72 views

How are loot box labels positioned?

Take this screenshot for example: How exactly are they positioned perfectly adjacent to each other? Do they already create the label positions based upon the world map first, and then when the ...
3
votes
1answer
118 views

Calculate visible points in grid in 2D game

I have a game grid and I need to figure out which game grid points are not behind occupied grid point from players view. The visible points. I'd like to define a visible point first, because it can ...
1
vote
1answer
85 views

My attempt at a drunkard walk algorithm seems to generate large groups instead of more linear paths

...and I'm not sure if that's normal due to the random nature of the algorithm or am I doing something wrong. What I'm doing is: Set a random point within map boundaries (which I called a sandbox). ...
4
votes
2answers
165 views

Graph search with a high number of actions

I have implemented A* to reach a goal state from a start state. My state is position X,Y, angle and others state variable. I have a number of actions. What I call actions is : A* on a grid has 4/8 ...
3
votes
3answers
342 views

Find two points in a point cloud with the maximum distance?

What is the least computationally complex way to find two points such that the distance between them is greater or equal to any other pair. Remember hearing something about how you could find such a ...
-2
votes
1answer
122 views

Why is my delta time constantly under 1 millisecond?

I have a game loop that looks like this: while (Sync()) { DoStuff(); } The sync function computes my delta time like this: bool Sync() { EndTime = GetTime(); DeltaTime = (EndTime - ...
7
votes
3answers
471 views

How should a circuit or power system (like redstone in Minecraft) be implemented

I want to implement a power-system like the redstone system in minecraft. I have n power sources and m cables. If I disconnect the power source or a cable the circuit should turn off. How do I ...
0
votes
1answer
96 views

Most efficient way for nested loop to not repeat a value of parent loop in pair-wise structure (C# or Javascript) [closed]

It's hard to choose the correct title for this question, so let's see if I am able to better convey here what I am in search for. If the title is too far away, suggestions are welcome and I can edit ...