Support Forum

Problem identifying Paths and is there an alternative to PathID?

I use over 100k entities and would like to store completed paths in an array using their PathID as the index. In my entire system, the index identifies the entity. (and I’m probably not alone). Unfortunately the Path ID is limited to a ushort which makes everything complicated.

A few questions:

  • Why not a uint?, would you consider making the change?
  • Is there a way to set the ID ourselves?
  • Is it possible to reset the pathID to 0 manually instead of waiting for it to roll over?
  • Is there any other way to identify a path, like a custom value we can set?

Using a uint instead and being able to reset the path ID to zero ourselves would make things easier when using Astar with the job system and ECS. But Ideally, it would be better to just be able to set the ID ourselves. So we can just “TAG” the path using the entity’s ID (aka index).

Hi

It’s an ushort because every node needs to store this index as part of the pathfinding process. If you have a million nodes, the difference between 2 or 4 bytes per node is significant.
You can easily create your own ID using something like:

int id = generateID();
ABPath.Construct(start, end, (path) => OnPathComplete(path, id));

Wow, I didn’t know you could override a delegate’s parameters like that, I’m not very familiar with that usage of lambda expressions. (if that’s what it is)

Thank you!