AstroEmpiresBattleCalc

By Dave V Last update Jun 12, 2009 — Installed 1,603 times.

Bug Hunt

in
Subscribe to Bug Hunt 20 posts, 4 voices



Dave V Script's Author

Any feedback is greatly appreciated. I need help testing bigger multi unit type hits. Also Ion units reports and shield damage is highly untested. Really anything helps. I wrote this on just a base understanding of how the damage system works, and analyzing an existing battle calc.

 
Dave V Script's Author

Ok so I had

Attack Force
Unit Start Quant. End Quant. Power Armour Shield
Fighters 1047 1046 5.9 3.9 0
Destroyer 2 2 20.4 15.6 0
Frigate 18 18 32.4 23.4 0

Defensive Force
Unit Start Quant. End Quant. Power Armour Shield
Recycler 6 0 3.6 3.8 0

My script predicted 1041.~~ (so 1042). The ACE Battle Calc predicted 1044. Perhaps damage should be spread evenly across the Fighters, Destroyers, and Frigates. Anyone have any thoughts?

 
Dave V Script's Author

Oh and I'm over accounting for CCs. I already grab all necessary power info from the attack table.

 
Dave V Script's Author

updated the script to properly distribute damage (ACE predicts correctly, I had 19 CCs set and didn't realize).
also fixed my CC bug.

 
AE Scripts D... Scriptwright

I figured I'd test your script out and this is a result:

Unit Start Quant. End Quant. Power Armour Shield
Recycler 1 0 4.9 4.9 0

Defensive Force
Unit Start Quant. End Quant. Power Armour Shield
Fighters 7000 6999.6187355226675 6.9 4.7 0
Disruptor Turrets 10 10.00498768341285 384 601.6 16
Planetary Shield 10 9.999997905651671 7.4 4812.8 40
Planetary Ring 10 10.001209165594284 3276.8 2406.4 24

--

I think that should be more like this:

Unit Start Quant. End Quant. Power Armour Shield
Recycler 1 0 4.9 4.9 0

Defensive Force
Unit Start Quant. End Quant. Power Armour Shield
Fighters 7000 7000 6.9 4.7 0
Disruptor Turrets 10 10 384 601.6 16
Planetary Shield 10 10 7.4 4812.8 40
Planetary Ring 10 10 3276.8 2406.4 24

 
Dave V Script's Author

Yeah, I had a case where I attacked a series of units and a "fleet carrier" and the quantity went from 1 to 1.02... something. I wish all my units had shields like that. Sadly, the actuals didn't match. :P

I found a pretty big bug with how I was handling unit counts between iterations. I cleaned this up and added plenty of debug which you can enable by setting "bc_debug_level = DEBUG_VERBOSE;" in the script file. It still needs plenty of loving abuse, but I'm keeping my fingers crossed that that's the last major opps.

 
AE Scripts D... Scriptwright

on further attacks it seems your fighter drops are near enough spot on, although nothing else is :p

Attack Force
Unit Start Quant. End Quant. Power Armour Shield
Fighters 22748 22692.724897959186 4.9 4.9 0

Defensive Force
Unit Start Quant. End Quant. Power Armour Shield
Planetary Shield 0.08 106.87954387297403 6.4 4505.6 37
Planetary Ring 0.08 57.56259093169398 3379.2 2252.8 22.2

turns into:

Attack Force
Unit Start Quant. End Quant. Power Armour Shield
Fighters 22748 22693 4.9 4.9 0

Defensive Force
Unit Start Quant. End Quant. Power Armour Shield
Planetary Shield 0.08 0 6.4 4505.6 37
Planetary Ring 0.08 0 3379.2 2252.8 22.2

 
AE Scripts D... Scriptwright

Attack Force
Unit Start Quant. End Quant. Power Armour Shield
Fighters 6000 0 4.9 4.9 0

Defensive Force
Unit Start Quant. End Quant. Power Armour Shield
Fighters 2250 1182.3780866807567 5.5 4.4 0
Corvette 500 21.78925064599286 11 8.8 0
Recycler 500 0 5.5 4.4 0
Destroyer 500 298.29143463054214 19.7 17.6 0
Cruiser 40 24.79743638469203 59.2 52.8 3.7
Heavy Cruiser 50 49.73030726006342 118.3 105.6 7.4
Battleship 6 30.80087675841155 389.8 281.6 18.5
Fleet Carrier 2 23.53260270480369 148.5 211.2 14.8
Planetary Shield 10 12.775333110649385 6.8 4775.9 37
Planetary Ring 15 17.67622245138494 3582 2388 22.2

turns into:

Attack Force
Unit Start Quant. End Quant. Power Armour Shield
Fighters 6000 0 4.9 4.9 0

Defensive Force
Unit Start Quant. End Quant. Power Armour Shield
Fighters 2250 0 5.5 4.4 0
Corvette 500 0 11 8.8 0
Recycler 500 0 5.5 4.4 0
Destroyer 500 0 19.7 17.6 0
Cruiser 40 25.1 59.2 52.8 3.7
Heavy Cruiser 50 50 118.3 105.6 7.4
Battleship 6 5.99 389.8 281.6 18.5
Fleet Carrier 2 1.99 148.5 211.2 14.8
Planetary Shield 10 10 6.8 4775.9 37
Planetary Ring 15 15 3582 2388 22.2

 
Dave V Script's Author

Must be something seriously borked when shields come into play.

 
Dave V Script's Author

bug squashed!
the (aPower > dShield) line was interpreted as a string comparison. I appended a " - 0" when bringing in the numeric table cells and seems to do the trick.

 
Dave V Script's Author

okay, I officially hate Excel's ... language? Syntax? Insanity?
I guess it's better that I didn't totally have to reverse engineer the battle calc myself, but trying to make sense of excel's internals is no picnic either. I live both in fear and awe of the creators tof the ACE Battle Calc.

Anyway, I've learned that fleet attack is actually spread differently for fleet vs turrets. The script now accounts for this as well. If you turn on VERBOSE, watching the output in the console will take several minutes to scroll, but the actual script runs in less than 0.2 seconds. Run the script as is with just timing enabled and you'll see it run closer to 0.05 seconds. That makes me happy

 
AE Scripts D... Scriptwright

seems to be near to acurate now =D

Attack Force
Unit Start Quant. End Quant. Power Armour Shield
Fighters 40000 36484.825861271376 4.7 4.7 0
Cruiser 10000 9710.202066453465 49.2 56.4 3.8

Defensive Force
Unit Start Quant. End Quant. Power Armour Shield
Heavy Cruiser 10 0 122.4 100.8 6.8
Fleet Carrier 20 0 144 201.6 13.6
Dreadnought 5 0 1701 1075.2 34
Disruptor Turrets 15 0 332.8 537.6 13.6
Deflection Shields 5 0 3 1075.2 27.2
Planetary Ring 5 0 3072 2150.4 20.4

became:
Unit Start Quant. End Quant. Power Armour Shield
Fighters 40000 36483 4.7 4.7 0
Cruiser 10000 9710.3 49.2 56.4 3.8

Defensive Force
Unit Start Quant. End Quant. Power Armour Shield
Heavy Cruiser 10 0 122.4 100.8 6.8
Fleet Carrier 20 0 144 201.6 13.6
Dreadnought 5 0 1701 1075.2 34
Disruptor Turrets 15 0 332.8 537.6 13.6
Deflection Shields 5 0 3 1075.2 27.2
Planetary Ring 5 0 3072 2150.4 20.4

be nice if they were rounded off to the nearest point, so

36484.825861271376

would become

36484.8

or even

36485

for unshielded units (FT/BO/CV/DE) etc

 
Dave V Script's Author

I wasn't going to do this, but after staring at the ridiculously long decimals for so long, I agreed and it is done.
Hopefully, now I can kick back and actually use this. :) I'm definitely not going to worry about a missing fighter or two when dealing with 10000+ units. Lol.

 
Dave V Script's Author

Don't forget to write a happy review. :)

 
AE Scripts D... Scriptwright

it's still not 100% acurrate but I think it gives a general idea of what you'll lose if you hit the attack button :D

 
Dave V Script's Author

yeah, as I mentioned in the description, I'm not sure 100% is possible in javascript. Everything is treated as a float in java. I'd guess that AE's implementation probably uses integer math and offsets the decimal or something. I think it's close enough as other offline calcs are not quite 100% either.

 
SordidCoder User

Accurate enough for me - so far it's only been off by .1 or less on all of my attacks. Good job, I love it and reviewed it as such =)

 
Dave V Script's Author

Thanks for the review. The losses would be easy enough, but calculating debris is a little more tricky because it requires you to know armor tech.

It's possible from the information available, but it's a pain. This script is currently blissfully oblivious to tech and just works with the numbers on the page.

To do it the right way, I'd start going down the road of turning it into a full blown battle calc with modifiable fields and such.

I could hack it of course, but well... I like it simple and elegant. Maybe I'll get inspired again though. A debris estimate really would be nice....

 
Wraith Kamachi. Scriptwright

Just a small point I've noted though it will have an effect.

aOverShileds = 0.50;

should be

aOverShields = 0.50;

This is line 95.

 
Dave V Script's Author

updated, good catch. I haven't tested any of the ion units yet, so that line hasn't been exercised.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel