Problem with tag assignment


#1

Hi,

When I try to assign the tag value 34 (32 +2) to my node, the get value is not the same as the set value.
I get 2.

Any help ?

Thks


#2

Hi

The package only supports 32 tags.

If you really need more of them you could make a change to GraphNode.cs, change the property that looks like

/** Node tag.
 * \see \ref tags
 */
public uint Tag {
	get {
		return (flags & FlagsTagMask) >> FlagsTagOffset;
	}
	set {
		flags = flags & ~FlagsTagMask | value << FlagsTagOffset;
	}
}

to

public uint Tag {get; set;}

and you will get a lot more tags to use.
This will however make tags be ignored when saving graphs to a file, however if you don’t use that feature it should work fine.


#3

I had maybe a bad use of tags.

I have 6 tags now :

  1. Ground
  2. Player1
  3. Player2
  4. Player3
  5. Player4
  6. Road

I want to add to my tag node the tag player1 and road.
So 1<<1 | 1<< 5 = 2 + 32.
And the 32 value is not taken

I have doing something wrong ?


#4

Hi

A node can only have a single tag at a time, you can use them as bitmasks I suppose, but the package has no knowledge of multiple tags on a single node.


#5

Oh any reason for not support that ?
Tag system is very good for manage complexe communication with A* and AI logic.

Can you consider introducing it ?


#6

Mostly because of additional complexity and memory usage that veery few people will use.


#7

Ok I will change my logic so.

Thanks