Announcement

Collapse
No announcement yet.

producing a decent random number generator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    producing a decent random number generator

    so i have heard about varios ways of producing a random number generator but most have failed
    a few have worked (baerly)
    so i am creating a thread to come up with a really good number generating system (can i just call that a NGS?) please do not wave somthing already made in my face, please.
    i was thinking if we all put our brains together we could come up with somthing really great.
    Didn't you know? The living are just the dead that haven't stopped breathing.

    Check out DoTB! Its OP.

    http://www.pavilionboards.com/forum/...play.php?f=205

    #2
    Re: producing a decent random number generator

    It's cool of you to bring this up, but the reason that a "perfect" RNG hasn't been made for RM3 is technical, it's not a design issue.

    Because a creator cannot access the software's RNG system, some type of action (or passive action, like letting time pass or acquiring an item) needs to be taken by the player to change the RNG.

    The more places this action triggers an RNG change, the slower your game will be and the more space you'll lose to create content.

    I still think it's worth it because I feel a game where you don't know what's going to happen next is a lot more fun than a deterministic one.

    But I think a "good" RNG is good enough--my criteria for that being that you can repeatedly trigger the same event without being able to predict what will happen and won't happen. I could, for example, create a game of rock-paper-scissors, where you'd have an extremely hard time figuring out a pattern of the Random AI's choices, and even if you did, the pattern wouldn't last forever.

    I've already accomplished this by using multiple variables which change over time, change randomly with unrelated events, and cause each other to change at certain values. I think Perversion has accomplished something similar, and there may be other creators who have done it as well.

    If you wanted to make something "perfect", you'd have to tap into the software's RNG, which I'm guessing is only activated in damage/hit calculations, initiating default random battles, and giving out Treasure after battle. And to use that kind of system (let's say where you start a battle with 1HP, monster has 1HP, and you have one chance to make a hit) for every random branch you want to create would be horribly unwieldy.


    How Badly Do You Want It? (VX Ace) is now available for download! - no outside software necessary.

    "I live and love in God's peculiar light." - Michelangelo

    Comment


      #3
      Re: producing a decent random number generator

      i was thinking i could use varibles and number modifying events to make random numbers like so:
      event 1 modifys variable one and variable one modifys varible 2 say variable one was 1 then variable 2 would be 1 but if variable 1 was 2 then variable 2 would be either 0 or 2 depending on some other outside force then say if variable 2 was 1-4 you would lose money if variable 2 was 4-8 you would keep your money but if it was 8-10 you would win. then change the variable with another RNG and your in busness.
      i dont sound to complex do i?
      Last edited by Spirit; 08-12-2010, 07:38 PM.
      Didn't you know? The living are just the dead that haven't stopped breathing.

      Check out DoTB! Its OP.

      http://www.pavilionboards.com/forum/...play.php?f=205

      Comment


        #4
        Re: producing a decent random number generator

        Originally posted by the spirit of fate View Post
        i was thinking i could use varibles and number modifying events to make random numbers like so:
        event 1 modifys variable one and variable one modifys varible 2 say variable one was 1 then variable 2 would be 1 but if variable 1 was 2 then variable 2 would be either 0 or 2 depending on some other outside force then say if variable 2 was 1-4 you would lose money if variable 2 was 4-8 you would keep your money but if it was 8-10 you would win. then change the variable with another RNG and your in busness.
        i dont sound to complex do i?
        You don't sound too complex at all. Like I said, this has essentially been done.

        My favorite way is to keep increasing the value of the variables rather than use the modify command, then have a branch which constrains the variable to a maximum value. For example, if time goes by and variable 1 (varies between 1 and 5) is less than or equal to 3, you increment variable 2 (varies between 1 and 10) by 7; otherwise you increase it by 4. Then, if Variable 2 is equal to 11 or more, you subtract 10 from it.

        This makes it very easy to work with odds and almost allows you to escape any biases of variables moving together, so if you want the player to have a 2% chance to do something, have it only occur when variable 1 = 5 and variable 2 = 10. Or if you want a 40% chance, have it occur whenever variable 2 >= 7.


        How Badly Do You Want It? (VX Ace) is now available for download! - no outside software necessary.

        "I live and love in God's peculiar light." - Michelangelo

        Comment


          #5
          Re: producing a decent random number generator

          Hmmm...never really thought about using the passage of time to factor into making a PRNG (pseudo random number generator). In the two released games (and probably 2 other unreleased projects) to use a PRNG, I've inserted variable changes for the "random" numbers within choice branches, and also nested them within OTHER "random" number outcomes.


          Basically, in order to use a system like this, there almost NEEDS to be some sort of list of questions at the beginning of the game to determine the initial "random" values, especially if the game is fairly linear. I know I did this in ASA, and Wave did this in Hell's Dining Room.

          Once you set the initial variable values (I like having at least 3 variables reserved for "random" numbers...usually a 0-1 (50%), a 0-9 (10%), and sometimes another 0-9, which will allow a 1-100% number if used in conjunction with the first one), you can use any decision or choice branch to determine the new variable value.


          For instance, if your initial values are 1 (for the 0-1), 4 (for the first 0-9), and 7 (for the second 0-9), in the first choice branch, you can do a variable check through nested val cond branches. So let's say the choice branch is a yes or no question. You have 2 options here. Let's say the player picks Yes. Now you can make a branch checking the first variable. If it equals 0, then you can move to another mode to check the 0-9 number, and under each of those ten possibilities, you can have ANOTHER variable check for the next 0-9.


          Basically, under Yes, there are 2 places to change the value at base level, and the same under the No choice. So already, there's a 1 out of 4, or 25% ability to choose any "random" variable you wanted. Under each of those you can have 10 more (0-9) opportunities to influence the "random" variable(s). So in this first choice branch alone, as you can see, it's realistically possible to have 40 different outcomes for any one variable. Of couse, within those nested branches, you can check the 0-1 again (assuming it changed already, and have it change one of the other "random" variables based on the outcome.


          Of course, this is just a basic framework for determining the values so they are constantly changing. It of couse does not take into account how you wish to use those "random" numbers. The best advice I can give for making a decently transparent PRNG is to use at least 3 variables for these "random" numbers, check and change them early and often, and use a LOT of nested branches. Otherwise, you'll start seeing patterns show up very quickly, which is a problem, especially if you are using the "random" numbers in minigames like games of chance (drawing cards, rock/paper/scissors, etc).


          Spirit, if you are still working on that economy system and are trying to use "random" numbers within that, it's not quite as big of a deal to make a PRNG system that's that complex, as most of the machinations will most likely be invisible to the player's eye.

          Comment


            #6
            Re: producing a decent random number generator

            Originally posted by Perversion View Post
            Hmmm...never really thought about using the passage of time to factor into making a PRNG (pseudo random number generator). In the two released games (and probably 2 other unreleased projects) to use a PRNG, I've inserted variable changes for the "random" numbers within choice branches, and also nested them within OTHER "random" number outcomes.
            Yep. For example, remember the "clock ticks" effect in Hell's Dining Room (which was used to make customers ready for the next course, or make them angry if they haven't been served yet)? There was also some RNG logic in there. The purpose was that if you did the exact same things in the game (including the questions at the beginning), but did it at a different speed, you'd still end up with a wildly different experience.

            Basically, in order to use a system like this, there almost NEEDS to be some sort of list of questions at the beginning of the game to determine the initial "random" values, especially if the game is fairly linear. I know I did this in ASA, and Wave did this in Hell's Dining Room.
            Yeah, there needs to be some sort of way to seed the RNG at the beginning. Otherwise, the first few RNG events may end up the same way each time you play the game. Another example is Obright's Pavilion Iron Chef (using questions to decide which judges to give you for the first round). Anyone know of any other games besides mine, Perversion's, and Obright's, that use this?

            In RPGM1 and 2 (and XP, I assume), there are either randomization branches or actual RNG commands that you can use, so there's no need for these questions, or the complicated workarounds that we're describing for RPGM3.

            Of course, this is just a basic framework for determining the values so they are constantly changing. It of couse does not take into account how you wish to use those "random" numbers. The best advice I can give for making a decently transparent PRNG is to use at least 3 variables for these "random" numbers, check and change them early and often, and use a LOT of nested branches. Otherwise, you'll start seeing patterns show up very quickly, which is a problem, especially if you are using the "random" numbers in minigames like games of chance (drawing cards, rock/paper/scissors, etc).
            Really good advice, that is. One thing I'll throw in: if you're using it in a minigame that people may play over and over, make sure all of the numbers are changing each time you play, and make sure the numbers don't fall into a pattern on multiple plays (for example, if your random number is between 1 and 10, and you keep changing it by 5 each time, it will go 2 -> 7 -> 2 -> 7 -> 2 -> 7 etc.) Use numbers which don't divide evenly into your variable limit (like 7 if the number goes between 1 and 10, or 3 if it goes between 1 and 5), and try to introduce as many places to "mess up the pattern" as possible.

            Spirit, if you are still working on that economy system and are trying to use "random" numbers within that, it's not quite as big of a deal to make a PRNG system that's that complex, as most of the machinations will most likely be invisible to the player's eye.
            DU will probably be the biggest problem you'll run into...


            How Badly Do You Want It? (VX Ace) is now available for download! - no outside software necessary.

            "I live and love in God's peculiar light." - Michelangelo

            Comment


              #7
              Re: producing a decent random number generator

              Even using a decently complex PRNG is gonna chew up DU extremely quickly. I know for ASA, which is, boiled down to its most basic, about 12 or so minigames, at least half of which incorporate a PRNG to some extent. If memory serves, I was at over 60% DU for the game, most of which was used by the PRNG system.


              I'm going off memory, so the exact details might be a bit off, but DU is a major concern if you try to do anything complex with a PRNG.

              Comment


                #8
                Re: producing a decent random number generator

                what if you had an auto event that starts when you enter the room and has several wait events in it like this

                increase variable 1
                wait
                increase variable 1
                wait

                and so on
                using this system you could make a random number based on how long the player stays in one area or dungion and how long it takes for the player to find the event that the variable effects.
                if you made the wait events short enough it would be impossible to guess what the number is

                that is unless you are a robot
                but that would never be the case
                (right?)
                Didn't you know? The living are just the dead that haven't stopped breathing.

                Check out DoTB! Its OP.

                http://www.pavilionboards.com/forum/...play.php?f=205

                Comment


                  #9
                  Re: producing a decent random number generator

                  You would have to have an auto event with several modes, each of which was an auto event with the trigger being a certain time of day like noon or night, for instance. Then in each mode you could modify a variable as well as changing to the next mode.

                  That might do what you are saying, if I'm reading things right.

                  If you tried to have an event, as you say,

                  Increase Variable 1
                  Wait
                  Increase Variable 1
                  Wait

                  You will have to wait until the event has gone through all of its paces before you can go anywhere.
                  Last edited by Pagerron; 08-15-2010, 08:29 PM.
                  " I am the way, the truth, and the life. No one comes to the Father but by me. " - Jesus

                  Comment


                    #10
                    Re: producing a decent random number generator

                    Originally posted by the spirit of fate View Post
                    what if you had an auto event that starts when you enter the room and has several wait events in it like this

                    increase variable 1
                    wait
                    increase variable 1
                    wait

                    and so on
                    using this system you could make a random number based on how long the player stays in one area or dungion and how long it takes for the player to find the event that the variable effects.
                    if you made the wait events short enough it would be impossible to guess what the number is

                    that is unless you are a robot
                    but that would never be the case
                    (right?)
                    I've never used the "Wait" command.

                    Can you control the player while an Event it "wait"ing?


                    How Badly Do You Want It? (VX Ace) is now available for download! - no outside software necessary.

                    "I live and love in God's peculiar light." - Michelangelo

                    Comment


                      #11
                      Re: producing a decent random number generator

                      Originally posted by Wavelength View Post
                      I've never used the "Wait" command.

                      Can you control the player while an Event it "wait"ing?
                      Bump.

                      Can you do this?

                      If so, it would provide a reliable way to make a timed event while allowing the time of day to remain as "deafult". This would be great.


                      How Badly Do You Want It? (VX Ace) is now available for download! - no outside software necessary.

                      "I live and love in God's peculiar light." - Michelangelo

                      Comment

                      Working...
                      X