# Questions tagged [path-finding]

Methods used to map out a path of travel from one point to another, typically avoiding obstacles in the way.

722 questions
Filter by
Sorted by
Tagged with
1 vote
58 views

### A-star algorithm after 2D tilemap 90-degree rotation

I am learing Unity and for now trying to implement a simply pathfinding alogorithm in a simply 2D isometric diamond-shaped tilemap. Recently I learned a way how to rotate tilemap and I already have a ...
• 13
65 views

### How to delete unnecessary points given a jointed path

I'm writing code for client-side pathfinding, the player can setup more than one point and then pathfinding in segments finally get a concatenated path.(actually it's for the long distance pathfinding,...
501 views

### In a tile based game, with units that can move a specific amount per turn, how do i make my pathfinding avoid damage unless it is the only valid path?

i am making a 3d tactics game, visually similar to something like final fantasy tactics. it's tile based, with units able to move up and down the level onto buildings and up staircases and what have ...
44 views

### I'm trying to find a way to iterate through a list of game objects to find furthest object in the list. Then re iterate if path is blocked

I've got the first part of the code working. It iterates and does a check through the gameobjects to find the furthest nav point to hit. Then it calculates path to see if its valid or not. Now I'm ...
68 views

### Find the best attack position

I'm doing what this thread is doing except that it's not very satisfactory. What this does is finding the "closest" attacking position. But typically you want the attacker to attack from as ...
1 vote
136 views

### Funnel algorithm : not possible with all convex polygons?

Disclaimer : yes, the whole map is not convex. But all of its subdivisions are ! (And that's what matters) Hi ! I got A* working with nav mesh. Now I need to find the tightest path along the mesh path....
50 views

### Grid-Based pathfinding with object size. Avoid colliding into big-enough spaces

I already implemented a Grid-Based pathfinding algorithm and I works. I also updated it so it takes into account the objects size and ignores paths where the object wont fit. However, I ran into a ...
142 views

### How to make ranged RTS units move to their firing range from an opponent using flow fields?

I am trying to make a simple real-time strategy game (only the battle system of units fighting each other; no building, no economy, only battles and victory). I am using flow fields to make the units ...
128 views

### Obstacle avoidance via steering behaviour when near gaps

I'm trying to implement RTS-like character control on C++/SDL2 for a character with a rectangular hitbox. I have a path-finding algorithm ready and I want to implement obstacle avoidance steering ...
• 11
1 vote
557 views

### Generate a fully 3D NavigationRegion/pathfinding in Godot 4

I'm making a spaceship game where the enemies and the player have the full 6 degrees of freedom, so can move forward/backwards, left/right, up/down and can also rotate in all three axes. I'm wanting ...
• 127
93 views

### A* implementation does not work correctly

I'm trying to implement a 3D pathfinding system based on the A* algorithm. This tutorial served as the starting point for my implementation. I tried to remake it for pathfinding in three dimensions, ...
• 11
57 views

### How to apply avoidance to path following with root motion?

My Character Blueprint uses Root Motion to control locomotion (taking location and turning it into a direction to move). However, root motion is not compatible with avoidance pathfinding such as ...
• 141
352 views

### Navigation in a TileMap with 2 types of tile in 1 cell in Godot4

I'm stuck with the navigation in a TileMap based scenario in Godot 4. My intention is to make the enemy (boats) to chase the player while avoiding procedurally ...
• 376
660 views

### CharacterBody3D gravity isn't working, and player won't touch the floor

I'm trying to create an isometric game with Diablo-like control, but gravity isn't working. The CharacterBody3D won't touch the floor, the print(is_on_floor()) always results false. Here's my code for ...
1 vote
863 views

### How to deal with large number of Navmesh Agents?

I have more than 200 units in a single scene, all of them use Unity's NavmeshAgent to set their destinations to the main target. The problem I'm facing is that some ...
72 views

### A*Pathfinding generating wrong path

I'm building a maze game where there's an enemy ready to pursuit the player if the player gets in his range, I'm using A*Pathfinding algorithm to do so, and I build the maze in a procedural way, where ...
167 views

### Weighting navigation mesh nodes for A*

I'm trying to implement path finding for my game using a navigation mesh and A* search. While I believe I got this working correctly I'm having trouble getting desired results because I don't know how ...
412 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
102 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 ...
• 43
83 views

### AStar taking care of collisions for a rectangle

How can I explore a path with A* (or another) by taking care of a rectangle collision ? I have a 2d map, where I know for each coordinate if it is an obstacle : For example, dark tiles are not ...
• 147
178 views

### Implementing a bot to find the player in a grid

I have a 2d array with ground represented by 0s and the walls represented by 1s. Player can use a LOOK command or a MOVE command. Look command returns a 5x5 array centered around the player and the ...
493 views

### Defining path for tower defense game

I'm currently developing a tower defense game as a part of a group project in school. This game will be programmed in C++ using SFML. We are having trouble with finding a good way to define the path ...
1 vote
2k views

### Creating a nav mesh

I'm coding a custom engine using Python and Pygame. It's a top down 2D isometric RTS and I wan't to implement pathfinding for my units. My research has lead me to using a Navigation mesh which seems ...
77 views

### Connecting nodes for A* algorithm

I am currently working on implementing a pathfinding module for my 2D game engine that I am writing in Python using Pygame. Currently there are objects such as trees or buildings which can be placed ...
522 views

I'm trying to add a click to move feature in my game using the new NavigationAgent2D and NavigationPolygonInstance but sometimes when the player reaches the end of the navigation path or changes ...
654 views

### Making Multiple NavMesh agents go to different destinations in unity

I am trying to make an Rts game in unity and am trying to make it so that units can go to different destinations, I have a selection system that deactivates their Navmesh agents and the script that ...
4k views

### How can I shorten the length of time spent on finding a path using my A* pathfinding code?

I am working on a game where the player and enemies move between discreet tiles, with only orthagonal movement (like pokemon). The game also runs on a turn system, so the player makes a move input, ...
• 117
163 views

### How do buildings in (Tile based) city builders/colony sims keep track of each other? [duplicate]

Like, how does a building in these games know if they're being powered? Or if they're within range of influence of a hospital or fire station, etc. How would they know where to send an NPC or ...
1 vote
109 views

### Dynamically generating and modifying non-Euclidean/Tardis houses while maintaining AI navigability

General Description I want to build a tech demo about a game concept I am carrying around for quite some time now. A lot of influences from different sources shaped this, and I will try to hint on its ...
2k views

### Maintaining unit formation while following path

I'm currently working on a 2D Age of Empires style RTS game. Here's my problem: I'm currently using the A* algorithm (via Path finding package) to move my units. When you select a "group" of ...
343 views

### What's the best strategy for incorporating jumps into a 3D AI navigation algorithm?

I'm trying to make a game centered around chase sequences in a 3D level with a high degree of verticality and movement options for the player. Basically think Breath of the Wild in an urban landscape ...
400 views

### Pathfinding over network and local avoidance

I'm trying to build a little MOBA game (max 10 players) in Unity and i'm really stuck with the pathfinding / local avoidance. Here is what i'm doing when user click to move on the map: Client send a ...
• 309
176 views

### Pathfinding sprite disappears when approaching the player in Unity

I'm trying to make AI for enemies in my game. I applied a pathfinding (A*) script to my enemy sprite, after which the sprite began to follow the player. But when the enemy approaches the player, the ...
278 views

### Struggling with breadth first search for hex grid

I cant seem to get breadth first search right. Ive gone through redblobs implementation guides of hex grids and have that all figured out but pathfinding is proving to be difficult. So I have a search ...
• 103
1 vote
144 views

### How to identify if entrace to HPA* cluster is faulty?

I have been working on my simple game where enemy would hunt me with A* algo. But it was a bit slow so I found this thing called HPA*. Someone who would decide to help me will probably know how it ...
156 views

### Best Pathfinding solution for 2D action-platformer

I'm developing a 2D action RPG with heavy platforming. The combat system and movement take inspiration from Hollow Knight and the Smash Bros saga. I would like to have some type of enemies with really ...
219 views

### Generating a tilemap and A* grid in unity but they aren't updating correctly

So question is: Why is the unity editor behaving this way (not updating the tilemaps until I go though the scene and click on them) and why is A* not generating the proper grid when Scan() is called ...
• 153
301 views

### Pathfinding on the surface with Marching cubes

I'm making a game where the world is made of 3D density field of Voxels. And I use Marching Cubes to create a mesh using the Voxels. It needs to be fast because You can modify terrain a lot.
180 views

### How to calculate distance for A* when searching a path on navmesh?

I've read a couple of articles on Navmesh+A* navigation. So, I'm trying to implement a pathfinding for an RTS type of game. However, it seems I don't understand how to calculate a distance for A* when ...
50 views

### Help with Flight Path Modeling

I am looking for some input on how to realize a feature I would like to build into my game. (Not technical implementation, just what kind of mathematical models or algorithms would fit my situation ...
1 vote
246 views

### A* Pathfinding with 2x2 player or larger [duplicate]

I am very familiar with A* and is able to make it work well. However I am looking for resources describing how to do find a path with a player size of 2x2 instead of the usual 1x1 on a 2d map. So for ...
• 11
1k views

### How would I actually implement A* pathfinding in a 3D world?

I have been trying to implement pathfinding in Minecraft for a while. Everything is in blocks, so this shouldn't be too difficult. I have gone through a lot of different posts and articles but I haven'...
• 75
30 views

### How to handle collisions for short obstacles across a range of scales?

A naive collision system in 3D RPGs can lead to mobs getting stuck on geometry that they would realistically step over and can be a major nuisance to many players. For most games, the solution is ...
1 vote
493 views

### Which AI should I use so as to avoid monsters AND chase bonus pills at the same time?

I'm trying to program an AI for a Pac-Man-like game, where I would be the Pac-Man and move according to two simple rules: move towards bonuses avoid monsters and being killed I read that one can ...
• 111
1 vote
3k views

### Java Simple 2D Grid Pathfinding

I want to code some basic pathfinding for my bot in Java. Below is a 2D grid representation of the 3D world. 0s being the places you can go, and 1s being the places that you cannot go. ...
• 75
146 views

### Find Largest Room in 2d World

I'm currently working on a generated(Perlin Noise) 2D Cave System with Unity. The Caves currently look like this: What I want to do is spawn the Player (and other stuff) in the big Part of the Cave ...
• 75
496 views

### How would I incorporate gravity and gravity affecting obstacles into A* pathfinding in a 2d side-scrolling game?

I want to be able to modify the A* pathfinding in a way that I can get my NPC from his current position to any point that's within reach. The tricky part is that this takes place in a side-scrolling ...
• 1
38 views

### Finding a path to a circular zone in continuous space [duplicate]

I need to find the shortest path for an agent that wants to use a ranged attack against the specified target. This means that the path's ending point should be inside the range of the attack and have ...
• 121
1 vote