Questions tagged [grid]
A regular tessellation of a surface to create uniform, contiguous cells arranged in a consistent pattern.
289 questions
0
votes
0
answers
128
views
Determining whether two points in 3D space fall along one another's line of sight
I have a three-dimensional surface represented by a 3D grid of cells. This 3D grid of cells is in turn represented by a 3D matrix, whose entries are nonzero if a cell corresponds to a "surface ...
2
votes
1
answer
202
views
How to adapt the Anya any-angle pathfinding algorithm to handle non-discrete start/target positions?
Recently, I have been investigating the Anya pathfinding algorithm.
Anya is an optimal any-angle pathfinding algorithm.
However, it works only with discrete points on the grid.
Here is an excerpt from ...
0
votes
1
answer
130
views
Help designing a grid builder system with incremental placement
I am currently designing a grid building system for a game and am trying to implement the ability to place objects at different increments (if the grid cells are spaced one unit apart by default, then ...
1
vote
1
answer
199
views
How to rotate a 3d grid?
I have a spatial hashing grid that's mapped out like
...
0
votes
0
answers
80
views
Rotation inside MeshInstance3D surface plane
I'm trying to make a representation of a plane that rotates around a hole in a MeshInstance3D.
So far I've managed to make the circle's hole, but I can't make the ...
2
votes
2
answers
282
views
Identify doorways to partition a collection of walls with gaps into rooms
I am looking for an algorithm that can find separate rooms inside a set of walls, by determining which openings should be considered doorways between adjacent rooms. All is defined on a grid. My main ...
1
vote
1
answer
109
views
Selecting Tiles Correctly With Scroll
I would like to understand the process of selecting the correct tile from a scaled Surface when I have information about the number of tiles on the x and y axes, the length of the Surface, and also ...
1
vote
0
answers
110
views
2D grid game server - interaction system/dynamic blocks
I'm building a Server-side engine for 2D sandbox game similar to Terraria or Starbound.
The language I use is Dart (similar to JavaScript or C#).
Currently I'm trying to figure out how to make a good ...
0
votes
0
answers
38
views
Character is stuck between grid cell gap [duplicate]
I started making a D&D-style turn based tactic game. I have a problem with my tilemap.
I made a script to find the location on the tilemap for my character and for the tile I clicked with the ...
0
votes
1
answer
72
views
How can i keep a constant grid position relative to transform.ChildCount
I need to manage the index positions in a GridLayoutGroup and keep it consistent with the childCount of the group it belongs to.
...
0
votes
1
answer
450
views
Rendering Infinite 2D chunks?
I'm working on a top-down 2D RTS with C++ and SDL2, and have implemented the biome/terrain generation, tile rendering and a rudimentary camera system. I already have the skeleton code in place that ...
4
votes
1
answer
5k
views
How do I place objects so they snap to my TileMap in Godot?
When I'm placing objects on tiles in my TileMap, they snap to positions that aren't on my tile's grid. I drag my object to the middle of the grid square, but it keeps snapping to the corners.
I'm ...
0
votes
2
answers
195
views
How to calculate shadow position below arcing projectile in Isometric 2d tilebased grid?
I have an Isometric 2D grid-based tilemap, and am firing a projectile (at Vector P1 in image below) from the player (at Vector A) to a location "above" a target location (at Vector B). This ...
1
vote
0
answers
807
views
grid(tetris) inventory system
I'm trying to adapt my current inventory so that the items can occupy more than one slots (cells) like in this image:
Any idea that might help me? My inventory is an Image that has grid layout and ...
4
votes
1
answer
600
views
Find a encircliement in Hexagonal grid (optimization issue)
I have a hex grid of 10000 cells (100x100). The player can grab a cell next to one of his cells (borders). If the player has formed a ring after placing a cell, I want to get a list of cells that ...
0
votes
1
answer
2k
views
Unity best practices for 3D tilemap
I looked at the forums and found out that it is not recommended to use the terrain system for the mobile platform. So then I decided to have a single plane as a "terrain" with single ground ...
0
votes
3
answers
917
views
How to prevent the player from completely blocking the enemy paths in a tower defence game like Fieldrunners?
I am new to Unity and want to create a tower defence game like Fieldrunners.
I need help to create the grid placement area for the towers so that there is always a path for enemies to travel. I mean ...
1
vote
0
answers
205
views
What's the best way to store irregular areas of my map? (hierarchical pathfinding and grid segmentation)
This is for the development of a roguelike/management game.
I'm trying to implement HPA (hierarchical pathfinding with A*), and I've found a few good resources (suggestions appreciated) in the forms ...
0
votes
1
answer
1k
views
Which way to subdivide a hex grid?
Here are, it seems, two ways to draw a smaller grid of tiles from an initial hexagon:
On the left, we halve the side length \$s\$ and create most of the new tiles centered at the midpoint of sides. ...
1
vote
1
answer
198
views
How do I determine if a given grid coordinate is fully within a triangle?
I'm using Unity's Grid system, and I'm drawing triangles on the grid. Each triangle is recorded as a Vector2Int origin point and a ...
1
vote
1
answer
586
views
Holding "Shift" to lock mouse movements to a straight line?
I'm making a little program that's a bit like paint but instead of filling in pixels, it drops a block on mousebutton(0). I'm now trying to add a straight line ...
0
votes
1
answer
782
views
Unity Snap to grid not exact
I just noticed that unities snap-to-grid feature results in a strange behavior. The results are not precise. My geometry is comprised of 32x32 pieces. They appear to snap fine to the grid, but when I ...
0
votes
1
answer
2k
views
Unity tilemap WorldToCell returns floored world position
I have a tilemap that is filled with tiles by script. That works well so far.
Now my aim is to make the tiles interactable by making them clickable.
I achieved this by adding an EventSystem object ...
0
votes
2
answers
442
views
How to check multiple rings of tiles around a center tile on a 2D grid
In my game project I create the terrain programmatically by creating tiles on a 2D grid as the player moves around the game map. I have it working where I select the current tile and check all 8 ...
1
vote
4
answers
3k
views
How to handle Tilemap Collision with only the character's lower body, while the head is allowed to overlap tiles above?
I have just started working with Unity to simply learn how it works. I've been trying to get grid-based movement and collision with a tilemap working, and it's mostly there, but there's one bit that's ...
0
votes
1
answer
296
views
Given a 3D grid-based map system, how to find the middle point of an edge of the mesh of a tile on the grid
I have a grid-based map system. The grid is aligned to the X and Z axes. The tiles on said map are 3-dimensional, but flat, and can be located anywhere on the Y-axis.
If I need to get a Vector3 of ...
2
votes
1
answer
363
views
Grid: Spreading temperature
I'm trying to spread temperature values evenly across the grid (Room) but somehow it has a bias to the right side of the map. My basic math skills are non existent so i could use some help with the ...
0
votes
1
answer
185
views
Arranging points in a 2D grid so that successively added points approximate a square shape
So, I ran into a problem with placing points in a grid while always trying to fit them into a square. Here are some examples (the numbers represent the order of placement):
Placing 1 point:
...
1
vote
0
answers
317
views
How to use transvoxel cell cache with octree structure?
I have been implementing Transvoxel in to my Marching Cubes project in c++. The Transvoxel documentation and available code examples feature cell vertex reuse (caching) via indices. The main benefits ...
2
votes
2
answers
212
views
How to handle two player-programmed robots attempting to enter the same discrete grid cell in one game tick
I am making a game with discrete block positions (something like minecraft) where you can program robots with instructions to move around, the robots are the size of one block, and they can execute ...
0
votes
1
answer
255
views
2
votes
1
answer
177
views
Space out units to a grid pattern
So imagine an RTS game, with ~150 units all cramped together, just staying chill.
What I would like is to "space them out" so that they d form a grid. This is useful for example when a large ...
0
votes
0
answers
57
views
How to move object grid base continuously?
I want to move object continously when I press button just once grid to grid. When I press button to make object move to another direction, it should wait until object is right on the grid and ...
0
votes
1
answer
881
views
How to rotate multi-tile structure on grid?
I need to be able to place structures in my game that span multiple tiles and can also be rotated.
My idea on how to solve this would be to use 2D arrays that hold data about the structure.
EXAMPLE: (...
2
votes
2
answers
12k
views
How does HPA*(Hierarchical Pathfinding A*) really work?
I'm currently researching, for a summary paper, the different variants of A* search algorithm and how they are used in games.
I stumbled across the name HPA*. I've heard that it's much faster than ...
0
votes
0
answers
387
views
How do I highlight the squares adjacent to my player in a Isometric grid
I am making a grid base RPG (like Fire Emblem but isometric) but currently I'm stuck on the movement, mainly the UI (showing how far the player can move around the board).
Like the image below where ...
1
vote
1
answer
122
views
How to best simulate the space in a boxing game to account for footwork and angles?
When trying to prototype a (top-down, so far) boxing simulation I've run into a huge roadblock with trying to set the space in which the boxers will fight, because it's important for the fighters' ...
4
votes
3
answers
450
views
Elegantly transition from 4-grid to 6-grid and back
I find in general map creation that I prefer hex grids for natural environments, but square grids for interior and urban/constructed environments.
Is there a smooth or elegant way to transition ...
0
votes
1
answer
90
views
Select box-shape grid between two positions on tilemap
I want to be able to click and hold on a certain point and mark it as startPosition.
Then, while the mouse is held down and moved, mark that second position as <...
0
votes
0
answers
41
views
2d packing shapes in rooms
I'm not sure of the correct terms for this so having a hard time searching.
But I have a series of 2d top-down rooms made up of random grid sizes between say 5 and 10 on the x and y axis. Each room ...
0
votes
1
answer
620
views
How can I maintain a contiguous area when generating a tilemap using Wave Function Collapse?
I'm using Wave Function Collapse to generate a tilemap, and I'm trying to come up with a way to maintain a contiguous area during generation. As an example: ensuring all "walkable" tiles are ...
4
votes
0
answers
525
views
Flowfield pathfinding behind obstacles on symmetrical grid
I use Fast iterative method to create my flow field. However when an obstacle is on the same axis as the destination, the vectors behind the obstacle point directly to the destination and ignore the ...
3
votes
3
answers
212
views
Calculate min number of moves (no path involved)
I'm looking to implement an algorithm that will calculate the minimum number of moves based on the rules below.
Let's say that we have a grid (NxM), as exampled in the image below.
Each cell will be ...
4
votes
1
answer
2k
views
Supercover line algorithm from corners instead of the square's center?
I need to check whether a cell in a 2D grid is visible to the starting cell. I'm currently using amit's supercover line algorithm, this one https://www.redblobgames.com/grids/line-drawing.html#...
0
votes
1
answer
920
views
How do I determine the player's grid position?
My original method for doing this involved taking the player's position, dividing it by the grid cell size, and rounding the result. This works for most cases except when I move my player up above y-...
2
votes
1
answer
2k
views
Given a 2D array, how do I generate a random path of fixed length from a random point at length 0 to a random point at max length?
I'm trying to generate a random path on a 2D grid given that:
The width and height of the grid are given
The length of the path to generate is given
The path can't move "back"
The path ...
0
votes
1
answer
91
views
How to assign an index to different node clusters? (for pathfinding)
Hellow~
So for a bit of context: i'm currently working on a RTS (way above may league) which already has a level editor and a node grid which maps the terrain, i previously make a navigation system ...
11
votes
3
answers
2k
views
Ways to draw tracks on 4-connected grid
I'm working on a grid based puzzle game involving tracks, and I'm having trouble finding a nice way to have users draw those tracks on the grid in a way is easily understood. For simplicity I had the ...
0
votes
2
answers
236
views
Sliding movement on a grid
I'm trying to implement "sliding" movement on a simple grid, where the movement vector is continuous (floating point direction) but the grid is discrete (boolean blocked or open on integer ...
0
votes
0
answers
142
views
How to move a character from 1 to 3 squares on a grid?
I need to make a turn based game in js and jquery. The rules are :
The 2 characters, the 4 weapons and the 15 obstacles are randomly generated on a grid(made with HTML table and generated in a loop)
...