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.
114 questions with no upvoted or accepted answers
5
votes
0
answers
120
views
Slot Probability Function
Please can someone point me in the right direction. I'm working on a slot game. that I'm having trouble figuring how to implement the probability function for. The game has a set of symbols that bets ...
5
votes
1
answer
1k
views
Creating a Roguelike game in C
I'm trying to create a simple rogue-like game in ncurses in a C program.
The idea here is that, I'd parse a file like this:
...
3
votes
2
answers
189
views
How to make a digger-like procedurally generated maze that can be queried at coordinates without having to generate?
I would like to procedurally-generate ant farm-style layouts on a grid: long horizontal spaces connected by short vertical spaces. Also similar to cave systems formed by water erosion.
Every tile in ...
3
votes
0
answers
130
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
0
answers
90
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 ...
3
votes
0
answers
112
views
How to create landscape image from 2D map?
I created a 2D map using Perlin Noise. Based on the value on x,y, I determine an altitude and so a color to apply to my map (8 levels map).
Now, I don't want my player to see the map but I would like ...
3
votes
0
answers
96
views
Representing a high-resolution deformable solid in 3D
I am currently working on a design that will incorporate an object that can change size and shape.
For an example, I'll use a brick of clay. It starts out with normal dimensions of 1"x3"x6", but that ...
3
votes
0
answers
329
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 ...
3
votes
0
answers
204
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 ...
3
votes
0
answers
575
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
0
answers
106
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 ...
2
votes
0
answers
89
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 ...
2
votes
0
answers
682
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 ...
2
votes
0
answers
886
views
Triangulating a 3D mesh from a set of data points
I'm trying to implement the Bowyer-Watson point insertion version of the Delaunay triangulation algorithm, but in 3D. I previously implemented the 2D version without problems, but when transitioning ...
2
votes
0
answers
180
views
Generating vertices for group of hexagons
I'm working on the map editor of a game, where you can create a grid of hexagons to paint. An example of a grid of radius 6:
What I want
Once map creation is done, I would like to generate a mesh for ...
2
votes
0
answers
2k
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 ...
2
votes
0
answers
871
views
How to trace contour of shapes with holes?
I am experimenting with the RVO2 library for collision avoidance in a 2D simulation. This library supports specifying arbitrary obstacles as a list of vertices. The obstacles must be full shapes, i.e. ...
1
vote
0
answers
216
views
Dynamically generating the layout of a skill tree
How would I go about automatically generating the layout of a skill tree?
Skill tree nodes have at least one parent, but they can have more. Ideally I'd have a root node that recursively creates its ...
1
vote
0
answers
54
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 ...
1
vote
1
answer
247
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 ...
1
vote
0
answers
50
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 ...
1
vote
0
answers
89
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 ...
1
vote
0
answers
83
views
How to implement a big audio source and a cluster of audio sources?
I have a 3D game. The sound engine supports:
playing ambient music to the player (two channels always the same)
playing static sounds from a single position in space
playing mobile sounds from a ...
1
vote
0
answers
211
views
Creating outline from a collection of points following the concavity
I am trying to create an outline from a collection of points. I found this solution for Convex Hull. I specifically picked this implementation: https://en.wikibooks.org/wiki/Algorithm_Implementation/...
1
vote
0
answers
229
views
Fast self collision/intersection detection algorithm for tetrahedral meshes
I want to play with deformation of tetrahedral mesh (soft-body simulation) but I need help with self-collision detection stuff.
I found SOFA collision detection but I'm not sure that it fits for self-...
1
vote
0
answers
262
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
0
answers
68
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:
...
1
vote
0
answers
155
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 ...
1
vote
0
answers
94
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 ...
1
vote
0
answers
190
views
3D Binary Space Partitioning with solid/empty leaves
I've recently started looking into BSPs for real-time collision detection, and I'm now looking into improving the performance of my solution.
The system that I've implemented is rather similar to the ...
1
vote
0
answers
216
views
Team matchmaking based on ELO score
I'm looking for a very simple way to put up 2 teams out of unspecified amount of players. So its not actually a standard matchmaking since it only creates one match out of the whole pool of queued ...
1
vote
0
answers
58
views
Handling game message packet loss at low speed and at a microcontroller level
I read this: How do I handle packet loss in a client-server network model?
...But I'm looking for more advice.
Currently I'm implementing my own lazertag vests. I'm programming hardware (8051 ...
1
vote
1
answer
351
views
Acceleration in Unity
I am trying to emulate acceleration and deceleration in Unity.
I have written to code to generate a track in Unity and place an object at a specific location on the track based on time. The result ...
1
vote
0
answers
383
views
Wall collision and sweep and prune algorithm
I am documenting myself on collision detection algorithms.
If I understand well, "sweep and prune" algorithm using frame coherence is powerful to detect object vs object collisions (almost as 0(n)).
...
1
vote
0
answers
313
views
Has there been any research done on ideal values for loot drop tables?
I doubt many people want to grind for an item that has a 0.00001% chance to drop from a boss that takes 30 minutes to kill. I'd imagine there are certain factors that play into how rare an item should ...
1
vote
0
answers
55
views
Given N objects in my 3d world, how to set camera zoom to have all framed?
I have N objects and I've done a routine to get the overall objects :
min_x, max_x
min_y, max_y
min_z, max_z
and, i have an
...
1
vote
0
answers
557
views
Chunked QuadTree creation & handling
I am new to LOD-based techniques so please be lenient with your comments about my naive questions.
Preface:
My aim is a simple terrain renderer (preferred C++ and OGL) that is to load a height-map (...
1
vote
0
answers
64
views
Algorithm for clipping convex quadrilaterals
I'm dealing with hardware that uses quads as its polygonal primitive. Not triangles. A triangle can be expressed by setting 2 of the 4 equal to each other for a degenerate quad.
For the 3D engine, I'...
1
vote
0
answers
82
views
Creating Smooth Corners when Converting 2D Polylines to 3D Models
Part of my game takes SVG polylines (which are just basically a set of x,y coordinates that define a multi-segment line) and converts them into 3D 'paths' (ie. a line created as a set of faces all ...
1
vote
0
answers
388
views
Letting an Pathfinding Algorithm generate movement paths for all possible Connections in a Starsystem-based Universe
First of all I want you to forgive me when I make mistakes in my writing, english isn't my first language, and also: If this is the wrong place to ask, please direct me to the right place then.
So, ...
1
vote
0
answers
743
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 I ...
1
vote
0
answers
123
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
vote
0
answers
218
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 I ...
1
vote
0
answers
288
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 be ...
1
vote
0
answers
491
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.
...
1
vote
0
answers
144
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
0
answers
227
views
Collision detection in 3d
what is the simplest algorithm for collision detection that respects the following requirements:
The collision is only between cubes that are always aligned with the axis of the world (not rotated).
...
1
vote
0
answers
558
views
Libnoise producing completely random noise
I am using libnoise in C++ taken and I have some problems with getting coherent noise. I mean, the noise produced now are completely random and it doesn't look like a noise.
Here's the image produced ...
1
vote
0
answers
419
views
Image Texture Tracing Algorithm - Cocos2D Box2D
Context: I am working on a 2D Destructible Terrain engine for Cocos2D with Box2D. All images, when a level loads, have their border's traced and cached for the purposes of forming Box2D b2EdgeShape ...
1
vote
0
answers
192
views
Non-smooth noise with optimal performance?
Any suggestions on how to get more 'jagged' results like linear interpolation gives with value noise using a faster algorithm concept like simplex noise?
Simplex noise I haven't spent enough time ...