Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.95a is out! (03/26/21); Blog post: Of Slipstreams and Sensor Ghosts (09/24/21)

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - BaBosa

Pages: [1]
1
General Discussion / How does damage actually work?
« on: July 21, 2021, 02:29:49 AM »
So a bit of background, I'm currently learning a programming language (MATLAB) and I figured I could practice by recreating how damage is programed in Starsector and find out roughly how long it actually takes for a ship to die from a weapon.

I thought I knew how damage and armour works in Starsector but I found while trying to recreate it that I actually had no idea.
So I want to share where I am at the moment and what I'm missing and I hope someone can help me.

So what I've picked up is that every ship is split into cells and each cell starts with the armour value of the ship (or 1/8 of it, I remember seeing that somewhere but can't find it again) and then when a projectile hits a ship, SS checks what cell it hit, finds what cells are in the 8 neighbouring spots and what cells are in the 12 adjacent but not diagonal spots from those. This gives a maximum of 9 and 12 of what I'm going to call major cells and minor cells respectfully.

Once the cells are found, it sums together the current value of the major cells and half of the current value of the minor cells, (unless the current value is less than 5% of the original value in which case it uses that 5%, maybe?). Then it divides that sum by the number of major cells contributing plus half the number of minor cells contributing.
This gives the average armour value. Add here any bonuses to armour.

That's used in the damage calculation, (damage squared divided by damage plus armour (Edit; unless that would result in less than 15% of the damage dealt, in which case it uses damage times 0.15)).
The resulting damage is then subtracted from the value of every major cell and minor cells take half that damage.

Then I'm not sure how hull damage works, I know how it works if all the armour cells are stripped but I haven't noticed any mention of how it works if some cells are gone but others are still there, but my guess is that
If the damage takes a cell below a value of 0, that number is recorded and then after the damage to each cell has been calculated, the excess damage past 0 from each cell is added together and then divided by the number of major cells and half minor cells and that average is dealt to the hull.

With HE damage, the damage in the armour damage calculation is doubled but then the excess hull damage is halved to compensate due to only doing 100% damage to hull not 200% like armour and the opposite for kinetic and similar to that for frag.

Is that right or did I hur dur somewhere? I'm not sure if the 5% minimum armour value is applied to the individual armour cells or the average armour value. And as I said, the hull damage calculation is a complete guess.

Thank you in advance  ;D

Pages: [1]