Announcement

Collapse
No announcement yet.

how do you plug a pseudo-random number generator up into minigames?

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

    how do you plug a pseudo-random number generator up into minigames?

    I've compiled all I need to make a PRNG (my new acronym for Pseudo-Random Number Generator.), and I plan to make a card battler and a board game. but how do I do it?


    "You're dead if you aim only for kids. Adults are only kids grown up, anyway."
    -Walt Disney

    #2
    Re: how do you plug a pseudo-random number generator up into minigames?

    I'm using two variables that I add arbitrary amounts to in nearly every event in the game. (When they get above certain amounts, I reset them to zero.) When an event requires "randomness," I do it based upon the current value of those variables. If those events are repeatable, I'll usually do something weird like change one variable based on the value of the other, in order to prevent patterns.

    You can also change the variable every time the game gets to "Morning" or "Night" using Auto commands, in order to prevent an informed player from "abusing" the system.


    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: how do you plug a pseudo-random number generator up into minigames?

      ^^

      What he said. I've used a pseudo random number generator in at least two (to a major extent) and one (to a lesser extent) RPGM3 games that I've made. For a bit of help, type either "minigames" or even "pseudo random number generator" into the search for this forum (I think I even made a topic once called "Pseudo random number generator"), as in either of these two types of discussions, PRNGs (as you call them) tend to get mentioned quite a bit.

      If you find a topic of mine dealing with this, and you find a huge list of code for how to do it, disregard it. I toyed around with some code, but it turned out that pretty quickly, you began running into patterns. I'll grant you that with any "pseudo" random number generator, you eventually WILL run into repeating patterns if you try hard enough, as it's not truly "random," but the goal ultimately is to minimize this as much as possible.

      As Wavelength mentioned, the best way I've found to do this is to add a variable change (preferably using more than one variable) in each event you program. In my unreleased demo for Series 3 (a farming sim), I used, if I remember correctly, a variable equal to 0, 1, or 2; and a variable equal to 0 through 9. This gives you a lot more flexibility with your "randomness." In the game, every time you bought something, sold something (I had custom shopkeepers), planted seeds, went fishing, talked to an NPC (a few of whom had 30 conversations each), or did anything else that required me to create an event for, you would get a variable adjustment depending on which choice you picked [in essence, each fish you caught, for an example, was determined by one of the "random" variables, and within that outcome code was ANOTHER piece of code to manipulate a "random" variable (either the same one, the other one, or both)]. Nesting variable changes inside of val cond branches seems to me to give you the most "random" outcome you could hope for in RPGM3. It's conceivable that you could use this method for upwards of 3-5 or more "random" variables, but I found that the two listed above were sufficient for my needs.

      In my "minigame" game, A Series Aside, my system of "random" variables was not QUITE as elaborate, but in each minigame you played, and each choice you made in those minigames, it would generate another "random" value for the two variables I used.

      And I like Wavelength's idea for changing the "randomness" of the variable by using the morning-noon-evening-night cycle, but the only problem I see in doing that is that in order to make it consistent, you would need to make an invisible event to do this in each and every area the player has access to; every field, every town, every dungeon, every building, etc, and with a limit of 20 events per location, events are at a premium.

      If you have figured another way to do this without needing to make a separate event each time (making identical events from scratch every time when you need 20-40 of them, as there is no "clone" or "copy" command really is tedious, not fun, and caused me to stop working on my second game) Wavelength, please let me know.
      Last edited by Perversion; 01-11-2008, 08:50 PM.

      Comment


        #4
        Re: how do you plug a pseudo-random number generator up into minigames?

        Originally posted by Perversion View Post
        If you have figured another way to do this without needing to make a separate event each time (making identical events from scratch every time when you need 20-40 of them, as there is no "clone" or "copy" command really is tedious, not fun, and caused me to stop working on my second game) Wavelength, please let me know.
        Great post, Perv! But no, I was also thinking they needed to be in each and every place if you wanted to ALWAYS be able to trigger the change. If you don't really care, you could just stick it in some places where you don't need as much event space; this is, after all, supposed to simulate randomness.

        Now, I think you can save some effort and memory capacity, by transitioning into a "main" event from each location, rather than programming the whole thing from scratch each time. But you can't avoid using one event as a trigger in each location.


        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: how do you plug a pseudo-random number generator up into minigames?

          Originally posted by Perversion View Post
          And I like Wavelength's idea for changing the "randomness" of the variable by using the morning-noon-evening-night cycle, but the only problem I see in doing that is that in order to make it consistent, you would need to make an invisible event to do this in each and every area the player has access to; every field, every town, every dungeon, every building, etc, and with a limit of 20 events per location, events are at a premium.

          If you have figured another way to do this without needing to make a separate event each time (making identical events from scratch every time when you need 20-40 of them, as there is no "clone" or "copy" command really is tedious, not fun, and caused me to stop working on my second game) Wavelength, please let me know.
          In Tree of life I pseudo-randomized the weather, and I found that I only needed to repeat the event 3 times. I have one for the west part of town, one for the main part of town, and one for the world map. You don't have to place an event in every single building, or ANY of them. The only time the system skips a variable change is if the player stays inside any one place from 'evening' all the way through until 'morning', or from 'night' all the way through until 'noon', which is highly unlikely. If someone's doing that, then they're just letting the character sit there while they walk their dog, or make cookies, and if they're doing that, then they're not paying any attention to what the weather's doing anyway.

          Point is, I used that system to change the weather randomly, but you could also use it to alter variables for other purposes. It would only change them once per day, but if those variable were the backbone of all of the other ones, like if they all just played off of that one, you could make good use of it.

          All 3 events are set to a different 12-day cycle, and even though it's the weather I was changing, you could do the same thing with variable changes. When one triggers and resets itself, it resets both of the others. That way, you don't change the variable because it's morning, and then go into town and immediately change it again...it will already be set for 'night'.
          Last edited by Ωbright; 01-18-2008, 11:58 PM.

          Comment


            #6
            Re: how do you plug a pseudo-random number generator up into minigames?

            Originally posted by Obright View Post
            In Tree of life I pseudo-randomized the weather, and I found that I only needed to repeat the event 3 times. I have one for the west part of town, one for the main part of town, and one for the world map. You don't have to place an event in every single building, or ANY of them. The only time the system skips a variable change is if the player stays inside any one place from 'evening' all the way through until 'morning', or from 'night' all the way through until 'noon', which is highly unlikely.
            That is one AMAZINGLY cool tip, Obi! Anyone using it probably has to be careful (I've got several small areas I expect players to spend a good while in), especially if they have day/night-dependent variable changes that are absolutely vital. But for some instances, this is going to be a huge save of time and memory. I know it will be for me, and it sounds like it could help you a lot, too, Perv.


            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