MatejSloboda / Dijkstra_map_for_Godot

MIT License
77 stars 13 forks source link

Does get_cost_map respect terrain types? #82

Closed verillious closed 3 years ago

verillious commented 3 years ago

Hey, I'm having some trouble applying terrain types to my map:

(I hope this is the right place to ask this sort of thing)

Here are the steps I'm taking, hopefully someone can let me know if I'm doing something wrong! 😆

  1. Create a map, and points for every x, y coordinate
  2. Connect each point to its neighbours with a weight of 1
  3. Recalculate map using the id of a point as the origin
  4. Access the map using get_cost_map

^This all works great

When I start assigning terrain types is when I get confused.

  1. Create a map, and points for every x, y coordinate
  2. Connect each point to its neighbours with a weight of 1
  3. Set every point to have a terrain type of 1
  4. Recalculate map using the id of a point as the origin, and passing the optional parameter: var optional_parameters={ "terrain_weights": {1: 0.5,}, }
  5. Access the map using get_cost_map

I would expect that every single value in the cost map should be half of the original but it's the same. Am I misunderstanding how the terrain weights work?

verillious commented 3 years ago

I rebuilt the library from the most recent version of the master branch and it's working as expected on OSX. (I was using the version available on the AssetLib 🤦 ). Maybe we can upload a more recent version? Thanks for the library btw, great stuff.

MatejSloboda commented 3 years ago

Hello! Yes, you've found a bug, that was apparently fixed in more recent versions. We will update the AssetLib in near future to avoid this issue.