Questions tagged [grid]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
35 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 ...
Maya Rahto's user avatar
2 votes
2 answers
206 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 ...
Jamek's user avatar
  • 21
1 vote
1 answer
68 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 ...
anathrax's user avatar
1 vote
0 answers
69 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 ...
Zekfad's user avatar
  • 11
0 votes
0 answers
88 views

Convert legacy OpenGL script to a newer one

I have a script drawing 3D chart, three axes and a surface. Unfortunately, it was implemented using old OpenGL approach with Begin and ...
Anonymous's user avatar
  • 111
0 votes
0 answers
36 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 ...
James's user avatar
  • 1
0 votes
1 answer
45 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. ...
bibrosko's user avatar
0 votes
1 answer
194 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 ...
ireece1's user avatar
2 votes
1 answer
2k 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 ...
idbrii's user avatar
  • 798
0 votes
2 answers
97 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 ...
user46346's user avatar
  • 101
1 vote
0 answers
367 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 ...
Jamelaumn's user avatar
4 votes
1 answer
465 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 ...
ArtemiZ Studio's user avatar
0 votes
1 answer
1k 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 ...
Silz's user avatar
  • 37
0 votes
3 answers
457 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 ...
Robin's user avatar
  • 3
1 vote
0 answers
113 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 ...
genfy's user avatar
  • 43
0 votes
0 answers
349 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. ...
clwhisk's user avatar
  • 101
1 vote
1 answer
136 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 ...
lowercasename's user avatar
1 vote
1 answer
342 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 ...
Alexander Hristov's user avatar
0 votes
1 answer
598 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 ...
Krythic's user avatar
  • 790
0 votes
1 answer
1k 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 ...
Evg's user avatar
  • 3
0 votes
2 answers
281 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 ...
peacetype's user avatar
  • 145
1 vote
4 answers
2k 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 ...
Samuel Slade's user avatar
0 votes
1 answer
197 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 ...
TheBroodian's user avatar
2 votes
1 answer
315 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 ...
Jason Meulenhoff's user avatar
0 votes
1 answer
77 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: ...
thzoid's user avatar
  • 3
1 vote
0 answers
223 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 ...
trshmanx's user avatar
  • 171
2 votes
2 answers
178 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 ...
imad's user avatar
  • 21
0 votes
1 answer
161 views

Connecting rooms after BSP

...
GoldCredential's user avatar
2 votes
1 answer
123 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 ...
dgan's user avatar
  • 131
0 votes
0 answers
42 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 ...
Apoleytaa's user avatar
0 votes
1 answer
633 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: (...
caleidon's user avatar
  • 561
2 votes
1 answer
6k views

How does HPA*(Hierarchical Pathfinding A*) really work?

I'm currently researching for a summary paper on the different variants of A* search algorithm and how they are used in games and I stumbled across the name HPA*. I've heard that it's much more faster ...
Ixion Chowdhury's user avatar
0 votes
0 answers
312 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 ...
David Zaslavsky's user avatar
1 vote
1 answer
89 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' ...
Victor's user avatar
  • 13
4 votes
3 answers
354 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 ...
Weckar E.'s user avatar
  • 822
0 votes
1 answer
65 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 <...
caleidon's user avatar
  • 561
0 votes
0 answers
24 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 ...
user1022585's user avatar
0 votes
1 answer
391 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 ...
IanLarson's user avatar
  • 771
4 votes
0 answers
390 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 ...
user3755567's user avatar
3 votes
3 answers
155 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 ...
Alex's user avatar
  • 33
4 votes
1 answer
910 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#...
Ainsley Harriott's user avatar
0 votes
1 answer
594 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-...
Kennichi Nitta's user avatar
2 votes
1 answer
1k 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 ...
Oro Portaluri's user avatar
0 votes
1 answer
67 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 ...
Frame Matt's user avatar
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 ...
Rutger's user avatar
  • 140
0 votes
2 answers
171 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 ...
Lazlo's user avatar
  • 133
0 votes
0 answers
111 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) ...
Shunkashuu's user avatar
2 votes
3 answers
2k views

What is the "Unity" way to approach tech design for a 2D game like this?

So I come from C++ land where I've always done every little thing myself. Now I'm getting into Unity and C# and I'm ironically overwhelmed with the domain. I'm starting off with this simple little 2D ...
Josh Sanders's user avatar
0 votes
1 answer
1k views

Canvas not scaling to screen size

So I have a very simple scene set up with just a camera, a game object called TestGrid with a grid script, and then a canvas. I have a TextMeshPro prefab that I instantiate to fill the 10 x 20 grid ...
Josh Sanders's user avatar
0 votes
0 answers
23 views

Pathfinding for a destination that is more than 1 tile [duplicate]

I have a 2d grid, and there are situations where the player selects the 3d model of an exit (like a gate) so they could leave, but in reality, the exit is comprised of multiple tiles in the grid: In ...
Anomalous Underdog's user avatar

1
2 3 4 5 6