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
votes
0answers
49 views

AI for enemy in 2d game [on hold]

I need an AI algorithm for enemy in 2d game for aiming at player and shooting. This is a j2me game. The enemy first comes from top and waits few seconds and then moves to left and then goes to ...
0
votes
0answers
42 views

Professional game design involving game play algorithms [closed]

I have been involved in a few independent game projects and unfunded start ups as the guy that designs game logic. I don't really have the programming chops that the other guys did, but I'm good at ...
-1
votes
1answer
34 views

Match-3 Shuffle Required?

How can I detect if there are no more potential matches possible and therefore a shuffle is required?
0
votes
2answers
50 views

How do I know when a player has crossed a point threshold?

I’m needing help figuring out logic when adding a time bonus to my game. I only want to reward the player with extra time if they level up. Currently when the player’s score is less than 100 no ...
0
votes
2answers
167 views

best way to implement movement after A* pathfinding? tile-based movement vs pixel-based?

I was able to implement the A* pathfinding algorithm to calculate a path from the enemy to player. After trying to do movement well, I realized I ran into all sorts of problems. I was able to add ...
2
votes
0answers
43 views

How do I convert a partially transparent image into polygons?

I'm using GLEE2D, a level editor allowing me to import images, scale them, rotate them, and position them onto layers and export the data into XML format. However, it does not tell me objects' ...
0
votes
1answer
38 views

What is the actual formula to find the vertices of an animation frame in using a BVH file?

I've read this tutorial and tried many formulas to build the skeleton. I am able to build it without the rotations, but those break everything. This, for example, is a simplified code for one of my ...
1
vote
1answer
127 views

How do I avoid pathfinding characters getting stuck in corners?

I used A* pathfinding to return a list of Tiles to get from an enemy to the player. After that, I wasn't sure how to actually move the enemy. What I ended up doing was get the first Tile in the path. ...
0
votes
0answers
24 views

How to reduce n^2 complexity when checking for collisions and attacks? [duplicate]

I have a snake clone game, but each element can attack enemies and enemies may attack elements in snake. They all have range of attack, and what I do is every time my update loop triggers (60 times ...
0
votes
1answer
111 views

Hearthstone suggest a card algorithm [closed]

Does anyone have an insight of the suggest a card algorithm in hearthstone deckbuilding? I would like to try to see it that same suggestion can be applied in MtG, having for example to choose your ...
2
votes
0answers
43 views

Minimum number of vertex moves to un-intersect a polygon with itself [migrated]

In my game, I have n points that form a self-intersecting polygon. The points can be moved by dragging them. How can I form a non-intersecting polygon this way, in the minimum number of moves?
3
votes
1answer
54 views

Field of view determination with partially opaque cells

I'm currently implementing the field of view of a player in a 2D-grid based game. I've chosen a standard ray tracing algorithm because he really fits the features needed in my game. However, the ...
1
vote
0answers
46 views

Astar optimalization (A*) [closed]

So I have written own implementation of AStar (A*) algorithm to find paths around my 2d tile based map. My problem is that if I call it each frame (I need to do it) and I'm searching path from corner ...
3
votes
2answers
97 views

How simulate the return effect of the wheel of fortune needle

I am trying to create a spinning wheel which slows down after a specific time. I managed to simulate the slowdown of the wheel but I need also to put a needle which go up and down with an angle of ...
0
votes
0answers
25 views

How to combine vertex, normal, UVW arrays optimally?

In Unity, meshes have multiple arrays for various vertex components (Normal, Position, UV coord, etc), and triangles consist of three indices that define the (same) offset into each array to build the ...
10
votes
1answer
284 views

How can I generate a lightning bolt effect?

Is there an algorithm to generate a lightning bolt? I would like an algorithm that generates a list of segment or point objects specifying where the bolt will land. The method would need a start ...
4
votes
1answer
75 views

Pathfinding avoid a list of polygon

i'm working on a 2D RTS project, no tile-based map. I have a problem on building map data structure & algorithm for that. I already think of a naive algorithm to solve that. Of course it's very ...
7
votes
3answers
173 views

How can I add and subtract convex polygons?

I have two 2D convex polygons overlapping each other. I am looking for an algorithm to subtract and add them. The result must be a single concave polygon or (even better) a set of biggest convex ones ...
-1
votes
1answer
135 views

Tower Defense Search Enemies Efficiently

I had a problem with the build of a TD. I got a slow - non efficient search for towers find targets to shoot. PD: enemies[] got all the active & non-active enemies (death and alive) ->Im using ...
0
votes
0answers
43 views

Java Angle Math: Calculate how near the player looks to an entity [duplicate]

I am programming a Minecraft Bukkit plugin and need a way to calculate an input number from 0 to 360 for displaying a custom compass / radar. So if the player directly looks at the object (shouldn't ...
3
votes
1answer
122 views

How to create a grid based on random shapes?

How to create a "grid" using actionscript like the image below? Basically you have an area of 1100x615 which should be filled with shapes that could be rotated and scaled... Collision detection ...
0
votes
4answers
232 views

Carve river beds into existing 3d procedural generated terrain

Ok, I've read many threads around about procedural terrain generation with rivers and roads but they suggest approaches from zero to result. I'd like to know if exists an algorithm to apply to an ...
3
votes
1answer
193 views

Verify which bubble is connected to top using DFS

I am working on a bubble shooter game in this game i have implemented searching using DFS as suggested in this link, and this is working fine. Update Here is my code for DFS ...
1
vote
1answer
106 views

Angular velocity from 2D Collision

I have been working on a 2D physics engine for my A Level computing project and I am having trouble calculating the angular velocity from a collision. I have managed to workout each objects linear ...
2
votes
3answers
125 views

How control probability of win-lose in tile-matching games?

In a random puzzle game, such as a match-three game, how can you control the probability of a winnable starting condition?
1
vote
1answer
72 views

Scanning a 2D tile map and detecting regions?

I have access to all points/tiles on the map with top-right most point being (0,0). Simplest way to traverse the map would be using for loops, one nested within the other to traverse the x axis, and ...
2
votes
1answer
54 views

How can I cut a graph representing 2D positions into two sub-graphs?

I have a graph where each node is associated with a 2D position. I would like to use a finite line to "cut" this graph into two halves, as shown below: Note that the cutting line does have a ...
2
votes
1answer
163 views

Match-3 algorithm to fill empty space left from removing matches

I am currently creating a match 3 game. I am at the point where I have objects dropping down in the column when only one item is removed. So if an item is removed, the above item moves into its old ...
5
votes
3answers
123 views

Pathfinding Search for Path of Specific Length

I am creating a roguelike. This question applies to random map generation. First, I generate areas using a BSP algorithm, where I randomly divide the map into areas. Then, I generate a graph of the ...
4
votes
2answers
168 views

Exists a dedicated non-O(n²) Algorithm for avoiding to have overlapping elements?

I am generating positions in a random fashion. In the game world, instantiated elements have a radius, and shouldn't overlap. The problem is that they will overlap because I use a usual random ...
4
votes
2answers
250 views

How can I adapt “random walk” generation to very large maps?

The random (or drunkard's) walk is a great, simple algorithm that can generate very organic-looking maps, such as this: Unfortunately it seems to have poor scalability, making it unsuitable for ...
9
votes
1answer
438 views

How does the Simple Stupid Funnel Algorithm work?

Working with the funneling algorithm shown on Digesting Duck I'm not sure how the detection of the funnel works. Can someone explain the method clearly to me or suggest an alternative way of ...
2
votes
2answers
83 views

Calculation: Is a sphere/square/plane visible from a certain point?

I'm searching for a way to detect if a form (shape can be changed if algorithm requires it) is visible from a single point in a 3D tile-based world. This should be used as some kind of wall-hack ...
1
vote
1answer
220 views

Pipe connection game algorithm - Java/Andengine

I am creating a game based on Pipe Dream/Pipe Mania using java/andengine for android. I have a square grid of tiles each representing a type of pipe. The player needs to swap tiles to connect the ...
1
vote
3answers
145 views

Simulating (Human) Needs? [closed]

How can I simulate the vegetation (of a human being)? To simulate Hunger for example, I use some kind of saturation based system now. Means that every food-object saturates differently and the ...
1
vote
3answers
211 views

In a semi-infinite procedural (chunk based) map, how do you handle objects larger than a single chunk?

I'll use an example to try and be more specific. Assume this is for a 2D top-down game. Chunks in this are made up of 32x32 tiles. If procedural buildings were to be generated based on some kind of ...
3
votes
3answers
243 views

Algorithm for game difficulty/pacing curve generation in single player RPG

I'm looking at this article about pacing in entertainment and games. It suggests that all good entertainment roughly follows a pacing/engagement curve like Star Wars(below). I'm interested in how I ...
0
votes
1answer
80 views

Tennis game algorithm and maths

Tennis courts are real dimensions and game is 3D Ball has position (x,y,z), speed(vx,vy,vz) and acceleration (ax,ay,az) Game has 30 fps and on each update (1/30sec) it has these properties vx +=ax; ...
3
votes
1answer
286 views

How can I optimize this flood fill algorithm?

I'm creating a sprite and animation editor like this one. I'm having performance issues with my flood-fill algorithm. Basically, I open an image with the different modules that are part of a frame of ...
8
votes
1answer
431 views

How do Raymarch shaders work?

I have been looking at shaders found here shadertoy.com and most of the cool ones have noise and raymarch in common. I do not understand the source code at all but I really want to. How do these ...
1
vote
2answers
208 views

Filling in gaps in a grid

I have a set of terrain sprites available to represent terrain: Flat North-South Straight Cliff (x 2 allowing for slope direction either way) West-East Straight Cliff (x 2 allowing for slope ...
1
vote
1answer
80 views

Where can I find info on grid based algorithms for stateless AI? [closed]

There seems to be an overwhelming amount of info out there on AI of all kinds, and it's kind hard to digest at once. For my testing purposes, I'm creating a "typical stateless AI", as described in ...
1
vote
3answers
178 views

Randomly generating the hallways between a network of rooms [duplicate]

So here's my base map: (It won't necessarily be 5x5, just using this as an example.) It's kinda boring the way it is with all the rooms connected. I want it to be more of a randomly generated ...
1
vote
1answer
235 views

How should I generate the board for a match-3-style game?

I am trying to create a "match 3" game. I'm stuck figuring out a good algorithm to fill up the game board. My game's board is 8x8. EDIT: A few things: The board should always be solvable. for ...
0
votes
1answer
128 views

How to find a free patch of area in a tiled map?

I've been trying to formulate the question and try to find some information on Google, but didn't managed to, so here it is... We've got a nice tropic-themed game that is about to be released soon, ...
0
votes
0answers
36 views

Sprite rotation algorithm [duplicate]

I'm making a game where you have to plot a function to hit certain objectives. I already made the plotting function and the animation to display a tiny missile that travels above the function. My ...
1
vote
3answers
231 views

Why can't my A* implementation find a path out of an open room?

I tried to follow this article with the following example, but in my attempts it always ends up with a dead end. If we take G being 10 in a straight line or 14 in a diagonal, and H the distance in ...
4
votes
5answers
368 views

Goalkeeper Jumping Algorithm?

This may be a "best way to" question, so may be susceptible to opinion-based answers (which is ok for me). But I would also like if there are any tutorials , research papers , etc. I'm trying to make ...
2
votes
3answers
71 views

Divide rectangular image into fixed number of random sized rectangles + 1 fixed size rectangle

I'm trying to divide a rectangular image into a fixed number of smaller rectangular image parts (of random but bounded width / height), with the exception of 1 rectangle which is predefined in ...
0
votes
3answers
187 views

Send info about gun shots via UDP

I am writing a small multiplayer game in C++. But I am confused about how to send info about gun shots to achieve best performance. I am thinking of different ways to do that: Let's say we have a gun ...