Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [grid]

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

2
votes
2answers
192 views

How should I store world data in a 2D grid sandbox game?

I'm just a beginner game developer and working on my own first project (beyond copying other games for learning skills). Because I really like sandbox games (like Minecraft, Rimworld, Terraria etc..),...
0
votes
1answer
49 views

Unity3D Hex Grid neighbor search with radius

I am trying to develop a small Game with a Hex Grid. I need to find the Neighbors of one Hex Tile in a specific radius. Here is a screenshot of my Problem: Screenshot I followed this awesome ...
-1
votes
1answer
57 views

Java 2d array to generate grid - java.lang.ArrayIndexOutOfBoundsException: length=4; index=-1

I am creating a Hashi Puzzle game (Islands and Bridges) I am generating a 2d grid with Islands that can be connected using bridges, I am also running a DFS algorithm to check if the map is solvable I ...
3
votes
1answer
185 views

Creating random path in grid

I need to find a path with required length in the NxN matrix without loops and deadlocks. For example: We Have a grid 7x7 (49 blocks in total) with START (orange) point. We need to build random ...
0
votes
2answers
61 views

2D Grid based movement inherent issue

I have a 2D grid based movement. To move, I stop key inputs until the character has reached a tile. Because of this, if you make a new directional input midway from one tile to another tile, nothing ...
1
vote
1answer
95 views

Looking for a square-to-hex pixel coords algorithm

So as the headline suggests, I am looking for an algorithm/algorithms used for square-to-hex and hex-to-square pixel coordinates convertion. I have an image which looks kinda "interpolated", meaning ...
2
votes
2answers
72 views

Given a point on a 2D grid of discrete points, and a normalized direction vector, how to I find the next point in that direction?

Say you have a point on a grid, lets call it P and your have a direction vector called V, how do i find the closest point from P in V's direction ? Example: 1|2|3 4|P|5 6|7|8 V = (0.5 , 0.5) In ...
0
votes
0answers
30 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 ...
4
votes
1answer
57 views

Navigate multiple Units on a grid through a tight space with different directions

I just started learning about pathfinding algorithms. Assume we have this scenario: Blue and Green can move only on those tiles. They can also talk to each other. Blue wants to go through the tunnel ...
8
votes
1answer
172 views

How can I procedurally find a wall that separates two or more points on a grid-based map?

I'm trying to generate walls that cut off a given point from other given points. The attached image shows the sort of thing I'm after: Blue separated from Red. Blue separated from Red and Yellow. ...
4
votes
2answers
206 views

Messy results from simple cellular automata algorithm?

I wrote something that will first randomly populate a square a with grass tiles, and then from there it will calculate tile types from each tile's surrounding tiles. My ultimate goal is generate a ...
4
votes
1answer
93 views

Diagonal symmetry across a filtered array?

I wrote this code to randomly generate a square terrain that somewhat resembles an island. First, I randomly populated a square with grass tiles (1s) on a plane of water tiles (0s): Then, I looped ...
1
vote
2answers
56 views

Letter game board creation

I currently have a game concept similar to the mobile app Alphabetty where you are given a grid of letters and are tasked with spelling words. When you use a letter in a word, it disappears and new ...
3
votes
1answer
286 views

Finding all hexagonal grid coordinates inside cover arc

I got a turret that points at the corner of hexagon (point A). It can shoot in cover arc that's shown here: I need to check if my target lies within this cover arc. From this tutorial: Hexagonal ...
0
votes
1answer
623 views

Drawing a grid over a terrain using a mesh - Shader Depth and Z-Buffer

What I'm trying to achieve is rendering a (huge) tile grid over a terrain. For that I'm using a generated mesh of quads, one for every tile, whose vertices Y value is the same of the terrain to "shape"...
2
votes
2answers
80 views

How to calculate all points in a 2D grid defined by an arc, given a starting point and range

I've an unit in a 2d (integer) grid-based game, which has a bearing. Now I want to display an arc, with a given radius (for instance simulating a 90 degree cone of a sensor with respect to the bearing ...
1
vote
1answer
91 views

undetected colission

I'm doing a simple grid based game, where the player should only be able to move on the grey cells. It works quite ok, but in this simple scenario, the player is able to walk through Wall(1), although ...
0
votes
1answer
131 views

Draw/“rasterize” irregular circle onto a 2D grid

I'm using the midpoint circle algorithm to choose cells on a 2D grid which outline a circle. However, I need to incorporate some random noise so that I get an irregular circle, and this method won't ...
0
votes
1answer
39 views

Determining and Re-Considering Trapped Targets when Path-finding

I have a game that has multiple path-finding agents (A*) with a grid based map. The player can change the map by constructing walls, floors etc. and the agents will move to construct what the player ...
4
votes
2answers
247 views

Split a grid into random paths

I need an algorithm to split a grid into randomly generated paths where: A path is a list of cells connected at most to two adjacent cells. Paths have a minimum and maximum length. All cells in the ...
0
votes
1answer
535 views

How do I make a 2D World Political map in unreal engine 4?

Can someone explain the basics of making a 2D World map in unreal engine 4 (e.g. similar to the ones used in Plague inc., age of civilizations, etc.) I've seen it being done in unity, but couldn't ...
3
votes
0answers
97 views

Is there an algorithm to construct lines (sets of grid points which are all connected) from an unsorted set of grid points?

I have a 2d square grid used for pathfinding that I wish to convert into a navigation mesh. My idea is to pluck out all of the nodes that are on the edge of walkable space, simplify the amount of ...
0
votes
1answer
49 views

Limit the grid fill

I'm doing some grid snapping and I wanted to fill out my grid on the gameObject surface. However I can't figure out the math on how to limit the grid fill. Here's the snippet: ...
1
vote
1answer
259 views

How to make Flood fill algorithm return different Lists of separate groups in the grid?

So i have this flood fill method : ...
2
votes
0answers
100 views

Magnitude of a vector in Generalized Balanced Ternary?

Generalized Balanced Ternary is a fairly obscure but very elegant method of indexing a hex grid, using only a single integer coordinate. Operations like addition and multiplication on these ...
2
votes
1answer
324 views

Voxel traversal intersection float position

I have a 3D grid of cubes, and using the algorithm from this paper http://www.cs.yorku.ca/~amana/research/grid.pdf I've been able to get the integer coordinates of the first tile intersected by a ...
1
vote
0answers
149 views

Create styled grid with phaserJS gaming framework

I am new to Phaser and this is my first game with Phaser gaming framework. Am trying to find the right way of coding a grid what you see in below image In some articles is being suggested to code it ...
1
vote
2answers
282 views

Can I change the tile size of a 2D isometric game in the middle of development?

First things first: This is just a side project. It's going to be my first "real" game. In real life I'm a full time web developer (ASP.Net) with several years of experience. I also have some basic ...
1
vote
2answers
64 views

Find points inside a closed area

I have a 2D rectangular grid (100x100) with 3 types of cell (Empty, Base and Outline). I need to find cells inside the territory formed by Base and Outline cells. For example, in this scheme: I need ...
1
vote
1answer
79 views

Calculate the distance/number of moves one square is from another

Say I have a 9x7 grid (could be any size) I want to be able to calculate the distance any square is from another. In the image I have selected 5,4 is my target square. Now square (1,2) is 4 moves away ...
0
votes
0answers
37 views

Drawing a possible movement area in a tiled map [duplicate]

I've been developing what's meant to be my first of many Game Maker projects, and here's my biggest problem until now: I'm trying to draw a grid depending on the "move" variable from a unit (the ...
-1
votes
2answers
453 views

How do I fake 3d?

I'm trying to make a first person, pseudo-3D game similar to those of the '80s, where you walk around on a grid, and where all the walls can be the same height. Generally speaking, how would I create ...
0
votes
1answer
1k views

2D collision detection for a block game

Background Knowledge: The player can be freely transformed around the screen but each block is locked to a grid. This grid is 16x16 pixels and the players bounding box is 20x44 pixels. The blocks are ...
0
votes
1answer
707 views

Calculate position on Isometric grid

I created the following tile grid in unity3d: The blue dot is the absolute center point (0,0) of both scene space and tile map. Now I am trying to calculate the X/Y position of points on the tile ...
0
votes
0answers
249 views

How to draw grids on a sphere?

What is the common method for drawing grids on a sphere in DirectX, as it was done in a map of the globe. The following problems are concerned. How to draw grid lines? Grid lines, the longitudinal ...
0
votes
0answers
161 views

Calculating voronoi sites with a 2D grid

I've been diving deeper into voronoi cells for use in a 2D game. There's a lot out there that explains the concept and describes how to calculate them but I'm failing to grasp how best to apply them ...
0
votes
1answer
1k views

2d Grid Generation (Unity C#)

I am creating a simple program in Unity C# that will generate a 2d grid using a 2d sprite prefab. I am stuck here, I don't know what to do. When ran, I receive an error. ...
0
votes
1answer
121 views

Issues with 3dsmax and Unity3d scale

I changed the units in Blender so they are identical to Unity 3d. If I make a 1m^3 box in Blender, it will import into unity as exactly the same size as the standard cube. With 3ds max, I changed ...
1
vote
1answer
317 views

Unity - Texture on Plane fades at angle - Generating mipmaps?

Good day, I seem to have run into a problem which I can't find an answer to. I'm making a World Editor for my project, and generating a grid plane which the user can modify. Whenever I rotate the ...
0
votes
0answers
42 views

Find required entities to accomplish specific task in shortest time

I have a grid like map with entities that can perform turn-based actions like moving or growing strength. When I have a task that requires a certain strength, I want to find the entities required to ...
0
votes
1answer
82 views

Simultaneous line of sight for hundreds of individual agents on a grid?

I have a large grid with hundreds of individual agents, each of which is moving around based on its own visual inputs and a fast control algorithm. My question is: How can I efficiently provide each ...
0
votes
1answer
113 views

How do I determine if a tiled shape is closed, but without checking diagonal connections?

This is a follow-up to a similar question Determine if a set of tiles on a grid forms an enclosed shape. My needs are similar, but I do not need to check diagonal connections. I am also using Unity. ...
5
votes
2answers
645 views

How to join two cubes?

If I want to make a character (in Blender) made of cubes, to export it to unity later, should I leave these cubes and all the other body parts as separate objects, or join them all into one mesh? And,...
2
votes
1answer
254 views

Infinite space 2d map - how to implement in js

Im not exactly sure how to implement this in JS. So I want to have a 2d infinite map, but not tiled. The coordinates are there only so that if you are travelling around space you know in what ...
2
votes
2answers
71 views

Picking cells which form a completed line between to 2d grid cells

I'm using Bresenham's line algorithm to calculate a "line" of cells between a start and end point on a 2D tile grid. However, I'm using this during terrain generation to create a visible pathway, ...
0
votes
2answers
249 views

Collision handling for grid based games and simulations

I'm trying to implement a grid based game where there are many creatures moving in the grid from square to square. I'm having a hard time handling collision with creatures in the grid (multiple ...
7
votes
2answers
940 views

Mesh generation for procedural city generator

I have a programming problem relating to mesh generation for city grids. I've recently created a city grid generator and I've come as far as being able to reliably generate the road mesh for the grid ...
0
votes
1answer
45 views

Unity strange clones behavior

I am setting up a grid of tiles (2d sprites) in Unity with this code: ...
1
vote
0answers
164 views

Advice on mapping tiles to a height map/3D world

I've been attempting to think of a way to map tiles to a height map. Where a grid can be either layered or integrated into the world data. However, since I am not using voxels I could use some advice ...
1
vote
0answers
373 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 ...