Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! 2.6/7 » The Academy » Damage calculations
Re: Damage calculations Sun, 21 November 2004 14:25 Go to previous messageGo to next message
Ptolemy is currently offline Ptolemy

 
Commander

Messages: 1008
Registered: September 2003
Location: Finland

I suspect that it should be applied at the end. Theoretically, the ship still has shields when the missiles are fired. The shields aren't down then until after the missiles have hit / missed. However, considering that ships fire by slots, slot x with 4 missiles fires and kills all the (rest of the) shields, slot y then fires with 6 missiles and should do double damage.

my my 2 cents

Ptolemy


[Updated on: Sun, 21 November 2004 14:27]





Though we often ask how and why, we must also do to get the answers to the questions.

Report message to a moderator

Re: Damage calculations Sun, 21 November 2004 18:17 Go to previous messageGo to next message
Staz is currently offline Staz

 
Lieutenant

Messages: 514
Registered: November 2003
Location: UK
A couple more results from BattleSim. In each case I am only interested in the 1st salvo from the missile BB.

First off, a BB with one slot of 6 Arms along with 7 Nexi to get accuracy almost perfect. Target is 4 chaff (scout+blue laser) and 1 nubian (5k armour, 7.5k shields, 1 blue laser).

The 4 chaff (in 2 different squares) are hit, and killed, by the first 4 missiles in the salvo. The next 2 missiles hit the nub doing 530 armour and 525 shield damage.

The reason for this test was to confirm that missiles that are expended killing the primary target do not contribute any damage to secondary targets. Also confirmed is the fact that the help file is wrong when it says excess damage is only applied to tokens in the same square.



In the second test, the same 6 x Jug BB takes on a nub with 5k armour but only 1k shields, and no chaff in support.

The first salvo does 1000 to shields, 2150 to armour. In other words, the 6 missiles do 3150dp of which half (1525) goes to armour and half to shields. The 525 excess shield damage goes to armour, for the total of 2150.

This shows that the shields don't collapse mid-way through the salvo of 6 missiles. If missiles were treated individually then the first 4 would take out the shields and contribute 50dp to armour as well, giving 1100dp armour damage so far. The last 2 would do double damage and all of it to armour, for a total of another 2100. The overall total armour damage in this case would have been 3200.


Apologies if this is all common knowledge Smile

Report message to a moderator

Re: Damage calculations Sun, 21 November 2004 23:13 Go to previous messageGo to next message
LEit is currently offline LEit

 
Lt. Commander

Messages: 879
Registered: April 2003
Location: CT
Here's something else to test:

If a slot hits a enemy stack, and doesn't knock down all the shields, but does kill some ships, what shields are left:

Is it:
(StartingShields - ShieldDamage) / StartingShips * RemainingShips
Or is it:
StartingShields / StartingShips * RemainingShips - ShieldDamage

IOW, do the ships get destroyed before or after the shields take damage? Also where does the 1/8th shield damage fit into this?



- LEit

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 05:20 Go to previous messageGo to next message
mazda is currently offline mazda

 
Lieutenant

Messages: 655
Registered: April 2003
Location: Reading, UK
Good stuff Staz.
Looks like you are enjoying this.

Never hurts to publish information, even if some already kmow it.
It's more mud on the wall for the rest of us.

To totally answer your question about when do misses to shields get applied then I think you need to repeat the test but with less accuracy - to get misses.
i.e. 1 miss and 5 hits.
If the miss is applied first then it will deduct 65 from the shields. The 5 hits willl then do 935 to shields and 1690 to armor.
If the 5 hits are applied first then you will get 1000 to shields and 1625 to armor, with no shields left to apply the miss against.
I expect they are applied simultaneously, which is basically the first version - the miss does get to do damage to the shields, which helps bring them down for the next slot.

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 05:23 Go to previous messageGo to next message
mazda is currently offline mazda

 
Lieutenant

Messages: 655
Registered: April 2003
Location: Reading, UK
Staz wrote on Sun, 21 November 2004 18:50

Missiles/torps that miss do 1/8 damage to shields. Does anyone know when this should be applied ?

In my current algorithm I've got it happening right at the end, after armour damage and kills. LEit pointed out that it might happen before that, in which case it might actually strip away the last of the shields leading to double damage etc.


So to answer this, I beleive it happens at the same time.
i.e. the total damage for the slot of missiles is calculated all at once. Damage due to missile misses will increase the damage to the shields, and if the shields totally expire then there will be a marginal increase in armor damage - but not double damage until the next slot fires.

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 05:34 Go to previous messageGo to next message
mazda is currently offline mazda

 
Lieutenant

Messages: 655
Registered: April 2003
Location: Reading, UK
LEit wrote on Mon, 22 November 2004 04:13

... what shields are left:

Is it:
(StartingShields - ShieldDamage) / StartingShips * RemainingShips
Or is it:
StartingShields / StartingShips * RemainingShips - ShieldDamage

IOW, do the ships get destroyed before or after the shields take damage? Also where does the 1/8th shield damage fit into this?

I hope it's the former.
In a "real world" sense you can imagine that damage to shields is something that happens right from the very first hit and continues, whilst ship kills happen later on as more missiles hit.
The last test Staz did showed that armor damage can get a bonus if shields "run out" during that slots missiles.
So to determine the total armor damage you have to calculate the shield damage first.
However there is no reason why they couldn't calculate the values, and then apply them in the second formula, is there ?

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 05:47 Go to previous messageGo to next message
Staz is currently offline Staz

 
Lieutenant

Messages: 514
Registered: November 2003
Location: UK
mazda wrote on Mon, 22 November 2004 10:34

The last test Staz did showed that armor damage can get a bonus if shields "run out" during that slots missiles.


Actually it showed the opposite - the last paragraph of my message was a "this is NOT what happens" scenario Smile

Just to reiterate - if the target has any shields left when the slot starts to fire then no missiles in that slot do double armour damage.

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 05:59 Go to previous messageGo to next message
Staz is currently offline Staz

 
Lieutenant

Messages: 514
Registered: November 2003
Location: UK
Hmmm...

I was starting to test LEit's shield damage calculation, so I sent a BB with 1 delta torp against a stack of scouts with complete phase shields. The scouts have 20dp of armour.

The BB shot, hit, did 20 points of armour damage but killed no ships!

Now, I realise that the test setup was flawed, and I should have used torps that do over 40 points of damage, but I still think this is an interesting result.

I guess the 1/512 damage increments are only applied for damage and not for ship kill calculations.

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 06:23 Go to previous messageGo to next message
Staz is currently offline Staz

 
Lieutenant

Messages: 514
Registered: November 2003
Location: UK
LEit wrote on Mon, 22 November 2004 04:13

Here's something else to test:

If a slot hits a enemy stack, and doesn't knock down all the shields, but does kill some ships, what shields are left:

Is it:
(StartingShields - ShieldDamage) / StartingShips * RemainingShips
Or is it:
StartingShields / StartingShips * RemainingShips - ShieldDamage

IOW, do the ships get destroyed before or after the shields take damage? Also where does the 1/8th shield damage fit into this?


One BB with a single Epsilon (and 7 Nexi) attacks a stack of 10 scouts with complete phase shields. For the 1st shot...

Shields = 5000 -> 4476
Armour = 200 -> 180
Ships = 10 -> 9

First question - why only 20 damage, not 24 (Epsilons do 48dp). The other 4dp just vanished. I was under the impression that rounding always increases damage to armour.

Second: shield loss = 524 (500 for ship loss + 24 from the shot)

So the total 24dp of shield damage is applied to the remaining ships in the target token.

ie. Shields = StartingShields / StartingShips * RemainingShips - ShieldDamage

However, after the next move phase the scout stack reports 180 armour and 4482 shields! This is not a regenerating shields race. Does the 1/512 thing apply to shields as well ?


Now, for the 2nd shot...

Shields = 4482 -> 3960
Armour = 180 -> 160
Ships = 9 -> 8

So same thing for armour, and 522 damage for shields.

4482 / 9 * 8 - 24 = 3960, confirming the result.


Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 07:07 Go to previous messageGo to next message
mazda is currently offline mazda

 
Lieutenant

Messages: 655
Registered: April 2003
Location: Reading, UK
Staz wrote on Mon, 22 November 2004 10:47

mazda wrote on Mon, 22 November 2004 10:34

The last test Staz did showed that armor damage can get a bonus if shields "run out" during that slots missiles.


Actually it showed the opposite - the last paragraph of my message was a "this is NOT what happens" scenario Smile


Good to see you read everything I wrote and understood it all. Razz

I never said it did double damage. I merely said that it got a bonus - the excess damage for that firing slot that can't go to the shields because they have "run-out".

You yourself said
Quote:

The 525 excess shield damage goes to armour, for the total of 2150.
I'd call that a bonus to armor damage - i.e. more than 50% of the damage goes to armor.

We are both saying the same thing, just differently.

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 07:12 Go to previous messageGo to next message
Staz is currently offline Staz

 
Lieutenant

Messages: 514
Registered: November 2003
Location: UK
mazda wrote on Mon, 22 November 2004 12:07

Good to see you read everything I wrote and understood it all. Razz


Oh, sorry. I assumed you were talking about the double damage "bonus" which was what I had been testing for. And you know what they say about assumptions Laughing

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 09:57 Go to previous messageGo to next message
Kotk

 
Commander

Messages: 1227
Registered: May 2003
Staz wrote on Mon, 22 November 2004 13:23

However, after the next move phase the scout stack reports 180 armour and 4482 shields! This is not a regenerating shields race. Does the 1/512 thing apply to shields as well ?


You must use only the damage that is done in phase description of VCR in your comparisions. I believe the phases results (destruction done) are calculated by turn generator and stored in .m# file as battle report. Inside phase multiple same init slots of a single token fire one after another and it is displayed as single blast.

All other things seems to be are calculated by VCR using these results and shields are seemingly almost always wrongly calculated there.

1/512 thing applies only for armor since armors health is stored in 9 bits.

Shields are fully healed in next event. When token hits minefield, got demolited and participated in a battle all in same turn in every single such event it has full shields at the start. So i suspect shields are not stored at all in stars... shields are temprarily calculated at start and during the event based on design, components, number of ships in token, RS LRT and damage taken.

The design error that Jeffs made with armor was that they did not use similar temporary value for armor during the battle and just calculate the token damage back from it after the battle is over. Instead they use the real thing (that 9 bit thing) during battle. Jeff McBride tried to fix it by not allowing kill if the torpedo does less damage at killing shot than 1/512 of ship armor (so now you cant kill nubians with alpha DDs), instead of fixing the real problem.

Thats up to you how closely you want to mimic that error... all games should ban taking massive advantage from 1/512 damage. I am not saying it because i think its not amusing. Massive usage of 1/512 bug will confirmedly crash the turn generator.

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 10:13 Go to previous messageGo to next message
Staz is currently offline Staz

 
Lieutenant

Messages: 514
Registered: November 2003
Location: UK
Quote:

All other things seems to be are calculated by VCR using these results and shields are seemingly almost always wrongly calculated there.


Hmmmm....that can be misleading as well, as it reports 24 damage to shields but subsequent calculations reveal that 6 points of that damage disappeared along with the ship that was killed. Anyway, it looks like the 4476 number was wrong.

And in that case I would like to reverse my plea, m'lud Laughing

I originally calculated...

5000 / 10 * 9 - 24 = 4476

but the 4476 number is wrong. The actual figure is 4482 which corresponds to the other calculation method, if you allow for rounding to the nearest integer...

Round( (5000 - 24) / 10) * 9 = 4482

The second shot also works, but again you have to account for rounding...

Round( (4482 - 24) / 9) * 8 = 3960

In conclusion, I am now asserting that

Shields = (StartingShields - ShieldDamage) / StartingShips * RemainingShips

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 10:30 Go to previous messageGo to next message
mazda is currently offline mazda

 
Lieutenant

Messages: 655
Registered: April 2003
Location: Reading, UK
Hmm, to get out of the realm where rounding has a big effect try a different scenario.

Have a BB with a single Jugg.
Then a BB with some R3 Beams and lower init so the missile fires first.
Send them against 3 FF's with shields, say, 80.
So the FF stack will have d.p. of 135/240

When the beam BB fires it will "tell you" how many shields were left in the FF stack after the missile had hit.
So you'll know how much the missile did and how much was left, and can calculate the amount that has vanished due to the FF kill.

I'll do it when I get home tonight if you like. Smile


[Updated on: Mon, 22 November 2004 10:31]

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 12:31 Go to previous messageGo to next message
Staz is currently offline Staz

 
Lieutenant

Messages: 514
Registered: November 2003
Location: UK
mazda wrote on Mon, 22 November 2004 15:30

Hmm, to get out of the realm where rounding has a big effect try a different scenario.

Have a BB with a single Jugg.
Then a BB with some R3 Beams and lower init so the missile fires first.
Send them against 3 FF's with shields, say, 80.
So the FF stack will have d.p. of 135/240

When the beam BB fires it will "tell you" how many shields were left in the FF stack after the missile had hit.
So you'll know how much the missile did and how much was left, and can calculate the amount that has vanished due to the FF kill.

I'll do it when I get home tonight if you like. Smile


Please do. Right now I'm testing and coding at the same time, which is eating up a load of my time.

The rounding errors are introduced when you kill a ship though, as you have an "n / n-1" calculation in there whatever you do. And killing a ship was the point of the test.

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 14:22 Go to previous messageGo to next message
mazda is currently offline mazda

 
Lieutenant

Messages: 655
Registered: April 2003
Location: Reading, UK
You ain't going to like this (I didn't).

3 FF had 45 armor and 80 shields each. Total of 135/240.

The first Jugg hits and does 150 damage.
This is reported as 75 to shields and 45 (1 kill) to armor.
The other 30 to armor still seems to vanish.

The clearing beam shot then hits 90 armor and 86 shield.
i.e. there is 79 shield unaccounted for by the 1 kill by the missile.

This best fits the "subtract kills first, then subtract the shield damage".
i.e. the kill reduces the shields to 160, then 75 is subtracted leaving 85 for the beams to hit.

Groan !

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 14:44 Go to previous messageGo to next message
Staz is currently offline Staz

 
Lieutenant

Messages: 514
Registered: November 2003
Location: UK
mazda wrote on Mon, 22 November 2004 19:22

You ain't going to like this (I didn't).

3 FF had 45 armor and 80 shields each. Total of 135/240.

The first Jugg hits and does 150 damage.
This is reported as 75 to shields and 45 (1 kill) to armor.
The other 30 to armor still seems to vanish.


This is probably to do with the 1 missile - 1 kill rule. A missile salvo that kills probably can't do additional armour damage. If it could, that additional damage could easily add up to more than the target has - in this case if the attack had been from Arms, for example.

Quote:

The clearing beam shot then hits 90 armor and 86 shield.
i.e. there is 79 shield unaccounted for by the 1 kill by the missile.


What R3 beams were you using ? Were they powerful enough to take down the remaining shields (160dp) and armour (90dp) ? If so, I'd suggest that the shield damage is just reported wrong - something we have seen before.

Quote:

This best fits the "subtract kills first, then subtract the shield damage".
i.e. the kill reduces the shields to 160, then 75 is subtracted leaving 85 for the beams to hit.

Groan !



Groan indeed. Confused

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 15:18 Go to previous messageGo to next message
mazda is currently offline mazda

 
Lieutenant

Messages: 655
Registered: April 2003
Location: Reading, UK
I changed the battle plans so that the Missile ship gets 2 shots before the Beamer.

First missile - 75 to shields, 45 to armor.
Second missile - 75 to shields, 45 to armor.

Now place your bets.

Beam - 45 to armor and 0 to shields.
i.e. shields have completely gone by this point.

This doesn't follow the shield damage then kill damage path.
In that case you would expect the shields to go 240 -> 165, then lose a 1/3 because of the kill -> 110.
Then 110 -> 35 (lose 75 again) and lose half due to the kill 35 -> 17 or 18.

How do we tell exactly what is going on here ?
I could put a sapper on the beam ship, see if it fires at all.

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 18:14 Go to previous messageGo to next message
Kotk

 
Commander

Messages: 1227
Registered: May 2003
mazda wrote on Mon, 22 November 2004 21:22

Groan !



I did similar tests too. Smile. I think i can shed a bit lighti into that strange thing there. Very Happy

What i found out:
Initially frigates are 135 / 240
It say that jugger does 45 / 75 (thats strange)
So it should be left 90 / 165 (thats impossible)
It display that theres 90 / 85 left after jugger (thats weird)
Actually however theres 90 / 110 left after jugger (now thats less weird)

So i suspect that:
jugger does 75 damage to shields (leaving 165)
jugger does 75 damage to armor but is blocked at 45 damage cause ship kill, so it converts to 45 killing one ship.
ship dying does 1/3 th = 55 damage to leftover 165 shields leaving 110 shields
VCR thinks that ship dying does whole 80 damage to shields leaving 85 shields

now if next that hits is jugger then
it does 75 damage to shields leaving 90
it does 45 damage to armor (killing ship)
ship death does 1/2 th = 45 damage to shields
VCR thinks that ship dying does >5 damage to shields (bah lets not care what VCR thinks okay?) leaving no shields

Now if you hit with some beamer that does < 90 damage after second jugger (heavy blaster with 3 capasitors) you see that there were actually still 45 shields left, since the record that is given to VCR contains 45 shield damage. If it however does more than 90 damage the record contains kills so VCR looks that there was 45 armor/no shields left and proudly reports it as damage done. Wink

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 18:59 Go to previous messageGo to next message
Kotk

 
Commander

Messages: 1227
Registered: May 2003
Me wrote on Tue, 23 November 2004 01:14


now if next that hits is jugger then
it does 75 damage to shields leaving 90
it does 45 damage to armor (killing ship)
ship death does 1/2 th = 45 damage to shields
VCR thinks that ship dying does >5 damage to shields (bah lets not care what VCR thinks okay?) leaving no shields



Damn... it appears to be i calculated wrong there 110-75 is only 35 35/2 = 18 and so theres 17 shields left after second jugger.

So if someone wants to see that shield the beamer must do less than 62 damage after second jugger not less than 90 like i said.

[edit.. second jugger not third maybe i should stop here]


[Updated on: Mon, 22 November 2004 19:42]

Report message to a moderator

Re: Damage calculations Mon, 22 November 2004 21:06 Go to previous messageGo to next message
Kotk

 
Commander

Messages: 1227
Registered: May 2003
Okay i still try once more. Very Happy
Seems that most likely rockets (missile or torpedo) slot does damage like this:


If select_target() == false
    Return
fI
damage = slot.weapon.damage
If target.shields == 0 && slot.weapon.type == missile
    damage *= 2
fI  

first_hit  = true
armordamage = 0

For each rocket in the slot
    If it_hits() 
        shielddamage = min (target.shields, damage/2)
        target.shields -= shielddamage
        armordamage +=  damage - shielddamage

        If armordamage >= target.armor/target.ships
            target.shields -= target.shields/target.ships 
            armordamage -= target.armor/target.ships
            target.armor -= target.armor/target.ships
            target.ships -= 1

            If first_hit == true
                armordamage = 0
            fI

            If target.ships = 0
               
               If select_target() == false
                  Return
               fI
               damage = slot.weapon.damage
               If target.shields == 0 && slot.weapon.type == missile
                   damage *= 2
               fI  
               first_hit = true
               armordamage = 0
            fI

        Else //damage does not kill ships
            first_hit = false
        fI

    Else //it did not hit  
         target.shields -= min (target.shields, damage/8)
    fI
roF //each rocket in slot

If armordamage > 0
    damage_units = max( target.design.armour * target.ships / 500, target.ships) 
    target.armor -= max (armordamage/damage_units,1)* damage_units
    If target.armor < damage_units
        target.armor = damage_units
    fI
fI



[Edit: okay seems that it works on these cases i tried Very Happy]


[Updated on: Wed, 24 November 2004 10:44]

Report message to a moderator

Re: Damage calculations Tue, 23 November 2004 05:05 Go to previous messageGo to next message
Ptolemy is currently offline Ptolemy

 
Commander

Messages: 1008
Registered: September 2003
Location: Finland

As this battle engine gets worked out I think we need to look at creating 'battle order of events' sheet.

With all the fine work going into this, we will want to make sure that clients are using an identical battle order of events and displaying things the same for battles.

In the case of damage to armor not being applied from a single missile/torp hit when a ship is killed - that makes sense since the missile only kills one ship. Excess damage power from a missile that kills a ship should not be possible to carry over to another ship in a stack.

At some point in time here we are also going to have to look at the behaviour of all battle order combinations.

Ptolemy




Though we often ask how and why, we must also do to get the answers to the questions.

Report message to a moderator

Re: Damage calculations Tue, 23 November 2004 05:32 Go to previous messageGo to next message
mazda is currently offline mazda

 
Lieutenant

Messages: 655
Registered: April 2003
Location: Reading, UK
Kotk wrote on Mon, 22 November 2004 23:59


So if someone wants to see that shield the beamer must do less than 62 damage after second jugger not less than 90 like i said.


I'll do it with a single Colloidal.
Not really interested in a third kill, just want to see that a shield gets hit. I had too many HBs on the beamer before.
I really hope it does what you say. Smile

Your code above looks good. Nice and clean.

Are the FreeStars people going to duplicate it exactly, with rounding errors and all ?
I can understand keeping the fleet limits etc. but trying to duplicate rounding errors seems to be going tooo far.

Report message to a moderator

Re: Damage calculations Tue, 23 November 2004 05:42 Go to previous messageGo to next message
Staz is currently offline Staz

 
Lieutenant

Messages: 514
Registered: November 2003
Location: UK
Quote:

Seems that most likely rockets (missile or torpedo) slot does damage like this:


Your algorithm works on a missile by missile basis. The tests I have done so far indicate that it is done on a slot by slot basis, with only missile hits/misses tested individually.

The main effect of this is that in a salvo of 6 missiles from a BB, either all 6 do double armour damage due to no shields, or none of them do.

With your algorithm, the first couple of missiles in the salvo could take down the shields and then the other 4 do double damage. This does not happen in the battle engine.

And once we have this sorted, we still need to decide what happens if the target token is killed outright and there are still "kills" available to the slot.

Report message to a moderator

Re: Damage calculations Tue, 23 November 2004 10:14 Go to previous messageGo to previous message
Kotk

 
Commander

Messages: 1227
Registered: May 2003
Staz wrote on Tue, 23 November 2004 12:42

With your algorithm, the first couple of missiles in the salvo could take down the shields and then the other 4 do double damage. This does not happen in the battle engine.


Not sure how?
The double damage is only calculated as when primary or new target token is selected and it appears to have no shields.

Oh i just noticed other bug that "damage" is not initialized on case target has shields. Very Happy


[Updated on: Tue, 23 November 2004 10:18]

Report message to a moderator

Previous Topic: Weapon range and firing order
Next Topic: Disengage in 8 moves
Goto Forum:
  


Current Time: Sun May 12 17:57:36 EDT 2024