Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: WMCoolmon on April 15, 2005, 01:16:53 am

Title: The armor thingy
Post by: WMCoolmon on April 15, 2005, 01:16:53 am
Completely untested (I could either test it or implement it :p)

Armor.tbl (or *-amr.tbm):
Code: [Select]

#Armor Type
$Name: Exponential armor
$Type: exponential

;; The table identifiers can be $*:, everything in between the dollar
;; and colon is ignored
;;The columns are damage indexes
;;    0      1     2
$R: (1.0f 1.2f 1.5f)  ;;This is armor index 0
$R: (3.0f 3.5f, 1.0f)
#End
#Armor Type
$Name: Multiplicative armor
$Type: multiplicative

;; The table identifiers can be $*:, everything in between the dollar
;; and colon is ignored
;;The columns are damage indexes
;;    0      1     2
$R: (1.0f 1.2f 1.5f)  ;;This is armor index 0
$R: (3.0f 3.5f, 1.0f)
#end


Ships.tbl
Code: [Select]

;;Right before $Flags:
$Armor Index: 0
     +ArmorType: Exponential armor  ;;Applied in order
     +ArmorType: Multiplicative armor ;;Yes you can have multiple types


Weapons.tbl
Code: [Select]

;;After $Damage:
$Armor Damage Index: 2 ;;Defines the far right value in the example tables above


Formulae for (current) armor type types, easily expanded:
Additivive
Damage + table value
Mulitplicative
Damage * table value
Exponential
Damage ^ table value

It's all in CVS so the next build will have it.

Edit:
I also added a ship flag, "no weapon damage scaling", which will disable the default scaling for a ship.
Title: The armor thingy
Post by: Flipside on April 16, 2005, 09:10:19 am
Looks good! I haven't had time to implement this in a table file, and, afaik, TI aren't planning to use the armour abilities, but it would be handy if someone who was looking for this stuff gave it a go ;)
Title: The armor thingy
Post by: Blitzerland on April 16, 2005, 07:20:10 pm
Wouldn't this break the main campaign in some places? Some ships not perishing, or not perishing quickly enough, when they should?
Title: The armor thingy
Post by: WMCoolmon on April 16, 2005, 07:35:50 pm
Only if you give them armor in the TBL files.
Title: The armor thingy
Post by: Flaser on April 18, 2005, 11:49:57 am
If additive and multiplicative armor could be combined that would make my ever sought for:

Treshold + Resistance system possible.
Title: The armor thingy
Post by: WMCoolmon on April 18, 2005, 06:01:17 pm
I need to work on the armor so it can parse the table, but, yes, that will be possible.

Right now you can specify multiple armor types for ships, I plan on making it so you can specify multiple calculation types for each armor type. That way you can create esoteric armor types with as many calculations as you please, but still only have to enter two entries to assign armor to a ship.
Title: The armor thingy
Post by: Flipside on April 18, 2005, 06:35:50 pm
Maybe if you could apply it to textures through Bobb's new system he's working on, you could have armoured/unarmoured areas etc on the ship?
Title: The armor thingy
Post by: WMCoolmon on April 18, 2005, 07:15:55 pm
That'd require collision code with the ability to detect which teture it collided with (Something I asked about in another context but Bobb didn't seem to positive on the idea).
Title: The armor thingy
Post by: Unknown Target on April 18, 2005, 07:20:42 pm
What exactly does it do...?
Title: The armor thingy
Post by: FireCrack on April 30, 2005, 05:22:51 pm
I'm a tad confused by all these things as well. Care to explain?
Title: The armor thingy
Post by: WMCoolmon on April 30, 2005, 05:30:51 pm
The table has a list of numbers. Rows represent ship indexes, columns represent weapon indexes.

You assign any ships that you want to use with the system an index, and any weapons you want to use with the system an index.

When a ship and a weapon impact, the intersection in the table is determined and if that point exists, the operation defined with "$Type:" is performed with the number. If it's additive and the number is 20, 20 points of damage are added to the weapon's damage value.

Although since Bobb has gotten an equation system working, it changes things. I'm not sure how, but it changes things. ;)
Title: The armor thingy
Post by: WMCoolmon on May 01, 2005, 01:30:37 am
I think I may revise the armor system more like this:
Code: [Select]

#Armor Type
$Name: Reflective

$Damage Type: Light missile
     +Calculation: Multiplicative
     +Value: 3.5
     +Calculation: Additive
     +Value: 20
$Damage Type: Laser
     +Calculation: Multiplicative
     +Value: .5

;;Or maybe just do something like this, with Bobb's new equation system
$Damage Type: Laser
     +Equation: collision_object.damage * .5

;;This would also allow you to do stuff like this
;;This completely ignores the damage assigned to any mega nondeath ray-style weapon, and instead deducts 75% of a ship's current hit points
$Damage Type: Mega Nondeath Ray
     +Equation: ship.current_hitpoints * .75

#End


ships.tbl
Code: [Select]
$Armor Type: Reflective

weapons.tbl
Code: [Select]
$Name: Subach HL-7
...
$Damage Type: Laser
Title: The armor thingy
Post by: Cobra on May 02, 2005, 06:29:40 pm
oooh. so if a subach were to be fired at the said ship, the laser blast would be deflected/reflected?
Title: The armor thingy
Post by: WMCoolmon on May 02, 2005, 06:31:04 pm
No, though that'd be a neat effect and I have a general idea of how to do it.
Title: The armor thingy
Post by: Cobra on May 02, 2005, 06:31:48 pm
cool. :D

can't wait for it ;)
Title: The armor thingy
Post by: Getter Robo G on May 02, 2005, 06:38:36 pm
Can you give the armor a value of limited effectiveness according to
 use/degredation?

Ie,  The Defiant and Sovy classes have ablative armor which greatly increases the amount of damage they can sustain in a fight till the systems covered by those armored sections are impacted, but eventually it does fail after sustained combat. (it's primarily effective against phaser and pure energy weapons)

So eventually if combat lasts long enough the armor could entirely fail and the ship STILL be viable for combat (not destroyed).
Title: The armor thingy
Post by: Axem on May 02, 2005, 08:45:31 pm
Would it be at all possible to assign an armor index to a subobject, overriding the first armor index? This might make for parts of ships more heavily armored than the rest and you'd need to use some tactics to counter that.
Title: The armor thingy
Post by: FireCrack on May 03, 2005, 12:49:53 am
Umm, for a little down the line it would be neat to have reflecting beams if possible.



(mmm... collapsed core moly)
Title: The armor thingy
Post by: WMCoolmon on May 03, 2005, 12:59:50 am
Beams would be much harder.

What I'm thinking of is rather than destroying the weapon on impact with a ship, reversing its forward velocity or redirecting its velocity in a random direction.

Beams would require adding another beam section. And what would be the next request? Beams that predictably bounce, so you could have beams and mirrors. :p

I have an intuitive grasp of where stuff should end up, but I'm not quite sure of how to translate it into mathematical terms.

I'll have a new set of builds up in a few with the +Calculation/+Value system.
Title: The armor thingy
Post by: Bobboau on May 03, 2005, 01:23:39 am
I could give you the math to calculate a reflection vector
Title: The armor thingy
Post by: WMCoolmon on May 03, 2005, 01:31:25 am
Er, sure, that'd be great. :D

I don't know if my current armor system revision is working yet, though, and haven't set up expressions (I started to, but realized that I need to learn how everything works in order to get things working properly.)

I did have a thought today, we should maybe have some way to differentiate between table-specifc values and globally available values. I was thinking maybe a "g." prefix for all global variables, but, hmm. I'm going to sleep on it.
Title: The armor thingy
Post by: Bobboau on May 03, 2005, 02:20:36 am
I = input vector
N = normal of surface
R = output reflection vector

||I||=||N||=||R||=1 (there all unit length, ie normalized)
I, R, and N are coplaner

I•N = -R•N

-I+R=N

(-I)+R =  N

(-I+R)•N = N•N =

(-I•N)+(N•R) =

(-I•N)+(-I•N) =

2(-I•N) =  

-I + R = N = 2(-I•N)N



tada-> "R = 2(-I•N)N + I "

so to code that would be (remembering parameters off top of head)

void vm_vec_reflect(vector*out, vector*norm,vector*in){
float d= -2*vm_vec_dot(in,norm);
vm_vec_scale(out,norm,d); //assumeing (dest,src,float)
vm_vec_add2(out,in);
}