Game Development Community

Maxed out Network Flags

by Joshua Halls (Xerves) · in Torque 3D Professional · 12/17/2009 (4:52 pm) · 17 replies

Curious if there are any plans on changing over the flag system to an arrayed system that can hold more than 32 flags? Right now it seems the Player/Camera objects are against the wall right now because of the inherited flags from the previous classes. Have done this kind of work before, but it requires pretty much changing every little bit of code where the flags are referenced to use a macro/function as there is a bit more math involved shifting and checking the arrays for the flags.

About the author

Part of the team that works on The Repopulation, a SciFi based MMO using a heavily modified version of the Torque MMO Kit - T3D. I also take care of the T3D version of the Torque MMO Kit.


#1
12/17/2009 (5:09 pm)
I think the BitVector class could be used instead of the network flags. It has methods for testing/setting/clearing bits, and the Stream class has methods to write/read them.
#2
12/17/2009 (5:23 pm)
Looks like a good alternative.
#3
12/17/2009 (9:48 pm)
Or add another int32 flag carrier to the system.... Might be the easiest solution.
#4
12/18/2009 (4:03 am)
The problem is the whole class heirarchy of SceneObject down to like WheeledVehicle sucks up a full 32 bits and there is a ton of stuff in there that you don't really need to dirty like that.

Eventually those classes will be gone, so its not worth a major refactor at the moment.

I would try to remove some bits you don't need for the time being or adding a second mask for you particular class.

Worst case add like a typedef to a U64 and fix up all the places that pass the plain U32. If your smart you make it a class at first so that the compiler will bitch if you miss a few.
#5
12/18/2009 (10:07 am)
Quote:Eventually those classes will be gone, so its not work a major refactor at the moment

can you say more about what classes will be gone??????
#6
12/19/2009 (2:18 am)
They'll be gone when we have new ones to replace them. :)

Its been the plan for a long time now... the whole change to component based development sort of like TGB behaviors but better.

Anyway... its not like the classes will disapear... you can still drop them into your game and use them if they work for you.
#7
12/19/2009 (1:08 pm)
Have you noticed that ControlMask declared in GameBase is never used?
To gain a free mask bit, I have removed it.
#8
12/19/2009 (10:52 pm)
@Davide - Good catch... i've checked that fix into trunk.
#9
01/08/2010 (5:31 pm)
ShapeBase, and therefore Player and Vehicle have several.. shall we say.. extraneous masks that I assume many of us aren't using. There's the invincibleMask, which I gather is used to provide a Super Mario style invulnerability effect and would be pointless for most of us, the cloak mask, which you're probably not using, and the shield mask, who knows what that does.

If you need to add more masks than that, you might want to reconsider how much data you're sending to the clients. If this is for singleplayer, bandwidth isn't an issue, so just dump everything into one mask.
#10
01/09/2010 (3:41 pm)
So how does everyone feel if we removed the invincibility, cloaking, and shields features of ShapeBase classes to remove those masks?

I can't say i've ever used these features myself.
#11
01/09/2010 (4:47 pm)
You would be surprised how things start to add up when you start to tweek the data being sent. In an online game you want to segment that data as much as humanly possible.

Either way, I think we have some stuff tied into the cloaking as we have some hiding/invis stuff tied into that, but for all general purposes I think that sounds good removing those 3 and moving those features into other flags as long as they are fairly small bits of information.
#12
01/11/2010 (5:46 am)
I won't worry if all these flags are removed, as I'm planning to make my own simplified shapeBase class without all this stuff.

So, if you do it for me, I will be pleased! :-)

Nicolas Buquet
www.buquet-net.com/cv/
#13
01/11/2010 (11:24 am)
Quote:
So how does everyone feel if we removed the invincibility, cloaking, and shields

1. Invincibility ... isn't that just scriptable really? As in just throwing in a little variable when damage may occur ...
//psuedocode
if(%col.invincible !=1)
%col.applydamage(%damage);
//etc

2. Did we ever find a difference between cloaking and setmeshhidden/setallmeshhidden? As I remember it seemed to be pretty much the same thing ...

3. I can haz shields!? Did we ever get a practical demo of this in action? I don't remember seeing anything about it in player functions.
#14
01/12/2010 (5:54 am)
It did just occur to me that we actually do have a binary-only version out there to think about, and that may be why a lot of this stuff gets left in, for people who otherwise couldn't add it back in. Anyway, back on target..

@Steve:
1. I think it also does a speed boost, judging from the variables that go with it, which is likely why it's in code, and what I was sort of cryptically referring to when I mentioned Super Mario. :P
I would rather see a script-accessable "setSpeedMult(aMultiplier)" function people could use from script (something that's been a requested feature for a long time, and I actually already added to my code) than have this taking up a mask bit itself, but that might be bloat as well.

2. I think this used to link to some actual effect the engine did back in the T2 days. I'm not sure how much of it has been updated to work now, but the cloaking system has its own texture value in addition to a value from 0-1 describing just how invisible you are. I gather it's supposed to apply a warpy cloaking material to your object and make you some % invisible. If this all works, I'd say leave it, but it looks like it's been stripped down to visible/invisible. Does setmeshhidden work over the network? If so, seems like this is redundant.

3. Just looked in to this. Seems like it's just used to sync a couple of variables that, as far as I can tell, never get used. One of these values is the shieldNormal, which makes me think someone had a cool idea at some point here, but it never got fleshed out. Is this a recent addition, part of some upcoming thing for the FPS kit, or a stalled idea from TGEA? I kind of skipped most of TGEA, so it's hard to tell what's what.

I don't really care one way or the other if these stay or go, because it's no issue for me to go in and recycle them or pull them entirely (for example, I hijacked the shield mask for my shields system, which players and vehicles share, so it was a good fit). Can't tell whether they make good "you could do this to sync your own variables" examples for new users or just confuse them.
#15
01/12/2010 (12:32 pm)
@Henry
2. I don't think you get a warpy material (shame really), it just waits a couple of seconds and then stops rendering the object - thus like setmeshhidden but with an odd delay.
#16
01/13/2010 (12:48 am)
Yea... invincibility, cloaking, and shields are all Tribes features that were left in the Player class in the TGE days.

I'll pass this info along to the team and see if we'll kill it or not... i do love removing code.
#17
02/09/2010 (10:12 am)
Hi I just discovered this thread, and I too am running into the limitations of just 32-bits.

I would suggest removing all the Tribes code really. I think it's too specific for the golden hammer that is Torque. Right now our team is removing all the functionality from the updateMove() function in the Player class. That class is nothing but lava flow and weird and unneeded calculations.

So I would go with removing all the Tribes-specific code.