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

15
votes
2answers
658 views

Why is my sky color calculation in Mathematica incorrect?

I'm trying to implement an algorithm to calculate sky color based on this paper (Perez' model). Before I start programming the shader I wanted to test the concept in Mathematica. There are already ...
1
vote
4answers
175 views

Checking game objective status in efficient way on each update call

I am creating a 2d mobile game where there are three levels. Each level has 20 objectives. This can increase in the future. Examples: Level 1 Current Objective: 2/20 Objective : Collect 1000 coins ...
13
votes
2answers
367 views

Scrambling word into least recognizable form

My goal is to present the player with a scrambled word that should be reordered back into the original form: OELHL --> HELLO I want a scrambling algorithm that takes any given word(>3or4 letters, ...
-1
votes
1answer
191 views

Server fixed timestep not running at 30Hz but way way too fast [closed]

I'm trying to make my game's server thread run at a fixed 30Hz but can't figure out how. Basically, before I just had a stupid while(1) { //do everything as fast as you can} which means that for my ...
13
votes
1answer
1k views

Get ring of tiles in hexagon grid

Thanks to this post I'm able to collect adjacent tiles to a given tile. But I'm pretty much stuck on an algorithm that gives me only a "ring" of tiles specified by an offset. The algorithm given in ...
2
votes
0answers
163 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. ...
5
votes
1answer
427 views

How do you parameterize turn based AI?

I would like to create/find an AI algorithm/process that can be parameterized such that a change in the parameters causes a change in the AI behavior. I am specifically looking to apply this to a turn ...
8
votes
2answers
245 views

Determining if removal of a voxel will break up a group

I have the following situation: I have a 3d grid of voxels (on/off, the max size is probably 128x128x128). I know in advance that inside the grid, all the voxels that are turned on are interconnected, ...
11
votes
3answers
887 views

Algorithm to see if two voxels are interconnected

I'm looking for a good algorithms for the following problem: Given a 3D grid of voxels (which may be either empty or filled), if I pick two non-adjacent voxels, I want to know if they are connected to ...
0
votes
1answer
149 views

Simulating building stress [closed]

I need to simulate the effects of adding supporting materials to a building structure for a genetic algorithm in a block-based world. Essentially I am planning to use a genetic algorithm to optimise ...
0
votes
2answers
322 views

How to build a math module and simulate a system?

For example, in the classical game SimCity: an economic model to simulate the supply and demand of the city, then calculate how many people live in each building, how many people work there. a ...
2
votes
1answer
247 views

Collision Resolution: How to avoid Interpenetration/Tunneling Caused by Prior Collision Handling? [duplicate]

My game processes world collisions followed by entity collisions. The problem here is that entities can break through walls the next frame when world checks are run again as a result of the prior ...
0
votes
1answer
234 views

Create Random Platformer-Gameworld

Evening. I created a xna-game like the iOS Platformer game "Banana Kong". The level-layers are currently saved as XML files. Example: <level> <layer1> <tile type="0" ...
1
vote
1answer
67 views

Build a Cube/Prism from other varied Cubes/Prisms [closed]

I'm wondering, are there any algorithms or theories in existence (that aren't patented/proprietary/protected) that would take a series of 3d rectangular prisms (or cubes but a cube is a prism) and ...
1
vote
2answers
325 views

How to do FoV similiar to Nethack? [duplicate]

I am currently writing a little roguelike and wondered how Nethack/other games do the FoV of the player. I had a look at Nethacks source code, but since it's C it's pretty hard to read. For people ...
5
votes
3answers
833 views

3D pathing finding with flying

Does anyone know of a (free or paid) solution that enables 3D path finding? Basically something like: CalculateRoute(input_geometry, start_pos, end_pos, variance) I found a good paper on the ...
8
votes
7answers
2k views

What's the best way of transforming a 2D vector into the closest 8-way compass direction?

If you have a 2D vector expressed as x and y, what's a good way of transforming that into the closest compass direction? e.g. x:+1, y:+1 => NE x:0, y:+3 => N x:+10, y:-2 => E // ...
5
votes
1answer
1k views

3D isometric depth sorting

How is it possible to depth sort tiles and objects in an isometric environments without any limitations? I've been researching this for a while now and there seems to be no publicly available answers ...
2
votes
2answers
517 views

Implementing a color picker [closed]

I'm making a paint program using applets in Java, and I want to create some sort of color palette where the colors blend into each other, similar to this: However, I'm having trouble understanding ...
3
votes
4answers
2k views

3-in-a-row or more logic

This is a bit more difficult than it seems and the one other post on here isn't sufficient. You have a row of n items, and each item could be any one of 5 colors. You need to find if there are any ...
1
vote
3answers
458 views

Smart terrain generation to avoid unconnected tiles

To make this clear from the get go; I'm not looking for HOW To randomly generate a terrain (I know I can use Perlins noise for that). I'm looking for an algorithm that can help with the terrain ...
-1
votes
2answers
392 views

NPC AI articles for walking and fighting? [closed]

I'm looking to learn about NPC AI to solve a problem how an NPC should walk e.g. walking straight and then turn at a wall. Perhaps I can program it to walk along a line but then I still would not know ...
2
votes
6answers
789 views

Is it good to sort objects list before every rendering?

I need to render a "tile" game, which are like these: or or I don't know how to render them in correct order. I intend to perform a sorting operator before every rendering (depending on their ...
1
vote
1answer
116 views

How do I avoid obstacles on a predefined path?

I want is a character to walk along a path defined as a waypoint sequence. For example, a soldier patrolling around a castle. However, I want the soldier to avoid (dynamic) obstacles, without ...
2
votes
2answers
582 views

How to generate houses procedurally in a voxel world?

I am developing a mod for the game Minecraft, a block-based voxel game. As part of the mod, I want to create a procedural house generator that will be generated based on specific needs/desires, such ...
2
votes
1answer
260 views

Level design algorithm/pattern for Linerunner etc

I am wondering: how does someone make levels for a game like Linerunner or any other game that uses similar patterns? About Linerunner (game) You are a stick man running, you have to jump or crawl ...
7
votes
2answers
338 views

Algorithm to select all cells inside rooms/regions

I have a 2d game map consisting of several 'rooms' For example, here is a 2D map grid: (Brown cells = wall tiles) If I click on a tile (that isn't brown), I would like to obtain an array of all ...
3
votes
2answers
442 views

Derive a algorithm to match best position

I have pieces in my game which have stats and cost assigned to them and they can only be placed at a certain location. Lets say I have 50 pieces. e.g. Piece1 = 100 stats, 10 cost, Position A. Piece2 ...
58
votes
4answers
4k views

Procedural… house with rooms generator

I've been looking at some algorithms and articles about procedurally generating a dungeon. The problem is, I'm trying to generate a house with rooms, and they don't seem to fit my requirements. For ...
2
votes
3answers
275 views

Complex Scaling

I've been trying to figure this thing out for weeks now, but with no luck.So, I am creating this program in WindowsForms and Xna, that allows users to create a 3D room. By draging and customizing ...
1
vote
1answer
157 views

Using circles to create a sphere

I've been working on creating spheres in a 3D space recently, and have successfully created cylinders. I've just run into a little problem. For some reason, my "Spheres" end up looking like very thick ...
3
votes
1answer
71 views

Retrieve outer most points on a 2d graph

G'day everyone, I have a 2d graph which has some points plotted on it. What I need to do is get only the outer most points so that I can connect them up (isn't really relevant). What I can't seem ...
1
vote
1answer
500 views

Tongue pull effect

I've been searching on the net for several days and can not find nothing about this effect. Even a name for this effect. I want to make a character that can use his tongue to pull objects objects it ...
4
votes
1answer
696 views

Catmull Rom Spline - Constant Speed

Given the equations found in the answer here: Determine arc-length of a Catmull-Rom spline How would one A) Apply this to a 3D Catmull-Rom Spline, and B) write A out programmatically (for the math ...
2
votes
1answer
708 views

How should I go about randomizing levels in a “runner” game?

I'm working on a runner type of game (basically it's a never ending run through hordes of enemies and platforms and whatnot). 2d platformer view. Should I random a bit of map every now and then? Few ...
6
votes
1answer
1k views

Elegant autotiling

I'm looking for information about how people implement autotiling in their tile-based games. So far I have always improvised it with a bunch of hardcoded "if ... else ..." statements, and now I ...
-1
votes
1answer
199 views

simple escape algorithm: enemy escapes when hero approches

I need some clues on a "escape" algorithm. My scene a 2D rectangle (0,0,1000,1000) I have enemy sprites on this scene. They are immobile until distance from hero <100. If distance<100, enemy ...
0
votes
1answer
287 views

Iterating 1D array and getting 2D tile position

I know I'm missing something very obvious here, but I have a 1D array that contains integers.I have a map that is 30 x 30 and the center coordinate is 0,0 (This is actually 3D, but I'm essentially ...
3
votes
4answers
1k views

Efficient path-finding on 2D tile-based multilevel map

It's a question I've been thinking about for some time... How do you effiently find a path on a 2D tile-based multilevel map? The map I use, for example, is 2048 on 2048 tiles wide. It has 14 levels ...
0
votes
4answers
973 views

Storing huge 2D tiled map in a txt file

I'm working on a global startegy game that uses a 2D tiled map. The map is to be 8000x8000 tiles large (this size is fixed, the map stays the way it is throughout the game), since I'm covering a large ...
6
votes
1answer
242 views

How to do score systems, combos, multipliers, chains, etc

I am designing a game, but I am having some trouble implementing a decent score system. Basically I have nodes with two different possible characteristics: color and shape. Since the player click from ...
3
votes
2answers
456 views

Syncing game states in a multiplayer RTS game

I'm working in a group with 2 friends on our Gr. 12 final project for programming. We're making a multiplayer RTS game. I've been assigned to the networking section of the game, and none of us have ...
6
votes
4answers
947 views

Ideas for attack damage algorithm (language irrelevant)

I am working on a game and I need ideas for the damage that will be done to the enemy when your player attacks. The total amount of health that the enemy has is called enemyHealth, and has a value of ...
2
votes
1answer
552 views

2D/Isometric map algorithm

First of all, I don't have much experience on game development but I do have experience on development. I do know how to make a map, but I don't know if my solution is a normal or a hacky solution. I ...
5
votes
2answers
427 views

Matchmaking by user-supplied parameters

I'm looking for matchmaking algorithm for a 1 vs 1 online game. Players must not be matched by their skill level, but instead by some specific filters set by the players. Each player sends a request ...
1
vote
1answer
164 views

Keeping the meshes “thickness” the same when scaling an object

I've been bashing my head for the past couple of weeks trying to find a way to help me accomplish, on first look very easy task. So, I got this one object currently made out of 5 cuboids (2 sides, 1 ...
1
vote
2answers
2k views

Reversi/Othello early-game evaluation function

I've written my own Reversi player, based on the MiniMax algorithm, with Alpha-Beta pruning, but in the first 10 moves my evaluation function is too slow. I need a good early-game evaluation function. ...
1
vote
0answers
86 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 ...
10
votes
2answers
459 views

Showing range on hexagonal grid

Here is the situation. I have hexagonal board,and a unit on it,with speed or move value 4.Diffrent terrain has a diffrent cost.When i click on the unit,game should show me a move range. My solution ...
7
votes
3answers
3k views

isometric drawing order with larger than single tile images - drawing order algorithm?

I have an isometric map over which I place various images. Most images will fit over a single tile, but some images are slightly larger. For example, I have a bed of size 2x3 tiles. This creates a ...