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.

68 questions
0answers
47 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 ...
0answers
75 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 ...
0answers
43 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 ...
0answers
57 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 ...
0answers
630 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 ...
0answers
256 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 ...
0answers
171 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 ...
0answers
317 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, ...
0answers
778 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 ...
0answers
670 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. ...
0answers
48 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 ...
0answers
19 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 ...
0answers
167 views

How is terrain editing implemented like a sculpt tool?

Some creativity/sandbox games have a terrain editing feature. When thinking of a terrain, I'm thinking of a grid of vertices. The elevation of each vertex is then determined by a heightmap (image). ...
0answers
161 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)). ...
0answers
224 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 ...
0answers
46 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 ...
0answers
153 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 (...
0answers
355 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 ...
0answers
29 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'...
0answers
30 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 ...
0answers
231 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, ...
0answers
78 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 ...
0answers
427 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 ...
0answers
75 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 ...
0answers
115 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 ...
0answers
169 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 ...
0answers
298 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. ...
0answers
120 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 ...
0answers
173 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). ...
0answers
420 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 a to the image ...
0answers
395 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 ...
0answers
168 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 ...
0answers
2k views

2D Drag Racing Algorithm

What algorithm can I devise for a 2D drag racing game to simulate a race? The gameplay is 2D and the camera's perspective is from the right side of the cars i.e. cars are seen from their right side ...
0answers
122 views

Performance issues with visibility detection and object transparency

I'm working on a 3d game that has a view similar to classic isometric games (diablo, etc.). One of the things I'm trying to implement is the effect of turning walls transparent when the player walks ...
0answers
860 views

What is the best way to implement collision detection using Bullet physics engine and a track generated from a curve?

I am developing a small racing gam, the track is generated from a curve. As said above, the track is generated, but not infinite. The track of one level could fit with no problem in memory and will ...
0answers
124 views

Fixed time step with Akihabara

How could I implement fixed time step with Akihabara framework? I would like my avatar to move by fixed distances of one block as in Supaplex.
0answers
19 views

Trying to understand the range of Improved Perlin noise

I've been implementing Improved Perlin Noise for a small library I'm writing. Everything was hunky dory when it was just in the 3rd dimension, but I recently expanded to the 1st, 2nd, and 4th ...
0answers
45 views

Keeping track of moving sprites in 2D grid

I'm working on a 2D tower defence game in C++. The game world consists of a grid of Cells, that are managed by a Map: ...
0answers
57 views

Algorithm for Circle with fixed radius to cover most points

I'm in need of an algorithm to find the best spot for a circle with a fixed radius r to cover as many points as possible on a 2D grid, preferably O(n). Currently I tried 2 different approaches: The ...
0answers
22 views

Implement an “xprevious” in LibGDX

I have used Gamemaker Studio 2 before, briefly, and found that the xprevious and yprevious variables are extremely useful. ...
0answers
28 views

Unity Waypoint system

I am trying to code a way to choose between multiple paths using the waypoint system. I tried it with if statements but it was just very inefficient. Can anyone suggest me some ways to get this done? ...
0answers
34 views

Chess AI Finding Checkmate Using MinMax

I have implemented a chess AI using a Mini-Max(With a partially working AB pruning) implementation. At the moment, it can search a depth of 5 and it is capable of playing a good middle-game. It pretty ...
0answers
31 views

Detect how many blocks can be moved given a grid of blocks

Let G be a grid of booleans where true means a block is there and false means there isn't a block there. Let P be the player, ...
0answers
37 views

Unity — Proper algorithm for a Character Controller that automatically fits mesh?

I'm trying to make an algorithm that will automatically generate a CharacterController component (on a parent-GameObject) which should automatically resize to whatever the current mesh size is. To ...
0answers
35 views

Duplicate packets and termination of packets in multiplayer game

I'm making a multiplayer game (lazertag) with real hardware. After hours of research, I'm choosing the UDP instead of the TCP protocol to exchange data. Because of how unreliable UDP is and because ...
0answers
23 views

Algorithm for tile loading order

I'm working on an Android app (you could call it a "game") that loads meshes (= kind of tiles) depending on your line of sight. Basically I'm generating the ground in a void world in which you are a ...
0answers
23 views

Failing to apply Max Rectangle algorithm

After asking this question, I have few problems trying to implement Max Rectangle Algorithm that is described here on page 19. I have a hard time implementing this, do you have leads or advices on ...
0answers
45 views

Algorithm for 'grid based occlusion'

I am working on a project within which I have a 3d grid-aligned world. On the 'faces' connecting grid cells (whether XY, XZ, or YZ plane), there is the possibility for an occluder (wall/floor/etc.) to ...
0answers
116 views

Testing for connected maze cells

I'm currently in the middle of writing a game where there is a maze. The maze itself is already drawn ok, and once I have the layout I randomly rotate all the pieces. I have a 'start' cell that is a ...
0answers
52 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 ...