Are you, in fact, a pregnant lady who lives in the apartment next door to Superdeath's parents? - Commodore

Create an account  

 
Explorations with the Tweaker

The Real-Time Game Tweaker gives you an inside view into the kitchen of MoM.
Many questions about how things work can be answered by the Tweaker.

1. For instance, how does suppression work exactly?
Does a hit without damage count?
Does a ranged hit with or without damage count?

2. Or which spells stack and which spells do not?
Does Prayer stack with High Prayer? Or with Holy Bonus?

3. If flyers attack through a City Wall, do the defenders get a shield bonus?
What about a flyer, or Phantom Beast (illusionary), or Wraith (non-corporeal)?
What kind of bonus does the gatekeeper get?
ANSWER: Given in the post below this one.

4. Can you and if so, how much you can defend against direct damage spells like Fireball (other than Magic Immunity).
Shields and crosses don't seem to help, but apparently there is a random effect involved, which suggests that there may be bonuses that apply.

5. Sprites can hurt a Wyrm in a Node. How is that possible? Statistical analysis dictates that the damage they do is 0.0.
ANSWER: The To Defend bonus of the Wyrm is +0 and not +3 which is its To Hit bonus. That gives the Sprites the opportunity to do actual damage (0.5 +/- 0.9 per round).

6. What does the Difficulty Table do?
These are 40 numbers that look like percentages and they define the advantage the AI has for the various difficulties.
But what do these numbers stand for?

7. What does the "Cavalry" movement attribute do?
Kyrub suggested it might do something if all members of the group have it...

8. What are the chances of getting a hero.
It seems that sometimes this chance is unreasonably low. Is that new with Insecticide 1.40h?
Who else has ideas whether or not these chances are off?
ANSWER: Given in the post below this one.

9. How does the random generator work?
It seems that saving / reloading doesn't always change too much.
And how is it possible that we can reproduce bugs? Shouldn't the random effect prohibit that?


I dedicate this thread to questions about how things work.
And also to stories of explorations that answer these questions.

Do you have any questions? Or answers?
--I like ILSe
Reply

This post is dedicated to the answers to the questions in the top post.

Explorations with the Tweaker Wrote:1. For instance, how does suppression work exactly?
Does a hit without damage count?
Does a ranged hit with or without damage count?

I deduced how suppression works from analyzing disassembly of the code.
I also did some analysis with the Tweaker.
Afaik, suppression works as follows.

When you start combat, each combat round it is first the turn of the defenders, and then the turn of the attackers.
At the beginning of the next combat round, all suppression counters are reset.

Whenever a unit shoots or attacks another unit, the entire attack/counter-attack is handled, including gaze, breath, first-strike, attack, counter-attack.
Afterward the suppression counter of the defender is incremented.

Whenever the defender counter-attacks in defense, he gets a to-hit penalty of his suppression counter divided by 2.
The same thing happens when a unit attacks or shoots: he gets a to-hit penalty of his suppression counter divided by 2.


This means that as the defender you have the advantage.
If a defenders attacks an attacker twice, the attacker counterattacks without penalty.
When afterward the attacker attacks, he does so with a -1 to hit penalty.
The defender gets a suppression counter, but it is reset before it hampers him.


Applying this with unit-versus-unit combat, it turns out it works like this:
1. Defender attacks first time, attacker gets 1 suppression counter.
2. Defender attacks second time, attacker gets 2 suppression counters.
3. Attacker attacks first time at -1 to hit, defender gets 1 suppression counter.
4. Attacker attacks second time at -1 to hit, defender gets 2 suppression counters.
5. Counters are reset (at the beginning of the next combat round).

Explorations with the Tweaker Wrote:3. If flyers attack through a City Wall, do the defenders get a shield bonus?
What about a flyer, or Phantom Beast (illusionary), or Wraith (non-corporeal)?
What kind of bonus does the gatekeeper get?

I've extended the Tweaker with the option to change the City Wall bonus directly, and you already could enable the City Walls while in combat.
With it I explored all the questions. My conclusion is:

  • The gate gives the same bonus that any wall gives (+3 shields).
  • A unit on a broken wall gets +1 shields.
  • The units in the center of the city get +1 shields in Vanilla (ranged attacks), but in Insecticide they get +3 shields.
  • If a flyer hits a unit on a wall from outside the city the wall gives its full bonus (+3 shields).
  • If a non-corporeal unit (Wraith) hits a unit on a wall from outside the city the wall gives its full bonus.
  • If an Illusionary unit (Phantom Beast) hits a unit on a wall from outside the city the wall does not give its bonus. This is because an Illusionary attack does not penetrate a wall, but because Phantom Beast is also non-corporeal, he can attack, and an Illusionary attack ignores the bonus shields.

Explorations with the Tweaker Wrote:8. What are the chances of getting a hero. It seems that sometimes this chance is unreasonably low. Is that new with Insecticide 1.40h?
Who else has ideas whether or not these chances are off?

I've been exploring OSG and "the Source" (Vanilla and Insecticide) to find out what chance we have on gaining a hero. My conclusion is:

At the beginning of the game you have 0.9% chance per turn (while the AI has 3.8%!)
When your fame is up to 25 you have 2.9% chance per turn.
If you're famous you would have 3.9% chance per turn at the start of the game.

The chance is calculated as follows.

The chance on a hero considering to visit you equals (fame / 25 + 3) / ((heroes + 1) / 2 + 1) percent per turn (all divisions are rounded down).
Being Famous increases your fame by +10.
And being Famous also doubles the chance.
Just Cause again increases your fame by +10.
The chance on a hero is capped at a maximum of 10% per turn.
Being the AI bumps the chance up 10% (for a maximum of 20%).

When a hero decides to consider you, he looks whether his (cost hero - 100) / 10 is less than or equal to your fame.
And also if you have Life books or Death books (if the hero is the Priestess, the Paladin, the Black Knight, or the Necromancer).
If you don't meet his requirements he passes you over.
Since there are only 10 fame zero heroes out of 34 possible heroes (excluding Torin), your chances are effectively multiplied by 10/34 at the start of a game.

Beyond that whenever you conquer a lair that is difficult enough you have a chance on finding a hero. Weak lairs on Arcanus will never have a hero, strong lairs and nodes (raw treasure value >= 400) have a minimum of 6.7% chance to find a prisoner.

With a 3% chance per turn, probability theory teaches us that we have 50% chance on a hero showing up in 23 turns (that is 2 years), assuming of course that we had enough cash during that time. In the year 1412 the chance would be 98.8% to get at least 1 hero.

Note that the fact that you are offered an item or mercenaries, does not reduce your chance of getting a hero - they are independent!

Here's the corresponding table.
Code:
Zero heroes   One hero      Five heroes                        
Fame NrAvail Chance Chance Chance Chance Chance Chance NrHired NrHired NrHired MaxPrice MaxPrice
     heroes         Famous        Famous        Famous heroes  heroes  heroes           Charismatic
0      10     0.9    ---    0.3    ---    0.0    ---     0       1       5       100       50
1      10     0.9    ---    0.3    ---    0.0    ---     0       1       5       100       50
2      10     0.9    ---    0.3    ---    0.0    ---     0       1       5       100       50
3      10     0.9    ---    0.3    ---    0.0    ---     0       1       5       100       50
4      10     0.9    ---    0.3    ---    0.0    ---     0       1       5       100       50
5      15     1.3    ---    0.4    ---    0.0    ---     0       1       5       150       75
6      15     1.3    ---    0.4    ---    0.0    ---     0       1       5       150       75
7      15     1.3    ---    0.4    ---    0.0    ---     0       1       5       150       75
8      15     1.3    ---    0.4    ---    0.0    ---     0       1       5       150       75
9      15     1.3    ---    0.4    ---    0.0    ---     0       1       5       150       75
10     20     1.8    3.5    0.6    1.2    0.0    0.0     0       1       5       200      100
15     20     1.8    3.5    0.6    1.2    0.0    0.0     0       1       5       200      100
20     25     2.2    4.4    0.7    1.5    0.0    0.0     0       1       5       300      150
25     25     2.9    5.9    1.5    2.9    0.7    1.5     0       1       5       300      150
30     25     2.9    5.9    1.5    2.9    0.7    1.5     0       1       5       300      150
40     33     3.9    7.8    1.9    3.9    1.0    1.9     0       1       5       500      250
50     33     5      10     2      4      1.0    1.9     0       1       5       500      250
75     33     6      10     3      6      1.0    1.9     0       1       5       500      250
100    33     7      10     3      6      1.0    1.9     0       1       5       500      250
125    33     8      10     4      8      1.9    3.9     0       1       5       500      250
150    33     9      10     4      8      1.9    3.9     0       1       5       500      250
175    33     10     10     5      10     1.9    3.9     0       1       5       500      250
200    33     10     10     5      10     1.9    3.9     0       1       5       500      250
300    33     10     10     7      10     2.9    5.8     0       1       5       500      250
400    33     10     10     9      10     3.9    7.8     0       1       5       500      250
500    33     10     10     10     10     4.9    9.7     0       1       5       500      250
600    33     10     10     10     10     5.8    9.7     0       1       5       500      250
700    33     10     10     10     10     6.8    9.7     0       1       5       500      250
800    33     10     10     10     10     7.8    9.7     0       1       5       500      250
900    33     10     10     10     10     8.7    9.7     0       1       5       500      250
1000   33     10     10     10     10     9.7    9.7     0       1       5       500      250


Jtm and I reverse-engineered the random algorithm.
This is the result:

Code:
uint32_t seed = 0x2A57;

uint16_t MOM_RNG(uint16_t n)
{
    uint16_t value = 0;
    for (uint16_t cx = 9; cx > 0; --cx)
    {
       uint32_t newbit = ((seed ^ (seed >> 1) ^ (seed >> 2)
                                ^ (seed >> 4) ^ (seed >> 6) ^ (seed >> 31)) & 1);
       value = ((value << 1) | newbit);
       seed = ((seed >> 1) | (newbit << 31));
    }
    if (seed == 0)
       seed = 0x30BE;
  
    uint16_t ret = (value % n) + 1;
    
    return ret;
}
We used dosbox-heavydebug to generate a number of random samples and the function above reproduces that exactly (as expected).

Btw, when you reload, the seed it is reinitialized to the DOS clock, which ticks 18.2 times per second and is reset at midnight.
You can observe the behavior in the Game-Data section of the Tweaker.
--I like ILSe
Reply

Is the +1 bonus from City Walls a shield bonus, or something like toHit bonus ? It should be possible to create a hero with +7 to hit and 10 attack, place a Phantom Beast in defending city, and repeat a couple of times.

How does Charmed ability work: +30 crosses only against binary spells ? (no effect against ranged attacks, poison etc) ?
Reply

b0rsuk Wrote:Is the +1 bonus from City Walls a shield bonus, or something like toHit bonus ? It should be possible to create a hero with +7 to hit and 10 attack, place a Phantom Beast in defending city, and repeat a couple of times.

I was thinking of making the defense bonuses of City Wall viewable and changeable from the Tweaker. Either way you can change it with a hex editor in wizards,exe (offset 0x099F4C which holds the value 03)
With the Tweaker you can already flip City Walls on (before battle), and you can already change any unit into any other unit, although that is tricky to do from combat, so that should be done before battle.

b0rsuk Wrote:How does Charmed ability work: +30 crosses only against binary spells ? (no effect against ranged attacks, poison etc) ?

The Tweaker won't tell you how Charmed works. However, you can see the effect of various ablities and spells in the "Battle Units" view of the Tweaker (in combat). It shows in detail which extra bonuses apply.

As for Charmed, the manual says that the unit will never fail a resistance roll. That means the unit will never get stoned, death-gazed, poisoned, confused, weakened, etcetera.
As for crosses (from the manual and I have no reason to think it works otherwise - do you?), each cross gives 10% resistance, with 10 crosses giving 100% resistance. Since usually the worst -to save penalty is -4, that means that 14 crosses equals Charmed and more crosses won't help (except against heroes using wands or staves).

Another question I have, is whether and how much you can defend against direct damage spells like Fireball (other than Magic Immunity). Shields and crosses don't seem to help, but apparently there is a random effect involved, which suggests that there may be bonuses that apply. Anyone?
--I like ILSe
Reply

I always thought boosting resistance would protect against direct damage spells. Maybe I was just imagining that, though.
Reply

luddite Wrote:I always thought boosting resistance would protect against direct damage spells. Maybe I was just imagining that, though.

Yes I thought so too, but then 15 crosses or Charmed should protect you 100%, but I know for sure that it doesn't.
--I like ILSe
Reply

I like Serena Wrote:3. If flyers attack through a City Wall, do the defenders get a shield bonus?
What about Phantom Beast (illusionary) or Wraith (non-corporeal)?
What kind of bonus does the gatekeeper get?

I have just added in a direct view of the battlefield in the Tweaker (not uploaded yet).
It turns out that you can set each part of the wall to three choices:
01 = No Wall
02 = Whole Wall
03 = Broken Wall
It's funny to see how you build and unbuild, break and repair interactively any section of the wall lol.

In particular the gate has a whole and broken form as well.
I think this means that the gate in its unbroken form will give a +3 bonus.
--I like ILSe
Reply

Let's make it mandatory to have a wall crusher in your army if you want to enter a walled city :P
Reply

Catwalk Wrote:Let's make it mandatory to have a wall crusher in your army if you want to enter a walled city :P

I really like that idea and it's historically correct. 8)
Pity the AI won't understand it (or could it Kyrub?).
--I like ILSe
Reply

I like Serena Wrote:2. Or which spells stack and which spells do not?
Does Prayer stack with High Prayer? Or with Holy Bonus?

Experiments with the Tweaker show that Prayer and High Prayer do NOT stack.
With both spells active you still have only +1 To Hit and +1 To Defend.

However, Lucky stacks with either Prayer or High Prayer, giving you +2 To Hit and +2 To Defend.
Obviously Lucky is rather good!
--I like ILSe
Reply



Forum Jump: