Results 1 to 17 of 17

Thread: Chance of success and random numbers

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Chance of success and random numbers

    Every now and then we come across a story where your agent fails to succeed for ten, twenty or a hundred times in a row and it makes you wonder if the game does employ the use of a random number generator or not. For example:

    Quote Originally Posted by FootSoldier View Post
    In the current campaign I set my princess, with charm of 6, to seduce an HRE general having a 53% chance of success. She failed on 10 attempts the first turn (I saved and loaded). She failed on 15 attempts the second turn. I concluded that the game was not going to allow this regardless.
    I can tell you for a fact that the game does in fact use a random number generator. But understanding it can spoil the game, hence the spoiler.

    Spoiler Alert, click show to read: 
    Before I get down to the details, let us first have another couple of examples.

    • Save the game (ctrl+s for quicksave) and the load it (ctrl+l for quickload) and then end the turn. If you have a lot of Faction Announcements at the start of the turn, so much the better and take note of them. Then reload (ctrl+l if you had used the quicksave) and then end the turn again and observe the Faction Announcements. They will be identical. Exit M2TW, start M2TW again, load the save file, end the turn and observe the Faction Announcements. They will be identical.
    • Prepare your armies to fight a series of battles, quicksave, quickload, and auto-calculate the series of battles and copy the results of enemies killed by your units in the detailed statistics. You can copy more or all of the statistics if you wish, but enemies killed is enough. Quickload and auto-calculate the same series of battles and compare the results. They will be identical.



    Or to put it another way

    Let's load a game and assume M2TW draws the follow sequence of random numbers (for illustrative purposes):
    1, 2, 3, 4, 5, 6, 7, 8, 9, 10

    Now if we reload, and have M2TW draw another sequence of random numbers, it will again draw:
    1, 2, 3, 4, 5, 6, 7, 8, 9, 10

    Instead of perhaps:
    4, 5, 6, 2, 4, 3, 5, 3, 9, 1


    The lesson

    What we have learned here is that if you load and then send your princess to seduce a general but she fails, she will always fail to do so on subsequent reloads because of the way the game draws its random numbers.


    How do we deal with this?

    There are many ways to avoid using the same numbers.

    • Like moving any unit out of and into a settlement. Each time you do this, it will consume one of the random numbers. For example, instead of "1, 2, 3, 4, 5, ...", the movement of the unit will consume "1" and leave the remaining "2, 3, 4, 5, ...".
    • Another method is to save again and then load. I'm not sure how this method alters the numbers, but it does.
    • Another method is to let other agents that have a much higher chance of success to execute their mission first, like spying on a settlement, to consume a bad number and then try again.


    Using such knowledge, it is not impossible to assassinate all of the Mongol generals in one turn with a bunch of assassins. But it may take quite a lot of effort as you will still need to game the random numbers to give you the necessary winning numbers. It is a lot easier to ensure your spy with a 95% chance to infiltrate a settlement.

    I hope this was readable and understandable.

  2. #2
    Double A's Avatar person man
    Join Date
    Jan 2008
    Location
    Northern Cackalackistan
    Posts
    23,338

    Default Re: Chance of success and random numbers

    It's much more simple than that.

    The Random Number God is not pleased with you. You must make sacrifices of D20s to him.
    Jon had taken Donal and Benjen’s advice to heart: Sam may be fat and pathetic, but he is still a member of the watch, and one of the few black brothers who isn't a rapist or thief. (out of context, this sounds ridiculously racist)
    super awesome music thing | political profile
    GSTK member - Join today! (We're restarting. Again.)

  3. #3

    Default Re: Chance of success and random numbers

    He may not be pleased with me but I do make sacrifices of my time and effort to Lady Luck, who wears the pants in that pantheon, and she seems to treat me fairly enough.

  4. #4
    Double A's Avatar person man
    Join Date
    Jan 2008
    Location
    Northern Cackalackistan
    Posts
    23,338

    Default Re: Chance of success and random numbers

    Quote Originally Posted by painter View Post
    He may not be pleased with me but I do make sacrifices of my time and effort to Lady Luck, who wears the pants in that pantheon, and she seems to treat me fairly enough.
    Dude... you realize that you will never roll a 20 again, because you said that he doesn't wear the pants, right?
    Jon had taken Donal and Benjen’s advice to heart: Sam may be fat and pathetic, but he is still a member of the watch, and one of the few black brothers who isn't a rapist or thief. (out of context, this sounds ridiculously racist)
    super awesome music thing | political profile
    GSTK member - Join today! (We're restarting. Again.)

  5. #5

    Default Re: Chance of success and random numbers

    Not with Lady Luck glaring at him with a whip in hand.

  6. #6
    Double A's Avatar person man
    Join Date
    Jan 2008
    Location
    Northern Cackalackistan
    Posts
    23,338

    Default Re: Chance of success and random numbers

    RNG wears the pants.
    Jon had taken Donal and Benjen’s advice to heart: Sam may be fat and pathetic, but he is still a member of the watch, and one of the few black brothers who isn't a rapist or thief. (out of context, this sounds ridiculously racist)
    super awesome music thing | political profile
    GSTK member - Join today! (We're restarting. Again.)

  7. #7

    Default Re: Chance of success and random numbers

    Wow, that was illuminating ... in principle if not in detail :d

    So, 25 failures to seduce across 2 turns has a logical explanation that excludes pre-determinism. It is simply the way that the game engine draws the numbers controlling/modifying the outcomes, and I can stop frowning at the developers ... (will my game identity survive this?)

    If I understood correctly, the numbers determining outcomes remain the same over successive reloads so that the original outcome is repeated. In order to change the outcome the player has to undertake other actions that "consume" some of the random numbers.

    Does this mean that the game engine draws a set of random numbers at the start of each turn, and they are applied in sequence to whatever situation requires them? (Presumably that would be a long string ... errr ... large number of such in say, the late campaign).

    Does it also mean that the number is a modifier, and the outcome is adjusted depending on the probability for the action? For example, if the third number was being used, let's say 3, and for a spying mission with probability of 95% that number might result in a success, while for an assassination mission with a probability of 7% it would result in a failure. In other words, the number 3 is a modifier, but doesn't in and of itself determine the outcome?

    Why does moving a unit out of a town consume one of these numbers? Is there a probability in this action, or is it that each action consumes one of these numbers regardless of whether probability is involved or not?

    Did I understand correctly?

    I'd give rep, but I don't know how/may not be allowed to do this yet.

    (Incidentally, saving and reloading in M1TW did not produce the same outcome each time. Ship battles were notorious as fixed on the forums, but also things like the set of traits - vices and virtues - that a maturing family member started with. If you were dissatisfied with the traits and reloaded they would become worse. Once you ended up with the worst two - chinless wonder (inbred) ... and ... hmm ... I've forgotten the other ... it would come down to one or the other. Successive reloads would offer only one or the other which were very damaging to the general, and if it was the faction heir coming of age then damaging to the kingdom/empire. Once king, these traits were an adjuster that affected overall loyalty of provinces and generals, income from trade and farming etc. and they had way more affect than the traits in M2TW.)

  8. #8

    Default Re: Chance of success and random numbers

    Quote Originally Posted by FootSoldier
    So, 25 failures to seduce across 2 turns has a logical explanation that excludes pre-determinism. It is simply the way that the game engine draws the numbers controlling/modifying the outcomes, and I can stop frowning at the developers ... (will my game identity survive this?)
    Yes. (Hopefully it will.)

    Of course, in issues like using diplomacy to demand vassalage, that I do not know how the random numbers are factored in. Nor do I know if it is possible at all to get some sequence of magic numbers that will allow a single peasant unit to heroically drive off three stacks of Mongols in the same battle; but I presume not and will not even try.

    Quote Originally Posted by FootSoldier
    If I understood correctly, the numbers determining outcomes remain the same over successive reloads so that the original outcome is repeated. In order to change the outcome the player has to undertake other actions that "consume" some of the random numbers.
    Yes.

    Quote Originally Posted by FootSoldier
    Does this mean that the game engine draws a set of random numbers at the start of each turn, and they are applied in sequence to whatever situation requires them? (Presumably that would be a long string ... errr ... large number of such in say, the late campaign).
    Not necessarily. In computing, most random numbers generators are of the "pseudo" type, generating seemingly random numbers via an algorithm. For some weaker pseudo-RNG, if given the same initial "seed", they will reliably generate the same sequence of numbers. I assume that this is the case for M2TW.

    Quote Originally Posted by FootSoldier
    Does it also mean that the number is a modifier, and the outcome is adjusted depending on the probability for the action? For example, if the third number was being used, let's say 3, and for a spying mission with probability of 95% that number might result in a success, while for an assassination mission with a probability of 7% it would result in a failure. In other words, the number 3 is a modifier, but doesn't in and of itself determine the outcome?
    I suppose only a programmer with access to the source codes would be able to tell for sure. Perhaps I should have prefaced my explanation with that the game doesn't necessarily draw random numbers from a range of 1 to 10 as I had used in my examples, but may instead use some other system.

    Either way, other than to sate ones curiosity, it doesn't really matter to us as we can't influence the generation of the random numbers. What matters is knowing how you may alter the results.

    Quote Originally Posted by FootSoldier
    Why does moving a unit out of a town consume one of these numbers? Is there a probability in this action, or is it that each action consumes one of these numbers regardless of whether probability is involved or not?
    I can only guessed that it consumed a number to generate the captain's name. Actions like moving a unit already in the field does nothing. If you lost a battle and the enemy has taken captives, accepting or denying the ransom doesn't consume a number. Using the "create_unit" cheat consumes a number and disbanding a unit doesn't.

    Using this information is how I concluded that the order of the units in your army does have an effect in auto-calculating the battles in another old discussion.

  9. #9

    Default Re: Chance of success and random numbers

    Oh, painter - please post the link to how the order of units in the army affects the auto-calc. I MUST know this :d

  10. #10

    Default Re: Chance of success and random numbers

    Here is the link: Re: Moving Unit Cards For A Single Army?

    However, I should say that I did not actually researched how you should order your army for the best auto-resolve results, only that it did had an effect on the results (different numbers).

  11. #11

    Default Re: Chance of success and random numbers

    painter - thanks for this and other illuminating posts. rep here even if i can't give it elsewhere.

  12. #12

    Default Re: Chance of success and random numbers

    You're quite welcomed regardless. Saving some people from getting frustrated over this would be enough.

    Also, not that I am a rep whore, but you should be able to rep people by now. There should be a little green button at the bottom left of the post, below the poster's name, that you wish to rep. From the FAQ#Reputation.

  13. #13
    Incomitatus's Avatar Ducenarius
    Join Date
    Jul 2007
    Location
    Tahoe, NV
    Posts
    916

    Default Re: Chance of success and random numbers

    Please note that the first reload *will* reset the number generator. It is subsequent reloads that will not (they will load with the second set of numbers every time). Hence you can reduce your finagling by half.
    Homo sum: humani nihil a me alienum puto. - Terence

    My M2:TW 4TPY Script, Adapted to Work With Hotseat.


    Guides and Useful Posts of Mine
    Middle Earth Strategikon (M2:TW: TATW 3.2)(WIP: ~60% Complete)
    Advice on Playing as Gondor - Part I - Part II (M2:TW: TATW 3.2)
    Dirty Secret to Killing Trolls Fast and Easy (M2:TW: TATW)
    The Basics of Naval Engagements Part I - Part II (EMPIRE: DMUC)
    Roman Army Composition and Use (RTW: RTR Platinum)

  14. #14
    Double A's Avatar person man
    Join Date
    Jan 2008
    Location
    Northern Cackalackistan
    Posts
    23,338

    Default Re: Chance of success and random numbers

    Then why is it that whenever I have a 95% chance and fail, reload and retry, I still get the same result?
    Jon had taken Donal and Benjen’s advice to heart: Sam may be fat and pathetic, but he is still a member of the watch, and one of the few black brothers who isn't a rapist or thief. (out of context, this sounds ridiculously racist)
    super awesome music thing | political profile
    GSTK member - Join today! (We're restarting. Again.)

  15. #15
    Incomitatus's Avatar Ducenarius
    Join Date
    Jul 2007
    Location
    Tahoe, NV
    Posts
    916

    Default Re: Chance of success and random numbers

    Quote Originally Posted by Double A View Post
    Then why is it that whenever I have a 95% chance and fail, reload and retry, I still get the same result?
    You don't. It just seems that way because of confirmation bias. In short, if you believe something works a certain way, you will tend to perceive it working that way by selectively remembering the times it does work that way and selectively forgetting the times it doesn't. If you keep a written log of what happens every time you save and reload and retry an action, you will quickly notice that second attempts often differ from first attempts while third, fourth, and so on attempts always repeat the second result (it's better to test this with assassins since there are three outcomes -succeed, fail and escape, fail and die).

    I have begun to suspect that the game sometimes misreports the odds, that there are other factors taken into account that are not reflected in the % chance, but that could be my own subjective bias. It still would not surprise me if difficulty level had an unreported effect.
    Homo sum: humani nihil a me alienum puto. - Terence

    My M2:TW 4TPY Script, Adapted to Work With Hotseat.


    Guides and Useful Posts of Mine
    Middle Earth Strategikon (M2:TW: TATW 3.2)(WIP: ~60% Complete)
    Advice on Playing as Gondor - Part I - Part II (M2:TW: TATW 3.2)
    Dirty Secret to Killing Trolls Fast and Easy (M2:TW: TATW)
    The Basics of Naval Engagements Part I - Part II (EMPIRE: DMUC)
    Roman Army Composition and Use (RTW: RTR Platinum)

  16. #16

    Default Re: Chance of success and random numbers

    That may still happen occasionally because of the probabilities, unlikely but possible. But if you are able to consistently repeat that for many different missions there may be some misunderstanding here. As it is, when I fail my 95% spy missions for the first time, the first reload usually has my spy succeeding.

  17. #17

    Default Re: Chance of success and random numbers

    I think it doesn't, or at least isn't that bad. After buying map information from Turkey, I sent one of my better spies to spy on Yerevan. While it was still shrouded in the fog of war, the reported chance of success was 50%. That was borne out later when my spy got near enough for my assassin to show two Turkish spies in the city as targets.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •