Support Forum

Using Multiple tags for nodes

What I want:

What I want to know:

  • I know you don’t support multiple tags for nodes.
  • I have read past questions about using big-mask for this gets work.
  • I know maybe I could make my own TraversalProvider for this. (Can you have multiple tags on a node? - #4 by pakfront)
    Q1: So how can I actually put ‘multiple tags’ into nodes with ‘GraphUpdateScene’? Which line should I fix? Do I need to fix ‘GraphUpdateScene’?
    Q2. Or can you tell me another way to achieve what I want? I just need the way to “Make one node has multiple attributes” basically. (e.g make node as ‘walkable’ and ‘swimmable’ at the same time.)

Hi

Yes, multiple tags are not supported.
You can fake multiple tags within the existing system though. Essentially this consists of treating current 32 tags (5 bits) as 5 separate tags that can be combined.
So tag 0 (binary 00000) would be no tags.
Tag value 1 (binary 00001) would be tag 1.
Tag value 2 (binary 00010) would be tag 2.
Tag value 3 (binary 00011) would be tag 1 and tag 2.
and so on.

If you only need 5 tags, this could definitely be a way to go. Even though it is also a bit awkward to use.

You can also use an ITraversalProvider to get any behavior you want. You’d have to store your node attributes somewhere else (the simplest, but maybe not the most performant, would be a Dictionary<GraphNode, int>). See Documentation

Q1: Depends on what solution you go for. The relevant code that modifies the tags can be found in astarclasses.cs in the GraphUpdateObject.Apply method.