Author Topic: CellGetNeighbours with max number of cells limit to optimize  (Read 211 times)

manofspirit

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Hi there,

First of all, thank you very much for TGS. Even though im using it since last few months but recently looked at all those path finding operations and i got to say im impressed with how many problems you have already solved for users like us and im even more loving it.

Now coming back to the feature request:

CellGetNeighbours has maxDistance which is great so you can get neihbours cells with lets say 5 distance or 10. In my case i need to get those cells which are available in closest range.

But in most cases when user has placed a lot of building then i have to do something like this
GetNeighbours with distance 5, if no cells found or not enough cells found then GetNeighbours with 10 distance and i keep increasing until i find free cells.

So ideally another parameter maxCells will solve this problem. So what i do is call GetNeighours with distance 25 and maxCells 10 so whenever 10 available cells are collected function returns without reaching the whole 25 distance. This way i dont have to do extra traversing.

Thanks

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 5137
    • View Profile
Re: CellGetNeighbours with max number of cells limit to optimize
« Reply #1 on: August 17, 2019, 10:22:47 AM »
A parameter "maxResultsCount" can be added. It doesn't matter if those results are scattered within the range? I mean they could not be adjacent to each other.

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 5137
    • View Profile
Re: CellGetNeighbours with max number of cells limit to optimize
« Reply #2 on: August 17, 2019, 10:50:51 AM »
Added maxResultsCount parameter to one of the CellGetNeighbours overload.

manofspirit

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Re: CellGetNeighbours with max number of cells limit to optimize
« Reply #3 on: August 17, 2019, 12:22:19 PM »
Thanks :)