As a French person I feel like it's my duty to explain strikes to you. - AdrienIer

Create an account  

 
Combat Dice Roll

I'm looking for information on how the combat dice roll works. The reason is because it seems like the game doesn't line up with what the manual says (or, at least, my understanding of what the manual says).

Say you're using ion cannon, which does 3-8 damage. Now, the manual takes about how it makes a roll of 1-100, then looks to see if that's equal to or higher than a value based on the attacker's to-hit and the target's defense. If both are the same, then it's 50. Each level that the attacker has over the target is a 10% difference.

The first question is that since it says the roll is 1 to 100, and equal or higher counts as a hit, this means that when the attacker's rating and the target's defense are the same (say, both are 4), then it's actually a 51% chance of hitting, not a 50% chance of hitting, since rolling 1-49 results in a miss, while rolling 50-100 results in a hit. Is this correct?

The second -- and main -- question concerns how the game interpolates the numbers. For the above ion cannon, I would have thought that, assuming the attacker's rating is 5 more than the target's defense (so it's exactly 100% probability of hitting, without the bonus from going beyond 100%), that it would be about 1/6 probability of each of the numbers 3, 4, 5, 6, 7, and 8 showing up.

But it seems like in reality, the actually distribution will end up being something like:
10% of 3 damage
21% of 4 damage
19% of 5 damage
20% of 6 damage
19% of 7 damage
11% of 8 damage

In other words, the end point numbers only have about half the probability of being rolled. I'll post more about how I collected the data later, but basically it involves using a save game editor to give my ship 1000 ion cannons and then repeatedly blasting an enemy ship with 25000 HP that I've warp dissipated to prevent from retreating, and copying down the results. So the distribution is based on effectively tens of thousands of hits (although I'm still collecting the data, since it's done manually).

Anyway, the significance of this comes into play once there's shields involved or once you go beyond 100% probability of hitting (which results in something similar math-wise). Say I go up against a ship with 5 shields. Now if I assumed that each number has 1/6 probability of showing up, then I would expect average (0,0,0,1,2,3) or 1 damage per hit. But in reality, the 8 (resulting in 3 after shields) will only show up half as often as the 6 or 7, so my average damage actually ends up being 0.9, or a 10% difference. This may or may not being important, depending on how much margin you are giving your ships in battles and the specifics of how much shields you're up against.

So yeah, before getting too much into data collection, I was curious about what's already out there in terms of understanding how the actual combat rolls work. I have the manual (from Jon Sullivan's site) and the info from there, but not the strategy guide. Thanks for any info on this.
Reply

You've got it mostly right -- here's the info from the strategy guide. Note it says it's been corrected from the manual.

[attachment=482]
[attachment=483]
[attachment=484]
[attachment=485]

Another piece of info that is not presented even in the strategy guide -- I believe the damage values are not in integers, but are calculated as fractional values and then presented in-game as integer reductions from hit points when the integer thresholds are crossed. For example, below would be a standard situation of attacker and defense equal, firing ion cannons against no shields. I found that fractional values better reflected the in-game experience when I was doing some admittedly limited testing to find out my own answers to your questions.

Roll Damage
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0
16 0
17 0
18 0
19 0
20 0
21 0
22 0
23 0
24 0
25 0
26 0
27 0
28 0
29 0
30 0
31 0
32 0
33 0
34 0
35 0
36 0
37 0
38 0
39 0
40 0
41 0
42 0
43 0
44 0
45 0
46 0
47 0
48 0
49 0
50 3
51 3.1
52 3.2
53 3.3
54 3.4
55 3.5
56 3.6
57 3.7
58 3.8
59 3.9
60 4
61 4.1
62 4.2
63 4.3
64 4.4
65 4.5
66 4.6
67 4.7
68 4.8
69 4.9
70 5
71 5.1
72 5.2
73 5.3
74 5.4
75 5.5
76 5.6
77 5.7
78 5.8
79 5.9
80 6
81 6.1
82 6.2
83 6.3
84 6.4
85 6.5
86 6.6
87 6.7
88 6.8
89 6.9
90 7
91 7.1
92 7.2
93 7.3
94 7.4
95 7.5
96 7.6
97 7.7
98 7.8
99 7.9
100 8
Reply

(May 19th, 2013, 20:21)Zygot Wrote: You've got it mostly right -- here's the info from the strategy guide. Note it says it's been corrected from the manual.

Neato. Thanks for the info.

I noticed the guide says that you need a roll of 51 or higher to hit when the attacker's rating is the same as the target's defense (i.e. when the differential is 0), while the manual says a roll of 50 or higher.

The guide doesn't talk about how it does the interpolation for the damage though (maybe it does in Chapter 1 which is referenced?). The examples that are given in the guide (as well as in the manual) all are using nice round numbers, but I'm interested in what happens when you roll a 41 or something, i.e. what's the formula it uses to interpolate, to convert from the d100 roll into an actual damage value.

So far though with what I've tested, yeah it seems like the endpoints only have half the probability of appearing. In other words, for a 5 differential (so exactly 100% chance of hitting), if it's using say an ion cannon (stated 3 to 8 damage), it's as if the interpolation is actually between 3.5 (for minimum roll) and 8.5 (for maximum roll) and then truncating -- resulting in 3 and 8 appearing only half as often as the other numbers.

Also, for ion cannon, when there's a 6 differential, the probabilities look like:
23% for 4 damage
23% for 5 damage
21% for 6 damage
21% for 7 damage
12% for 8 damage

That's right, you shouldn't ever see 3 damage using an ion cannon with just 6 differential, even though "in theory" (i.e. if all numbers had equal probability of appearing at the "standard" 5 differential), you'd see 3 show up about 8% of the time. I tested 600 samples of a single ion cannon plinking away at a ship, with 7 attack against a ship with 1 beam defense (i.e. 6 differential), and never saw "3" pop up.

For heavy laser, so far the probability at the "standard" 5 differential seems to be:
9% for 1 damage
17% for 2 damage
16% for 3 damage
17% for 4 damage
16% for 5 damage
16% for 6 damage
9% for 7 damage

(May 19th, 2013, 20:21)Zygot Wrote: Another piece of info that is not presented even in the strategy guide -- I believe the damage values are not in integers, but are calculated as fractional values and then presented in-game as integer reductions from hit points when the integer thresholds are crossed. For example, below would be a standard situation of attacker and defense equal, firing ion cannons against no shields. I found that fractional values better reflected the in-game experience when I was doing some admittedly limited testing to find out my own answers to your questions.

Huh yeah some games do this (Starcraft comes to mind). How would you test this out though? (Looking at values in memory would be one way I guess, but I wouldn't really know how to do that.)
Reply

(May 20th, 2013, 01:56)Vanshilar Wrote: I noticed the guide says that you need a roll of 51 or higher to hit when the attacker's rating is the same as the target's defense (i.e. when the differential is 0), while the manual says a roll of 50 or higher.

Huh. I would go with the strategy guide. It was written with version 1.3 in mind and the author Alan Emrich did heavy design work with Steve Barcia. It should contain all the latest info.

(May 20th, 2013, 01:56)Vanshilar Wrote: The guide doesn't talk about how it does the interpolation for the damage though (maybe it does in Chapter 1 which is referenced?). The examples that are given in the guide (as well as in the manual) all are using nice round numbers, but I'm interested in what happens when you roll a 41 or something, i.e. what's the formula it uses to interpolate, to convert from the d100 roll into an actual damage value.

Exactly. Both the manual and guide frustratingly use only round numbers. But I do think it's fractional. I took the spreadsheet from here (was it yours?) and frankensteined some combat odds onto it. Then I played the game some and recorded the actual in-game results and compared to my formula. It was way, way off, especially with regard to damage against shields, until I made it fractional. I am not saying my results are correct, just that the theory fit the evidence much better. This was a month or so ago, so I don't remember all the details.

(edit -- the reference to chap 1 is only for explaining what a D100 is)

(May 20th, 2013, 01:56)Vanshilar Wrote: I tested 600 samples of a single ion cannon plinking away at a ship, with 7 attack against a ship with 1 beam defense (i.e. 6 differential), and never saw "3" pop up.

Right, because the bottom damage values are lopped off. In other words, if you're kicking so much ass that you have a >+5 combat differential, not only will you always hit the target but you'll always do better than the minimum damage too. That's where the strategy guide lays it out the right way, in the table in the second page I posted earlier.

(May 20th, 2013, 01:56)Vanshilar Wrote: Huh yeah some games do this (Starcraft comes to mind). How would you test this out though? (Looking at values in memory would be one way I guess, but I wouldn't really know how to do that.)

Here's my frankensteined version of the spreadsheet from this forum. What I've done is you input your current tech level at top, design your ship just below that, and fill in the necessary details of an enemy ship in the area below that. Then you can look way over to the right in the Bx columns and see some combat odds (unhide the rows for the whole dice rolls). They aren't necessarily correct, but I think they're close.

What I did was play some and compare the results to the average calculated from the spreadsheet. It worked pretty well. But it could use a whole lot more testing.

(edit -- and may only work for regular, non >+5 differentials)


Attached Files
.xls   moo ship design enhanced.xls (Size: 204 KB / Downloads: 12)
Reply

Yeah what I had in mind was to redo the ship design spreadsheet to be able to take into account the expected damage against an enemy ship of desired design. I started considering this because I noticed the beam damage numbers were less than what I expected, specifically while using Mrrshan beam-only ships vs planets. This has 3 particular effects on damage:

1. Being Mrrshan against planet (beam def 1) means that I can have a very high differential.
2. Beam damage is halved against planets (and rounded down).
3. Planets have shields, which alter the distribution.

Hence I started looking into how the combat system actually worked. I mean I read through the manual previously but here I'm trying to dig into the details, and this interpolation function is what I'm currently trying to figure out, and I suspect how it works is the cause of the discrepancy. It turns out that because each number does not have the same probability of appearing (i.e. it's not a uniform distribution -- or at least, it doesn't take the endpoints into account properly), all three points above will affect the damage numbers that you get compared with if the distribution were uniform; specifically, you wind up doing less damage.

My current data collection doesn't consider fractional damage but assume they're always integer. I haven't yet built up a hypothesis though (i.e. of what the interpolation function is). My assumption is that the game does a 1d100 roll and then everything else follows from there. The significance of this is that I only have to worry about percentages, i.e. the probability of a number appearing is going to be 37% or 22% etc., not 36.278456% or 2/9 chance etc.

To tease out the percentages of each number (warning: math), I used a game editor to give myself a ship and an enemy of the desired attack and weapons. Say it's 2+4 attack (I'm Mrrshan for the +4) and I'm using 1000 ion cannons (3-8 damage). I set the enemy ship to have 1 beam def (i.e. large) with 7 shields. This means that the only way I do any damage is if I roll for 8 damage. I then attack the enemy ship a lot. In this case, I did 50 samples (of 1000 ion cannon shots), and the average damage was 108.52, with a standard deviation (of the samples) of 9.83. Since I had 50 samples, this means the standard deviation for the average (i.e. if I did 50 samples and took their average a bunch of times, the standard deviation of those averages) would be 9.83 / sqrt(50) or 1.39. So the average for 1000 shots was 108.52 +- 1.39, so the average per shot was 0.10852 +- 0.00139. Now, since the enemy ship had 7 shields, this means the shot does 1 damage if I get an 8 and 0 damage if I get anything else. Hence, the probability of getting an 8 was tested to be 0.10852 +- 0.00139, or 11%.

With this result in mind, I set the enemy's ship to have 6 shields, so I do 2 damage if I get an 8, 1 damage if I get a 7, and 0 damage for everything else. For 100 samples, I get 408.74 +- 2.05862 for the average and standard deviation of the average. Assuming 11% probability of getting an 8, this means that from the 1000 ion cannon shots, the expected contribution from 8's was 1000 * 0.11 * 2 = 220. The remainder is 188, which works out to 19% as the probability of getting 7 damage.

I continued this onward with successively less shields until I find the probabilities of all the damage numbers, hence the numbers that I gave above. I should note that I test with 1000 weapons; I don't know if MoO does weird things once there's too many weapons (I know it definitely starts doing something different once there's 1001 or more weapons), so this may be a factor in the testing. I really don't want to fire 1 weapon 1000 times though, especially since right now by firing 1000 weapons per volley I can get sample sizes effectively in the tens or hundreds of thousands; I definitely don't want to do that one at a time. I should note that yes you can get over 1000 weapons normally, for example by having thousands of small ships in a single stack; I just put them on a single ship for convenience.

Anyway so my testing data so far is:
Attack of 3 + 4 (Mrrshan as the +4)
Beam def of 1
(so 6 differential)
1000 ion cannons, vs large ship that's warp dissipated
Shield 7: avg 116.72 (50 samples)
Shield 6: avg 450.40 (150 samples)
Shield 5: avg 993.53 (150 samples)
Shield 4: avg 1760.45 (263 samples)
Shield 3: avg 2759.29 (340 samples)

Attack of 2 + 4 (Mrrshan as the +4)
Beam def of 1
(so 5 differential)
1000 ion cannons, vs large ship that's warp dissipated
Shield 7: avg 108.52 (50 samples)
Shield 6: avg 408.74 (100 samples)
Shield 5: avg 910.71 (150 samples)
Shield 4: avg 1599.34 (100 samples)
Shield 3: avg 2500.14 (208 samples)
Shield 2: avg 3493.88 (300 samples)
Shield 1: avg 4496.82 (295 samples)

I haven't considered fractional damage in depth, but do you think it would be able to match those testing results?

My thinking is that when they were doing interpolation function, they probably realized that truncation rounding (assuming damage is only integer and not fractional) takes away 0.5 on average, so for a weapon with 3 to 8 damage, they'd need to interpolate 3.5 to 8.5 damage instead so that the average before rounding is 6, and then after rounding the average becomes 5.5, which is what the average for 3 to 8 damage is supposed to be. Thus the endpoint numbers ended up being only half as likely to come up. However, this leads to effects when shields and stuff are considered, such that the resulting damage isn't what it would've been if it were uniformly distributed between 3 and 8. The correct way would have been to interpolate between 3 and 9 -- that is to say, for a d100 roll, a roll of 1 would result in 3.00 while a roll of 101 would result in 9.00. Since you can't actually roll a 101 on a d100, the max roll ends up being just under 9 (in this case, 8.94) which would end up being truncated to 8. But then each number ends up having the same probability (within the percentage, i.e. each are 16% or 17% in this case) rather than having the endpoints have lower probability.

For me right now it's looking like assuming the endpoint numbers are roughly half as likely to appear as the other numbers will generate predicted damages that are fairly close to the results (although not exactly, so there are some other effects going on such as rounding or fractional damages). I think the most obvious demonstration of this phenomenon, although I haven't tested this out myself yet, is just to stick a single laser on a ship and pluck away at some enemy ship. (It should be fairly easy to set up.) I'm guessing that you'll see roughly twice as many 2's and 3's as you do 1's and 4's.
Reply

I dunno. For the longest time I assumed damage was integer based too. But your theory seems pretty complex to me. Occam's Razor suggests looking at a simpler theory first.

One thing to consider is that MOO uses fractional results presented at integer thresholds in other areas, such as factory construction and population growth. So there is precedent for a theory of fractional damage.

I'd love to have some of the other analytically-disposed players here work with us to solve this problem!
Reply

Actually the theory is very simple -- the interpolation function adds 0.5 to the endpoint values (so 3-8 damage becomes 3.5-8.5 damage) and then truncates. It would explain why the endpoint values appear about half as often as the other values.

Certainly, testing it is a bit more complex, but that's because testing essentially involves verifying theories and rejecting others; testing is also very grungy because data must be produced. That doesn't make the underlying theory complex, however. Einstein's E = mc^2 and Newton's F = ma are simple to understand but significantly more difficult to test.
Reply

It's an interesting problem, and I think you and I are approaching it from opposite directions.

What I did was take the fantastic work already done with the ship design spreadsheet and combine it with the damage formula as presented in the MOO FAQ v2.8 section 2.M. Since I'm not good at math, I added a section to the spreadsheet that calculates each possible d100 value individually and then an average result. You can see this for the player's ship design in columns BN-BU of the spreadsheet. All the work is shown and can be checked by anyone who is interested -- I would appreciate any corrections.

What's cool is that in my limited testing this seemed to be a good reflection of the in-game results. I did no statistical analysis like you have, but I played for a bit and when I had a good opportunity I wrote down the in-game results and compared to the expected results, and they were satisfactory. I haven't had the time to test or pursue it further, but it was a fun exercise and I hope to get back to it someday -- you can see I started doing some analysis of cost effectiveness too.

Anyway, because my work averages fractional results and seems to be on the right track, my conclusion is that it's possible the game engine works that way too. However, I could be wrong. Just because I get to a decent final answer doesn't mean the process works that way too. For example, if your theory is correct it might lead to the same results, and that would be interesting.

The reason I say we're approaching it from opposite directions is because I'm working the spreadsheet to apply the damage formula to each d100 value and then averaging to get an expected result. You are setting up an in-game experiment to collect in-game results to reverse engineer the formula. I think what you're doing is very clever and cool, and also somewhat difficult for me to wrap my mind around.

May I suggest that maybe your experiment is too advanced. There are a lot of special cases in what you describe: Mrrshan attack bonus; warp dissipator to enemy maneuver; greater than +5 attack/defense differentials; ship designs only possible through editing programs. Is there any way to simplify it down to a more standard situation? If you could post a save game that has for example: any non-Mrrshan race attacking any non-Alkari race, with a single basic laser or ion cannon against a ship with a normally achievable hit point value, I would volunteer to do some testing as my time allows (unfortunately not much right now, but I'm very interested in this problem). If we could collect some basic results like this, it might be illuminating.

One wrinkle is that at greater than +5 attack/defense differentials, the weapon damage values themselves are modified at the lower bounds, as per the strategy guide table posted above. Now how the engine handles that, who knows. For myself, I haven't given it any thought; my spreadsheet modifications are currently useless in these cases.

I do find it interesting that your experiments are showing odd results at the upper and lower damage bounds. Kudos for applying statistics to the problem. It's very cool that this wonderful game still has some mysteries worth investigating.
Reply

Well it's also possible that the game does both, i.e. interpolate from +0.5 of both endpoints as well as work in fractional values. The thing about theories is that they should be testable in some way, i.e. can come up with experiments to determine if they're true or false, to be useful. But yeah although I take the d100 into account (i.e. assume that the probabilities are in percentages with no decimals beyond that), it's based on experimentation and trying to guess at what could cause those results.

The special cases are more so that I can get up to testing it quickly. It's possible to have scenarios without the special cases to test, but it takes longer to set up (play the game until the computer makes huge ships for example and make the right amount of shields, etc.). So it depends on how far you're willing to allow things like ship editing. Going through the stuff I did to set it up:

* Race = Mrrshan -- not necessary, could be any race, but needs the attack to be about 5 or so more than the computer's defense. This can be done by editing the save files though, but I used Mrrshan because I was also planning to test the extreme ranges at some point (i.e. attack of 16 vs defense of 1). It's always possible though that being Mrrshan screws up the attack somehow, since they themselves have a racial bonus to attack. Playing as any other race though means that I'd have to play far enough into the game to have +5 battle computer over the computer's defense, or edit the save files to artificially have a high battle computer beyond what I've researched.
* Warp dissipator -- purpose is to prevent the computer ship from retreating. If you have the testing conditions just right then you can have it where the computer ship won't retreat, but then you also don't want the ships to kill each other (but repair allows the combat to continue). This is very difficult to set up by normal playing; it would take quite a bit of experimentation to see at what point the AI gives up and retreats. Also, it's unlikely that the computer would have auto repair or adv dmg control and yet still be using low shields, so that would likely be ship edited.
* Greater than +5 differential -- I also tested with exactly +5 differential. In fact my testing starts with +5 differential for the different weapons, to get a feel for what the "standard" distribution looks like. But any theory should take into account both greater than +5 differential and less than +5 differential, hence I've done some testing on it as well. In fact part of this investigation is to answer the question of, should you ever want more than +5 differential for beam weapons. I have a hunch that in fact you do want more than +5 differential for beams and bombs if the enemy has shields, i.e. enough differential so that the minimum damage at least matches the shield value (and then it really depends on how expensive each additional weapon is relatively to each additional battle computer rating), but that's just a hunch right now until this thing is figured out.
* 1000 weapons -- this can be achieved by just stacking ships. For example, having a stack of 20 ships with 50 weapons will also generate hits of 1000 weapons. Without editing the save files though it would take a while to build that many ships.
* 1000 weapons vs 1 weapon -- it's certainly possible that the game engine does something differently once there's too many weapons in a stack. In fact, it's relatively easy to show that this is in fact the case once you have 1001 or more weapons in a stack -- you will always do an even amount of damage (so the game is doing something like, each dice roll counts twice or something, rather than 1001 individual dice rolls). It's unknown if the game does anything weird if there are 1000 or less weapons. However, it would take very long to establish percentage values with any precision if you're testing 1 weapon roll at a time.

I think it should be fairly easy to show there is indeed a skewed distribution by taking a single regular laser (1-4) and firing it repeatedly at an enemy ship. Once you use weapons with wider ranges the samples that you'd have to collect is a lot greater. From my testing:

1 mass driver (5-8 damage)
2+4 attack (+4 from Mrrshan)
1 beam defense (warp dissipated large ship)
7 shields (becomes 3 because of shield halving)
68 samples with 2 damage
121 samples with 3 damage
121 samples with 4 damage
66 samples with 5 damage
(376 total samples)

1 ion cannon (3-8 damage)
2+4 attack (+4 from Mrrshan)
1 beam defense (warp dissipated large ship)
1 shields
20 samples with 2 damage
48 samples with 3 damage
52 samples with 4 damage
50 samples with 5 damage
54 samples with 6 damage
26 samples with 7 damage
(250 total samples)

So even with several hundred samples it seems like the endpoints show up less frequently, but it's hard to tie down what the percentages are unless you do thousands of samples, hence the ship editing.

By the way I didn't come up with the ship design spreadsheet, it looks like Sargon0 did here:
http://realmsbeyond.net/forums/showthread.php?tid=3172

Also, I was thinking of doing a memory dump during combat and then looking for hit point values, to see how the hit points are stored in memory (i.e. whether or not they are indeed fractional). I'll post more about that when I have time to look into how to do it, probably over the weekend or something.
Reply

OK, so here's an idea.

First, let's take the mass driver example from your most recent post. Your samples are:

68 samples @ 2 damage = 136 damage
121 samples @ 3 damage = 363 damage
121 samples @ 4 damage = 484 damage
66 samples @ 5 damage = 330 damage
TOTALS:
376 samples with 1313 damage = 3.492 average damage per shot.

Now, check out my spreadsheet. Let's make some changes to match your testing.

1) In cell C19, choose the Mass Driver for the attacking weapon.
2) In cell E91, set the value to 1. This represents the 100% chance to hit (necessary because the existing to-hit formula maxes at 95%, don't remember why).
3) In cell C94, set the enemy target shields to 7.
4) Now look in cell BU-102. The calculated average damage per shot is... 3.515. Pretty close to your 3.492 observed damage per shot! It's less than 1% off.

So, the spreadsheet and your observed average damage per shot line up very nicely.

The question is: why do the endpoint damage values show up less?

Here is a theory. I'm not positive this even makes logical sense so bear with me. Remember the values we're concerned with are limited to:

2
3
4
5

Let's say fractional damage is how it works. What if the first shot does something like 4.x damage. You're going to see 4 presented in-game. But the x value is still there.

Now the next shot does 2.y damage. What happens if x+y < 1? You see 2 presented, and x+y is now hanging around as the fractional value. But... if x+y > 1, then you don't see 2 presented, you see 3 presented, and the remainder is x+y-1.

So a value of 2 being presented doesn't happen that often. It only shows up if a true 2.x damage value is rolled, AND the combined remainder doesn't bring it up to the next threshold.

But 3 and 4 don't have this problem. They get presented any time their true damage value is rolled and the combined remainder is < 1, OR the next lowest number is rolled and the combined fractional value is > 1 which brings it up to the next highest number.

Similarly, 5 doesn't happen that often because it depends on 4.x being rolled AND a combined remainder of > 1, so it can be presented in game as 5.

So if that makes any sense, it would explain what you're seeing.

(edited once for clarity)
Reply



Forum Jump: