Stack Exchange Network

Stack Exchange network consists of 175 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.

0
votes
0answers
42 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: ...
0
votes
0answers
16 views

Aligning a sprite with a tilemap

I'm trying to create a hybrid system for my Unity game. I want to use tilemap for collision and use sprites for the world. I drew a sprite onto a 40x40 checkerboard grid as can be seen here. I wanted ...
0
votes
0answers
35 views

How do I do collision detection in a 2d game using a tile grid but which also has pixel by pixel camera and character movements?

So I've been at this for weeks now and every solution I programmed did not work. I am using Free Pascal and SDL2. So I programmed a 2d game which uses a two-dimensional array which contains the tile ...
1
vote
1answer
38 views

Multi-level 3D grid based pathfinding in Unity

I'm trying to come up with a way to pathfind on multiple levels. See image: The orange walls would be considered a ladder, connecting you to the upper levels. At first I thought of looking at it as ...
2
votes
1answer
52 views

(SFML) Moving in one direction a time

so i've been making a pathfinder on a grid. I've succesfuly implemented the A* algorithm so the next step is making the AI follow a path. I got it to move to the desired destination but the thing is ...
1
vote
1answer
64 views

Finding a path with minimal number of turns on a grid?

There is a path, generated by my implementation of A*, where diagonals aren't allowed, and the heuristics is the Manhattan distance. Is there a way to always or nearly always find a path with the ...
0
votes
0answers
16 views

I Can't spawn buttons in my Grid. why?

Today i was following a tutorial about making a shop, but i got a problem. and i've followed the scripting tutorial, but it seems i can't spawn a button inside the grid when i pressed GetItemButton. ...
0
votes
0answers
102 views

AI movement in a tile based game

I've been tryin to make My AI follow my A* path in grid. the problem is that is goes off course and doesn't move along the path very well. currently got it to move only left and up. how I intended ...
0
votes
1answer
49 views

Getting Position of a Player in a grid

So I am making a pacman-like game. the game has tiles/grid. I keep the node data in a struct: ...
1
vote
1answer
85 views

Redundant checks from spatial partitioning

A simple 2D grid partition system for collision detection divides space into equal-sized tiles. Colliders then map themselves to tiles with their bounding box in O(1) time. Collision detection only ...
2
votes
2answers
275 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
86 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
91 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
486 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
65 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
100 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
89 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
41 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
73 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
181 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
257 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
105 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
61 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
348 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
739 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
86 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
93 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
141 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
44 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
299 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
634 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
110 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
52 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
335 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
113 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
400 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
156 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
344 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
70 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
83 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
2answers
525 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
2k 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
861 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
169 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
2k 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
145 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
371 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
83 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
116 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. ...