The new shield system and weapons
Moderator: Moderators
The new shield system and weapons
I'm having a hard time understanding how the "shieldintercepttype" and "interceptedbyshieldtype" tags work. Could someone who's figured it out (or ideally the one who implemented it... I'm thinking it was TVO but I don't remember for sure) post a few examples?
For instance, if I want only three weapons, of completely different types, to be blocked by a shield, while all others pass through.
For instance, if I want only three weapons, of completely different types, to be blocked by a shield, while all others pass through.
[15:40:06] <Gnomre> like, i might want it to shield against nukes (which are v-launch missiles) and BLoDs (which are just lasers), but not any other v-launch missiles and BLoDs
[15:40:13] <Gnomre> rather, missiles and lasers
[15:40:46] <SJ> well then assign nukes a interceptedbyshieldtype number that no other weapon have
[15:40:57] <SJ> and blods another
[15:41:02] <Gnomre> ohhhhh, that's how those numbers work
[15:41:07] <Gnomre> i understand now
[15:41:13] <Gnomre> so yeah, it WOULD be pointless :)
[15:41:19] <SJ> well not quite its a bitfield
[15:41:24] <SJ> so a shield with type 3
[15:41:35] <SJ> will intercept weapons with type 1 or 2 or 3
[15:41:51] <SJ> while a shild with type 4 will not intercept those
[15:42:03] <SJ> well i guess you know how 2 compliment math works
[15:42:14] <SJ> just keep every number an even 2^n to make it easy
[15:40:13] <Gnomre> rather, missiles and lasers
[15:40:46] <SJ> well then assign nukes a interceptedbyshieldtype number that no other weapon have
[15:40:57] <SJ> and blods another
[15:41:02] <Gnomre> ohhhhh, that's how those numbers work
[15:41:07] <Gnomre> i understand now
[15:41:13] <Gnomre> so yeah, it WOULD be pointless :)
[15:41:19] <SJ> well not quite its a bitfield
[15:41:24] <SJ> so a shield with type 3
[15:41:35] <SJ> will intercept weapons with type 1 or 2 or 3
[15:41:51] <SJ> while a shild with type 4 will not intercept those
[15:42:03] <SJ> well i guess you know how 2 compliment math works
[15:42:14] <SJ> just keep every number an even 2^n to make it easy
-
- Posts: 578
- Joined: 19 Aug 2004, 17:38
I can't understand it as well. What if I have 3 shields, one against weapons 1 and 2, one against 2 and 3, and one against 1 and 3? How would I make them work?
If it worked like those "power-of-two" things.. a shield of type 2 will intercept type 2. A shield of type 4 would intercept 4. A type 6 would intercept 2 and 4. A type 8 wil intercept 8, a 10 will intercept 8 and 2.. is that how it works? So that when weapon types are powers of 2, the intercept types are the sums of intercepted weapon types.
If it worked like those "power-of-two" things.. a shield of type 2 will intercept type 2. A shield of type 4 would intercept 4. A type 6 would intercept 2 and 4. A type 8 wil intercept 8, a 10 will intercept 8 and 2.. is that how it works? So that when weapon types are powers of 2, the intercept types are the sums of intercepted weapon types.
Okay, here's the simplest explanation I can whip up for how this works.
(It's not two's compliment, BTW, it's bitwise and-ing)
The shieldintercepttype tag and interceptedbyshieldtype tag are kind of two sides of the same thing. It's kind of like categories. Assuming for a second that shields intercept units, not weapons, you could have interceptedbyshieldtype = VTOL on the shield and shieldintercepttype = VTOL on everything it bounced.
Only here we're using numbers instead. So you might have interceptedbyshieldtype = 2 and shieldintercepttype = 2 to bounce one kind of weapon, and interceptedbyshieldtype = 4 and shieldintercepttype = 4 to bounce another.
Now, where things get kind of tricky is that the designers decided to make it so you specified all intercepted weapon types with a single tag. So if you wanted to bounce both of the above weapons, you'd have shieldintercepttype = 6. Why? Let's look at the binary math.
2 in binary is 010
4 in binary is 100
6 in binary is 110
The test to see if a weapon is intercepted by a shield is interceptedbyshieldtype & shieldintercepttype != 0. This means you go through the two numbers bit by bit and do a boolean "and" on them. (And is simple - the result is only 1 if both inputs were 1)
So when we attack a shield of type 6 with a weapon of type 2, we get 110 & 010 = 010 - intercepted! Likewise, a weapon of type 4 gets intercepted because 110 & 100 = 100, as does a weapon of type 6 (110 & 110 = 110). But a weapon of type 1 (110 & 001 = 000) or type 8 (1000 & 0110 = 0000) would not.
The simplest way to handle this is to just use powers of two for interceptedbyshieldtypes (1, 2, 4, 8, etc). If you do this, once you've got a bunch of weapons you want a shield to intercept, you just add up their interceptedbyshieldtypes and use that as your shieldintercepttype tag. Likewise, if you want a weapon to be of multiple types, just add up the types and use that as your interceptedbyshieldtypes tag.
I believe this means that you have room for 32 absolutely unique interceptedbyshieldtypes.
That accurate and intelligible?
(It's not two's compliment, BTW, it's bitwise and-ing)
The shieldintercepttype tag and interceptedbyshieldtype tag are kind of two sides of the same thing. It's kind of like categories. Assuming for a second that shields intercept units, not weapons, you could have interceptedbyshieldtype = VTOL on the shield and shieldintercepttype = VTOL on everything it bounced.
Only here we're using numbers instead. So you might have interceptedbyshieldtype = 2 and shieldintercepttype = 2 to bounce one kind of weapon, and interceptedbyshieldtype = 4 and shieldintercepttype = 4 to bounce another.
Now, where things get kind of tricky is that the designers decided to make it so you specified all intercepted weapon types with a single tag. So if you wanted to bounce both of the above weapons, you'd have shieldintercepttype = 6. Why? Let's look at the binary math.
2 in binary is 010
4 in binary is 100
6 in binary is 110
The test to see if a weapon is intercepted by a shield is interceptedbyshieldtype & shieldintercepttype != 0. This means you go through the two numbers bit by bit and do a boolean "and" on them. (And is simple - the result is only 1 if both inputs were 1)
So when we attack a shield of type 6 with a weapon of type 2, we get 110 & 010 = 010 - intercepted! Likewise, a weapon of type 4 gets intercepted because 110 & 100 = 100, as does a weapon of type 6 (110 & 110 = 110). But a weapon of type 1 (110 & 001 = 000) or type 8 (1000 & 0110 = 0000) would not.
The simplest way to handle this is to just use powers of two for interceptedbyshieldtypes (1, 2, 4, 8, etc). If you do this, once you've got a bunch of weapons you want a shield to intercept, you just add up their interceptedbyshieldtypes and use that as your shieldintercepttype tag. Likewise, if you want a weapon to be of multiple types, just add up the types and use that as your interceptedbyshieldtypes tag.
I believe this means that you have room for 32 absolutely unique interceptedbyshieldtypes.
That accurate and intelligible?
-
- Posts: 578
- Joined: 19 Aug 2004, 17:38
back from some testing (on AA 2.0)
the new concept in intresting, old one (repulsor) was fun
the charging time is nice but to me it doesn't charge fast enough as a peewee will take it down , ok, it takes ages but 5 mavs will do it real fast and a bertha fires faster than it regerates
also it takes 25 shields to stop a vulcan
and too bad it doesn't blocks bullets fired from within it
beyond that, good work :)
the new concept in intresting, old one (repulsor) was fun
the charging time is nice but to me it doesn't charge fast enough as a peewee will take it down , ok, it takes ages but 5 mavs will do it real fast and a bertha fires faster than it regerates
also it takes 25 shields to stop a vulcan
and too bad it doesn't blocks bullets fired from within it
beyond that, good work :)
- Tim Blokdijk
- Posts: 1242
- Joined: 29 May 2005, 11:18
Gimmie a page to put it on (I don't know my way around the modding pages at all) and I will.
Out of curiousity, as a kind of developer-over-the-shoulder thing, why didn't you do multiple named tags? IE:
shieldintercepttype = plasma
shieldintercepttype = BLoD
Efficiency? Because the language doesn't allow a tag to be repeated?
Out of curiousity, as a kind of developer-over-the-shoulder thing, why didn't you do multiple named tags? IE:
shieldintercepttype = plasma
shieldintercepttype = BLoD
Efficiency? Because the language doesn't allow a tag to be repeated?
Still seems simpler for the Modder in the Street to understand than bit fields, which are a) a tad technical and b) effectively limit you to 32 unique weapon "classes". AA alone has at least 16, though TA admittedly has an absurd variety of weapon types.AF wrote:It'd have to be shieldInterceptType1/2/3/etc...
-
- Posts: 578
- Joined: 19 Aug 2004, 17:38
Umm wait a sec... why not have those intercept types be done like unit categories? Separated by spaces. And weapon could work like that too. For example - a missile is "SOLID SELFPROPELLED GUIDED EXPLOSIVE", a shield could be set to stop just SOLID, or SOLID EXPLOSIVE, or GUIDED SELFPROPELLED (deviate in that case), or just GUIDED.
-
- Posts: 501
- Joined: 18 May 2006, 21:19
-
- Posts: 578
- Joined: 19 Aug 2004, 17:38
Harder to code, yes. But since the currently effective weapon aiming routines involve processing exactly the same kind of information, it could be possible to copy over the parser and substitute the involved routines. The existing parser for this (probably) still transforms those codes into tags "interceptedbyweapontype", etc, in internal weapondefs, so if we could just replace the parser and have it produce the same results, the system would work beautifully. I'll even settle for one definable category per shield, as a first step. :)