path-finding

Path-finding in 2D space

时间秒杀一切 提交于 2020-04-18 05:37:09
问题 I am creating a game where I want an enemy to path track onto the player - who can move in any direction on the 2D plane. At first, I tried... self.bat_x += (player_rect.centerx - self.rect.centerx) / 60 self.bat_y += (player_rect.centery - self.rect.centery) / 60 Here the path-tracking works fine. I divide each value by 60 so that the enemy doesn't just appear and stick on to my player / to slow the movement of the enemy down. However, the further away the enemy is, the faster it is. The

Pathfinding through four dimensional data

北城以北 提交于 2020-04-11 05:23:06
问题 The problem is finding an optimal route for a plane through four dimensional winds (winds at differing heights and that change as you travel (predicative wind model)). I've used the traditional A* search algorithm and hacked it to get it to work in 3 dimensions and with wind vectors. It works in a lot the cases but is extremely slow (im dealing with huge amounts of data nodes) and doesnt work for some edge cases. I feel like I've got it working "well" but its feels very hacked together. Is

Updating Shortest path distances matrix if one edge weight is decreased

本小妞迷上赌 提交于 2020-01-23 08:17:05
问题 We are given a weighed graph G and its Shortest path distance's matrix delta. So that delta(i,j) denotes the weight of shortest path from i to j (i and j are two vertexes of the graph). delta is initially given containing the value of the shortest paths. Suddenly weight of edge E is decreased from W to W'. How to update delta(i,j) in O(n^2)? (n=number of vertexes of graph) The problem is NOT computing all-pair shortest paths again which has the best O(n^3) complexity. the problem is UPDATING

Pathfinding for 2D tile map for multiple goals

爱⌒轻易说出口 提交于 2020-01-13 06:46:11
问题 I'm trying to create a simple grid-based game in C++. The pathfinding is necessary part of it. I've been searching, but there isn't what I am exactly looking for. The rules are simple. There is a map. The size generally doesn't exceed 100 x 100 tiles. 1 is a floor tile, 0 is a wall. Diagonal movement isn't allowed, so there are only 4 directions from each grid. However there are mostly more than one goal. I'd like to find the way to nearest one. Remember that we can't just calculate, which

Pathfinding in 2D Arrays

半城伤御伤魂 提交于 2020-01-04 06:08:11
问题 Let's say I have this 2D Array map { 0,0,0,0,7,1,1,1,1,1,1,1,1 }, { 0,7,7,7,7,1,1,1,24,1,1,1,1 }, { 0,7,24,24,24,24,24,24,24,1,1,3,1 }, { 0,7,23,23,23,23,23,23,24,1,1,3,1 }, { 0,7,24,23,23,23,23,23,23,1,1,1,1 }, { 0,7,24,23,23,23,23,23,23,1,1,1,1 }, { 0,7,23,23,23,23,23,23,24,1,3,1,1 }, { 0,7,24,24,24,24,24,24,24,1,3,1,1 }, { 0,0,0,0,1,1,1,1,1,1,1,1,1 }, and I have HashSet full of Integers that define blocked tiles. What would be a good way so that when I click on one part of the map from

Pathfinding in 2D Arrays

[亡魂溺海] 提交于 2020-01-04 06:08:05
问题 Let's say I have this 2D Array map { 0,0,0,0,7,1,1,1,1,1,1,1,1 }, { 0,7,7,7,7,1,1,1,24,1,1,1,1 }, { 0,7,24,24,24,24,24,24,24,1,1,3,1 }, { 0,7,23,23,23,23,23,23,24,1,1,3,1 }, { 0,7,24,23,23,23,23,23,23,1,1,1,1 }, { 0,7,24,23,23,23,23,23,23,1,1,1,1 }, { 0,7,23,23,23,23,23,23,24,1,3,1,1 }, { 0,7,24,24,24,24,24,24,24,1,3,1,1 }, { 0,0,0,0,1,1,1,1,1,1,1,1,1 }, and I have HashSet full of Integers that define blocked tiles. What would be a good way so that when I click on one part of the map from

Pathfinding issues

安稳与你 提交于 2020-01-03 05:33:11
问题 Ok I am trying to make a dynamic pathing system so the player can move from point A to point B without having predefined paths. Note this game is all text based no graphics. The player can move in 10 directions: up, down, n, e, s, w, sw, se, nw and ne. The map of the entire world is in a database, each row of the database contains a room or a node, each room/node has directions it's capable of going. The room may not be sequential persay. An Example: Map Number, Room Number, Direction_N,

A* (A-star) implementation in AS3

时光怂恿深爱的人放手 提交于 2020-01-02 18:38:13
问题 I am putting together a project for a class that requires me to put AI in a top down Tactical Strategy game in Flash AS3. I decided that I would use a node based path finding approach because the game is based on a circular movement scheme. When a player moves a unit he essentially draws a series of line segments that connect that a player unit will follow along. I am trying to put together a similar operation for the AI units in our game by creating a list of nodes to traverse to a target

C++ A-star implementation — determining whether a node is already in the priority queue of open items

我的未来我决定 提交于 2020-01-02 14:05:52
问题 One step in the A* pathfinding algorithm requires searching the list of open nodes for the node you're currently interacting with, and adding that node to the list if it isn't already there, or updating its value and parent, if it's present but with a higher weight than the current version of the node. These behaviors aren't supported in the STL priority_queue structure. How should I implement that step? Updates since this question is getting a lot of views: std::priority_queue may look like

C++ A-star implementation — determining whether a node is already in the priority queue of open items

﹥>﹥吖頭↗ 提交于 2020-01-02 14:05:22
问题 One step in the A* pathfinding algorithm requires searching the list of open nodes for the node you're currently interacting with, and adding that node to the list if it isn't already there, or updating its value and parent, if it's present but with a higher weight than the current version of the node. These behaviors aren't supported in the STL priority_queue structure. How should I implement that step? Updates since this question is getting a lot of views: std::priority_queue may look like