Results 1 to 7 of 7

Thread: balanced randomness in trigger firing?

Hybrid View

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

    Default balanced randomness in trigger firing?

    Hello all,
    afaik all triggers are processed in order of appearance is that right?

    Given you have two triggers affecting two different traits which exclude each other (by AntiTrait or by Condition). Both Triggers have a 50% chance to fire...
    Code:
    Trigger a_1
      Condition Trait B < 1
      Affects A 1 Chance 50
    Trigger b_1
      Condition Trait A < 1
      Affects B 1 Chance 50
    I found trait A is more Common than trait B. I guess it is because a_1 is tested first and b_1 is tested against what's left, having only a 50 percent chance of firing itself... so the chances of the second trigger are in fact decreased. (remember Monty Hall? )
    Over multiple turns, the first trigger will fire way more often than the second one.

    So how do you create a balanced randomness in the firing of triggers, when the (very determined ) order of appearance is a key factor?
    How about decreasing the chance of firing, doubling the number of triggers and write them down in alternating order:
    Code:
    Trigger a_1
      Condition Trait B < 1
      Affects A 1 Chance 25
    Trigger b_1
      Condition Trait A < 1
      Affects B 1 Chance 25
    Trigger b_2
      Condition Trait A < 1
      Affects B 1 Chance 25
    Trigger a_2
      Condition Trait B < 1
      Affects A 1 Chance 25
    Would that increase the variety of A and B?
    Or would that only make B more common?

    thanks for any help...
    ~Marcus Vipsanius Agrippa
    No spamming since 63 BC

  2. #2

    Default Re: balanced randomness in trigger firing?

    Try this:
    Code:
    Trigger a_1
      Affects A 1 Chance 50
    Trigger b_1
      Condition Trait A < 1
      Affects B 1 Chance 100

  3. #3

    Default Re: balanced randomness in trigger firing?

    Quote Originally Posted by Aradan View Post
    Try this:
    Code:
    Trigger a_1
      Affects A 1 Chance 50
    Trigger b_1
      Condition Trait A < 1
      Affects B 1 Chance 100
    That would be an "if ... else ..." condition, dropping the third opportunity: that nothing happens.
    What I am trying to achieve is an equal chance for two traits to appear or not... reset every turn.
    But the latter triggers have no fair chance in this race...
    ~Marcus Vipsanius Agrippa
    No spamming since 63 BC

  4. #4

    Default Re: balanced randomness in trigger firing?

    Then why not use your original trigger? If the game code that handles these calculations works properly, then each check is independent of the previous (a new random number is generated at every check), so both traits have the same chances.

  5. #5
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: balanced randomness in trigger firing?

    Do you want each to happen an equal number of times, where one of the two must happen? If so Aradan's suggestion is the way to go. If you want three mutually exclusive outcomes, A or B or nothing, each occuring with equal probability you need to do it as follows:

    trigger 1
    affects A 33%

    trigger 2
    if A = 0
    affects B 50%
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  6. #6

    Default Re: balanced randomness in trigger firing?

    thank you both for your help!

    Quote Originally Posted by SquidSK View Post
    If you want three mutually exclusive outcomes, A or B or nothing, each occuring with equal probability [...]
    Yes, that's what I had in mind. I'll try out your solutions and report back with the results...
    thanks again.
    ~Marcus Vipsanius Agrippa
    No spamming since 63 BC

  7. #7
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: balanced randomness in trigger firing?

    I can tell you the results, it works, as I use the same thing for traits, it works on conditional probability. A happens 1/3 of the time, that I think is pretty obvious. Of the other 2/3rds of the time B happens half the time and 1/2 * 2/3 = 1/3, which leaves the remaining third for nothing. This can be extended up to however many exclusive outcomes you want, but the conditions get longer and longer. The most I've done it with is 7 traits, where one should be picked randomly but each should be picked equally.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

Posting Permissions

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