engine for rand art generation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • quarague
    Swordsman
    • Jun 2012
    • 261

    engine for rand art generation

    I've been playing a char with rand arts, which is great fun, here are some comments/ suggestions on how these are generated. So my understanding of how the current generation works is as follows: take a list of all the possible properties, choose one at random, add it to the artifact, then decide whether the artifact is powerful enough as is, if not roll again for another property.
    This leads to some properties that are very rare in standarts to be just as common as the common properties. As an example, my char found lots of artifacts that grant ESP, but it took until char level 36 at 3000'' until I found the first item that grants all 4 base resists.
    This is not surprising if the artifact generation works as described, the chance to roll all 4 base resists is much lower than rolling ESP. If you want the rand arts to model the stand arts more closely, the easiest way would probably be to weight the list of properties. For example roll a d100, rolling a 1 to 5 gives fire resistance, rolling a 6 gives ESP, etc. Then getting fire res is 5 times a likely as getting ESP. One could also put the 4 base resists as a single property in the list. This would of course require lots of balancing and play testing.
  • Philip
    Knight
    • Jul 2009
    • 909

    #2
    A simple solution is to either group abilities together, or make getting an ability make getting other abilities associated with it more likely.

    Comment

    • Magnate
      Angband Devteam member
      • May 2007
      • 5110

      #3
      Originally posted by Philip
      A simple solution is to either group abilities together, or make getting an ability make getting other abilities associated with it more likely.
      Umm ... yeah. The randart generator isn't perfect, but it is a *teeny* bit more sophisticated than the OP thinks.
      "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

      Comment

      • Philip
        Knight
        • Jul 2009
        • 909

        #4
        The fact that randarts are not only playable, but played is quite the testament to that. I have to congratulate the V team there. Randarts were very quickly brought to a level where I preferred playing with them.

        Comment

        • Derakon
          Prophet
          • Dec 2009
          • 9022

          #5
          Among other things, you should notice that:

          * Resistances are more common on body armors and shields
          * Boots are a lot more likely to have sizable speed boosts
          * Weapons tend to focus on slays
          * Extra shots/blows almost never show up on non-bows/weapons

          Comment

          • quarague
            Swordsman
            • Jun 2012
            • 261

            #6
            Originally posted by Magnate
            The randart generator is a *teeny* bit more sophisticated than the OP thinks.
            Glad to hear, could you elaborate, what does it do to make the randarts?

            Comment

            • Magnate
              Angband Devteam member
              • May 2007
              • 5110

              #7
              Originally posted by quarague
              Glad to hear, could you elaborate, what does it do to make the randarts?
              I know the forum's search function isn't very good, but I think I have probably posted this explanation five or six times over the years. I do hope you've spent at least a couple of minutes having a look, as the previous explanations were more comprehensive than this one.

              First, the randart code analyses lib/edit/artifact.txt and records precisely how often each ability (resist, slay, brand, stat boost, whatever) occurs on each type of item (weapon, shield, body armour, cloak etc.).

              Then if certain abilities are below certain minima, the frequencies are increased. This is to ensure that abilities can be generated on randarts even if they aren't present in the standart set.

              Then each artifact is taken in turn and randomised according to its total power level. First, a new base item is chosen, which must be not too powerful and not too weak (lest it have too many or too few abilities). Then random abilities are added one at a time (which can depend on item type, previous abilities etc. but are mainly guided by the frequencies recorded earlier). If the result is less than 95% of target power, we carry on adding more. If we're over 105%, we roll back the last addition and try again. If we run out of tries we scrap the whole randart and start again.

              Once we've randomised them all we check that we have minimum amounts of each item type. If we don't, we scrap the whole set and start again.
              "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

              Comment

              • DaviddesJ
                Swordsman
                • Mar 2008
                • 254

                #8
                This is something I might be able to work on and contribute to the codebase (which I have never done in the past). I have a lot of professional experience in global optimization and sampling. The "add one at a time, check for appropriate strength" method can introduce biases between less and more valuable abilities (i.e., given the method as described, the probability that an artifact has a given ability might not end up very close to the original target probability). There are other more "global" methods of sampling which could generate artifacts with a better match to the desired target distribution of abilities.

                I might take a look at this later this summer.

                Comment

                • Magnate
                  Angband Devteam member
                  • May 2007
                  • 5110

                  #9
                  Originally posted by DaviddesJ
                  This is something I might be able to work on and contribute to the codebase (which I have never done in the past). I have a lot of professional experience in global optimization and sampling. The "add one at a time, check for appropriate strength" method can introduce biases between less and more valuable abilities (i.e., given the method as described, the probability that an artifact has a given ability might not end up very close to the original target probability). There are other more "global" methods of sampling which could generate artifacts with a better match to the desired target distribution of abilities.

                  I might take a look at this later this summer.
                  I'm happy to abdicate maintainership of this code; I've been focused on Pyrel for the last year or more. I do plan to write a new randart generator for Pyrel, so would be happy to learn from any improvements you make to this one.
                  "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                  Comment

                  • AnonymousHero
                    Veteran
                    • Jun 2007
                    • 1393

                    #10
                    Originally posted by DaviddesJ
                    There are other more "global" methods of sampling which could generate artifacts with a better match to the desired target distribution of abilities.
                    Out of interest, what are those methods? (Wiki or article links would be much appreciated.)

                    Comment

                    • DaviddesJ
                      Swordsman
                      • Mar 2008
                      • 254

                      #11
                      Originally posted by AnonymousHero
                      Out of interest, what are those methods? (Wiki or article links would be much appreciated.)
                      One cool method for sampling from complex distributions is called Markov chain Monte Carlo (MCMC).



                      This is an approximate scheme, but there is a more refined method called Coupling from the Past that can be used to generate the exact desired probability distribution. (This was invented by a friend of mine.)



                      I haven't thought specifically about how to use these types of methods for generating random artifacts, but I believe it should be possible.

                      One question is: what kind of a distribution do you want? E.g., if at random you expect there to be two artifacts in the game with Protection from X, then do you want every game to have exactly two such, or do you want the number to vary within a limited range (e.g., 1 to 3), or do you want it to be completely random (so in one game you might see zero, and another game might have five)?

                      Comment

                      • DaviddesJ
                        Swordsman
                        • Mar 2008
                        • 254

                        #12
                        By the way, one thing I've often thought about is a game with random enemies, not just random items. You could imagine doing the same thing for enemies as for items, i.e., the properties and abilities of a given enemy would be determined randomly in each game, subject to a difficulty target. Many of the questions that come up for artifacts would also be relevant in that context.

                        Comment

                        • Oramin
                          Swordsman
                          • Jun 2012
                          • 371

                          #13
                          Random = RandBand?

                          Comment

                          • Derakon
                            Prophet
                            • Dec 2009
                            • 9022

                            #14
                            The big trick with random enemies is setting things up so that instadeaths are not a problem. They'd work a lot better in a variant where you can't go from full health to dead in a single turn. I mean, as an example, you could never fight a random monster if there were any other remotely dangerous monsters in phase-door distance, just in case it can breathe gravity...

                            Comment

                            • DaviddesJ
                              Swordsman
                              • Mar 2008
                              • 254

                              #15
                              Originally posted by Derakon
                              The big trick with random enemies is setting things up so that instadeaths are not a problem. They'd work a lot better in a variant where you can't go from full health to dead in a single turn. I mean, as an example, you could never fight a random monster if there were any other remotely dangerous monsters in phase-door distance, just in case it can breathe gravity...
                              Are you assuming that you wouldn't know what the monsters do until they do it? That isn't part of my conception. If you have no idea of what monsters can do, that just makes the game too random for me. My thought would be that you do know the capabilities of the monsters you encounter, just as most Angband players today are familiar with every capability of every monster from spoiler files. The difference is that those would change from game to game.

                              Comment

                              Working...
                              😀
                              😂
                              🥰
                              😘
                              🤢
                              😎
                              😞
                              😡
                              👍
                              👎