Game Development Community

Invalid net mask bits set

by Novack · in Torque Game Engine · 02/17/2008 (2:25 pm) · 12 replies

When I try to use a recently added maskbit, Torque is throwing an assert "Invalid net mask bits set".

It actually happends when I do "setMaskBits(MyNewMask);" its entering on the first line of the setMaskBits function:
void NetObject::setMaskBits(U32 orMask)
{
   AssertFatal(orMask != 0, "Invalid net mask bits set.");


Ive been looking around here, and in the code, but Im lost; dont have an idea what this is or how to fix it. Any ideas?

#1
02/17/2008 (2:28 pm)
How did you define MyNewMask?
#2
02/17/2008 (2:36 pm)
This is the code:
// Network states
   enum MaskBits
   {
      ActionMask      = ShapeBase::NextFreeMask << 0,
      MoveMask        = ShapeBase::NextFreeMask << 1,
      AIMask          = ShapeBase::NextFreeMask << 2,
      ModifierMask    = ShapeBase::NextFreeMask << 3,

      // We're all crazy!
      ProjectileMask  = ShapeBase::NextFreeMask << 4,
      MapVisibleMask  = ShapeBase::NextFreeMask << 5, 
	  NextFreeMask    = ShapeBase::NextFreeMask << 6,
   };
MyNewMask is an eufemism for "MapVisibleMask" which is the real case. Note that all the comments are from stock.
#3
02/17/2008 (2:37 pm)
Well,
looking at the code there it looks like you're passing in 0.

are you sure you've defined your netmask properly ?
#4
02/17/2008 (2:39 pm)
It might be that you've run out of netmasks.
ie, that ProjectileMask is 0x8000, which 0x8000 << 1 = 0.
#5
02/17/2008 (2:47 pm)
Whoa!! That is basic chinese...

Lets back to reading, it seems like I need more context info here, thanks Orion. =)

On a side note, I thought this post would be answered only if I was very lucky (sunday, and such...), but it almost has the answer record time, thanks guys :)
#6
02/17/2008 (3:19 pm)
Ok, now I have a problem though. The reference documentation on networking its too generalist, and the example cases on TDN are too simplistic.

Im at the middle of a lonely vaccum here. Again, any ideas?

I really want to fix this case, but Im now more concerned about learn what is it, just as Ive been doing...
#7
02/17/2008 (3:39 pm)
Well first i would confirm what your situation is:
is MapVisibleMask actually zero ?
is ProjectileMask actually 0x8000 ?

assuming it is, you've got a few options:

1. look for unused netmasks earlier in the heirarchy of the class. there might not be any.
2. consider reducing MaxSoundThreads, MaxScriptThreads, and MaxMountedImages.
3. consolidate existing netmasks into a single netmask. for example, instead of ProjectileMask and MapVisibleMask, make a single netmask which gets set whenever either of them change. eg ProjectileOrMapVisibleMask.
4. somewhere i think there's a resource to get you an arbitrary number of netmasks, but i'd very, very highly recommend looking at these other options first.
#8
02/17/2008 (4:14 pm)
Yes, the first thought I had was on trying to free other masks by doing 1 and 3, but I was seriously distrusting about be occupying all the netmasks, because I almost didnt add masks on myself; however, it seems to be finally the case. Dont know what are you talking about in point 2... I will read on those, if I can found sources.

I think the answers were as always, on the proper questions...

[*]Obviously MapVisibleMask is beeing 0, because of the assertfatal.
[*]Im seeing a negative huge negative (!?) number in ProjectileMask that effectively seems to be the thirty-something power of 2. Whats the 0x8000 you mention, just the hex of that?

That been said, one more time I really appreciate your help Orion, you are one of my godfathers here :D
#9
02/17/2008 (4:21 pm)
Pleasure to help.

If projectileMask is negative that probably means that yes, it's 2^31.

0x80000000 is hex notation for the binary number 0b10000000000000000000000000000000, aka 2^31.

it displays as negative because the display is interpreting it as a signed integer,
which means that the first bit indicates the sign of the number.

so that sounds like the likely issue.
i'd go ahead w/ #3, it's probably the easiest thing to do.
re #2, if you search the codebase for those guys you'll find them.
I reduced MaxMountedImages from 4 to 2 in my app, which gains you more netmasks!
#10
02/17/2008 (4:45 pm)
Indeed!! You just remind me that in the RTS kit, some of the shapebase netmasks are just ignored on the update, so I should have no problem triming down there :)
#11
02/20/2008 (12:58 am)
Theres quite a lot of trimming that can be done. ShapeBase uses up a lot of masks, and some of them aren't even used anywhere, like ShieldMask, that are throw backs from the Tribes 2 days.

However, seeing stuff like this makes me wish the net flags mechanism was 64 bits instead of a measly 32.
#12
02/20/2008 (4:25 am)
Heh! I apreciate the tip about ShieldMask. I was about trimming it down into one, merging with others than arent used on the RTS kit, but I'll maybe jus comment it out given the case...