Tagged Questions

A regular tessellation of a surface to create uniform, contiguous cells arranged in a consistent pattern.

learn more… | top users | synonyms

1
vote
1answer
725 views

Efficient Way to Draw Grids in XNA

So I am working on a game right now, using Monogame as my framework, and it has come time to render my world. My world is made up of a grid (think Terraria but top-down instead of from the side), and ...
14
votes
5answers
1k views

Optimizing collision engine bottleneck

If this is your first time on this question, I suggest reading the pre-update part below first, then this part. Here's a synthesis of the problem, though: Basically, I have a collision detection ...
0
votes
1answer
467 views

Grid Based Lighting in XNA/Monogame

I know that questions like this have been asked many times, but I have not found one exactly like this yes. I have implemented a top-down grid based world in Monogame, and am starting on the lighting ...
0
votes
1answer
387 views

How can I create a tile-based game map from a large source image?

I'm trying to make a huge tile-based map for my game. I've authored a large source image of the map and saved it, but now I'm unsure how to break this up into tiles and render it as a grid so I can ...
-1
votes
1answer
125 views

Ray picking gives inversed results

I'm trying to do a simple ray picking implementation to allow a user to select a cell in a grid rendered in 3D. I'm almost there, but I've ran into an issue which I can't seem to solve. Consider the ...
2
votes
1answer
1k views

C++ How to implement a spatial hash (for a 2d Game)

I feel kind of silly for asking this question, but are there examples or tutorials on how to implement a spatial hash (grid/cell-based partitioning), preferably in C++? I'm stuck and I have no idea ...
1
vote
2answers
510 views

Converting hexagon grid coordinate system

As I have been building on a RTS game based on hexagon grid built in javascript. I stumbled across a problem regarding the coordinate system. Have been trying to implement a A-star system to find ...
1
vote
2answers
779 views

Algorithm for exploring/filling grid map

I'm working on a small game that takes place on a grid map. I'd like to write an AI that is able to explore the grid map by filling as much of its available space as possible. From any given position ...
-1
votes
1answer
229 views

Refering to an object from an array in Java [closed]

In my game, the whole thing is based off of grids. So the map is a dual dimensional array of 32 (32 x 32 grid map). Now what I want to be able to do is to grab a grid and be able to access it and ...
23
votes
4answers
4k views

Why don't we use octogonal maps instead of hexagonal maps?

I understand the advantage of hexagonal tiles over square ones. But why aren't octagons used instead? I would think they would provide better, more natural movement in eight directions. I was ...
4
votes
2answers
287 views

Grids and vertices

I have no idea what this is even called or even to start searching how to solve this problem. So figured I would post here for any information at all. Specially looking for already known solutions to ...
0
votes
1answer
621 views

How do I make an entity move once per second in crafty.js

I am trying to implement "Snake" using crafty.js but I can't seem to get the snake entity to move just once in a second. How do I do this?
8
votes
1answer
142 views

Flowfield density conversion

I'm trying to implement flowfield navigation, as described in http://grail.cs.washington.edu/projects/crowd-flows/ but I can't understand how the Density Function in Figure 4 of the paper is supposed ...
1
vote
1answer
140 views

Travelling in a 2D grid

I have a 2D grid (x,y coordinates) where each cell corresponds to each pixel of the interface that I am working with and I have a point A(x1,y1). Now I need to travel around in the grid, and I wont ...
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 ...
0
votes
1answer
724 views

How to attach a sprite to a TMXTiledMap at a particular coordinate, in AndEngine?

I am trying to add a sprite at a "grid" location on the tiled map. The TMX tiled Map is like a grid, and you can access the size of the grid by calling mTMXtiledMap.getTileRows() and ...
3
votes
1answer
379 views

Fluid Particle Grid

So recently I have been looking at some fluid simulation techniques, specifically Smoothed Particle Hydrodynamics. One of the key components is a grid to avoid O(n^2) searches. I have been having some ...
14
votes
2answers
346 views

Territory patrol planning

I am developing a game/simulation where agents are fighting for land. I have the situation shown in the picture below: These creatures are walking around and occupying pieces of land they step on ...
-1
votes
1answer
176 views

In a regular grid, how can I tell which tile a position is in?

I have a position on the screen, how do I calculate which grid tile that position is inside? I know the number of tiles in the grid, and the size of the screen (including how many tiles fit on it ...
5
votes
1answer
3k views

More efficient way to implement Line of sight on a 2d grid with ray casting?

Consider a 2d grid of tiles, and an approximated sphere of coordinates - centered on the player - that represents line of sight. The goal is to block the line of sight beyond obstacles (ie walls). ...
4
votes
2answers
2k views

Simulating “line of sight” with obstacles on 2d grid?

Ran into an interesting problem. I need to figure out how to simulate line of sight - simple enough, just on a 2d grid with obstacles. Either a grid cell is visible, or it's not. I can get something ...
5
votes
1answer
355 views

Finding cells between two points (along line) to finding obstacles

My game is in 3D environment partitioned with 2D grids in 2 dimensioned array So I can get any cell/node by passing row and col like return _nodes[r][c]. When the an attacker attacks an enemy with ...
3
votes
2answers
334 views

AI remembering obstacles without a grid

For some research purpose I've build a small tanks game where you have 1 tank controlled by a player and one or more NPC tanks. Now I want these NPC tanks to navigate through a field which they have ...
2
votes
3answers
2k views

How do I code a 2D tile map? [closed]

I'm new to game development and I want to know how to create a tile map. The map should be divided into squares, such that each square represents a location like x : 10, y : 10. The width and height ...
6
votes
4answers
2k views

Generating triangles from a square grid

I have a 2D square grid of values representing terrain elevations, and I want to generate triangles from that grid to make a 3D view of the terrain. My first thought was to split each square ...
0
votes
1answer
419 views

Alternatives to NSMutableArray for storing 2D grid - iOS Cocos2d

I'm creating a grid-based iOS game using Cocos2d. Currently the grid is stored in an NSMutableArray that contains other NSMutableArrays (the latter are rows in the grid). This works ok and performance ...
3
votes
3answers
359 views

How to choose cell to put entity in in an uniform grid used for broad phase collision detection?

I'm trying to implement the broad phase of my collision detection algorithm. My game is an arcade game with lot of moving entities in an open space with relatively equivalent sizes. Regarding the ...
1
vote
4answers
162 views

Logic that can traverse all possible layouts, but not checking every combination of identical pieces?

Suppose we have a grid of arbitrary size, which is filled by blocks of various widths and heights. There are many 2x2 blocks (meaning they take a total of 4 cells in the grid) and many 3x3 blocks, as ...
7
votes
3answers
2k views

Storing a Hex Grid

I've been creating a small hex grid framework for Unity3D and have come to the following dilemma. This is my coordinate system (taken from here): It all works pretty nicely except for the fact I ...
10
votes
2answers
906 views

Finding shapes in 2D Array, then optimising

I've just been allowed an image...The image below from my game shows some darkened blocks, which have been recognised as being part of a "T" shape. As can be seen, the code has darkened the blocks ...
1
vote
1answer
363 views

Creating an interactive grid for a puzzle game

I am trying to make a slitherlink game, and am not too sure how to approach creating the game, more specifically the grid structure on which the puzzle will be played on. This is what a empty and ...
2
votes
1answer
183 views

Should I take line thickness into consideration for a grid based light game?

I'm currently rewriting some horrific code I wrote for a prototype and have stumbled right at the start! The game I'm working on revolves around directing light and there is a small ambiguity in ...
1
vote
1answer
3k views

How do I match and clear sequences 3 adjacent coloured blocks?

I'm making a game with elements of a match-3 puzzler (such as Columns, Bejeweled or Tetris Attack). I don't know where to begin creating an efficient algorithm for matching and clearing. My ...
1
vote
2answers
2k views

How can I make a tile appear on top of another without completely blocking the tile below?

Making a small RPG with libdgx just for learning about how to draw tiled maps and move around in them. I've got the tiles drawn and OrthographicCamera stuff figured out so I can see my world. My ...
5
votes
2answers
462 views

Get position of tile in tileset

How can I get the position of tile 14 (or any other) when only knowing the following: Tile ID: 14 Rows: 4 Columns: 7 The end result should be 2x4.
2
votes
2answers
2k views

How can I snap a game object's position to a grid?

I'm making a game that involves "falling block" gameplay elements. The problem is, I'm not quite sure how to make it so that the blocks will snap to some kind of grid, in other words, I'm not sure how ...
5
votes
2answers
2k views

3D terrain map with Hexagon Grids

I'm working on a hobby project (I'm a web/backend developer by day) and I want to create a 3D Tile (terrain) engine. I'm using XNA, but I can use MonoGame, OpenGL, or straight DirectX, so the answer ...
3
votes
1answer
353 views

Space Invaders-type game: Keeping the enemies aligned with each other as they turn around?

OK, so here's the lowdown of the problem I'm trying to solve. I'm developing a game in PyGame that's a cross between Space Invaders and Columns. I'm trying to make the motion of the enemies similar ...
1
vote
1answer
675 views

Drawing 2D Grid in 3D View - Need help with method

I'm trying to draw a simple 2D grid for an editor, to able to navigate more clearly around the 3D space, but I can't render it: Grid2D class, creates a grid of a certain size at a location and should ...
2
votes
1answer
372 views

Detect if square in grid is within a diamond shape

So I have a game in which basically everything is a square inside a big grid. It's easy to check if a square is inside a box whose center is another square: *** x *o* --> x is not in o's ...
3
votes
3answers
790 views

Keeping player aligned to grid in Pacman

I am making a Pacman game using XNA. The game is tile based, with each tile being 32 pixels. As the player moves, I need to know whenever it is perfectly on a tile (ie position of 32, 64, etc...) so ...
8
votes
3answers
4k views

Road / river generation on 2d grid map

This is a newbie question, but here it goes: My map is a 2d grid, and I want to generate roads and rivers. The route from the starting to ending point must not be the optimal route in number of ...
2
votes
3answers
455 views

Detecting Units on a Grid

I am making a little turn based strategy game in pygame, that uses a grid system as the main map to hold all the characters and the map layout. (Similar to Fire Emblem, or Advance Wars) I am trying ...
0
votes
2answers
887 views

OpenGL align grid like glOrtho but with gluPerspective?

Using gluPerspective makes OpenGL's grid really messy and rather hard to use especially when trying to do mouse input. The grid that perspective uses is completely messed up compared to the grid you ...
2
votes
1answer
954 views

Help with a Fast 2D Grid-Based world rendering technique

First I'm going to give you my current situation and explain what I'm attempting. I will then pose my question below. I will attempt to include a "TL;DR" for those of you who prefer things to be ...
1
vote
1answer
1k views

Displaying a grid based map using C++ and sdl

I am trying to create a roguelike game using c++ and SDL. However, I am having trouble getting it to display the map, which is represented by a 2d array of a tile class. Currently, my code is this: ...
2
votes
1answer
2k views

Any way to set up a grid for a board game in cocos 2d?

My first idea was to create a 2d array for my columns and rows, but it seems like there should be a better, or possibly cleaner, way to achieve this. Each square on the grid is going to have a ...
4
votes
3answers
532 views

Creating the nodes for path finding during run time - more like path making and more

I'm making my 1st game. I'm using javascript as I currently want to learn to make games without needing to learn another language but this is more of a general game dev question. It's a 2d turn-based ...
1
vote
1answer
369 views

Getting fastest path on a grid

How would I go about finding the fastest path to connect two points on a grid? I'm making a 2D game and the map is based around a grid. I need to be able to account for any blocked tiles that the ...
1
vote
2answers
927 views

Reference a single 2d Rectangle in an array

What I am attempting to do probably has a very simple answer but I can't make heads or tails of it no matter how hard I try. Provided I'm a newb. What I am trying to do is after I create a grid of ...