Monte Carlo Level Simulation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • camlost
    Sangband 1.x Maintainer
    • Apr 2007
    • 523

    #16
    Originally posted by fizzix
    It definitely does matter, but rather than worry about handling that the plan is to add more granularity into the artifact printout. This is more of a proof of principle than anything else. A test to see how fast the sim runs, and whether I am capable of coding up the full thing. Looks like it's fast enough for sure, and I might be ok on the second as well. (I feel like I really suck at coding in C...)

    Here's the path I'll take, probably later today or tonight:
    First, I'll separate special artifacts from artifact equipment. Special artifacts have a different generation path, and are more likely to suffer from the 'not found before' effect

    Then, I'll separate other artifacts into aritfacts that are 25 levels above depth and shallower. Artifacts that are between 25 levels above and 1 level below. And artifacts that are deeper than 1 level below.

    I could also add granularity between weapons and armor, but I'm not sure this is needed.

    After that, I have to get drops from monsters, but this is a slightly more difficult problem.
    I assume that you're doing this as a wizard command, so why not just call mon_take_hit with a lot of damage through the monster list a few times before you do your calcs?
    a chunk of Bronze {These look tastier than they are. !E}
    3 blank Parchments (Vellum) {No french novels please.}

    Comment

    • fizzix
      Prophet
      • Aug 2009
      • 3025

      #17
      Originally posted by camlost
      I assume that you're doing this as a wizard command, so why not just call mon_take_hit with a lot of damage through the monster list a few times before you do your calcs?
      I want to distinguish where the items come from. Specifically, I want to know if they come from monsters, uniques or the ground. So I need something a little more advanced than that.

      Comment

      • Derakon
        Prophet
        • Dec 2009
        • 9022

        #18
        Don't items remember their provenance, though? I.e. if I kill Maggot and get a magic dagger from him, when I 'I'nspect the item it should say "Dropped by Farmer Maggot at dungeon level 0" or words to that effect.

        Or is that just one of those features that was added in every variant but not Vanilla yet?

        Comment

        • Timo Pietilä
          Prophet
          • Apr 2007
          • 4096

          #19
          Originally posted by Derakon
          Don't items remember their provenance, though? I.e. if I kill Maggot and get a magic dagger from him, when I 'I'nspect the item it should say "Dropped by Farmer Maggot at dungeon level 0" or words to that effect.

          Or is that just one of those features that was added in every variant but not Vanilla yet?
          That feature is in vanilla. Don't remember which version added that, but it is rather recent addition. Something like 3.1.0 or so.

          Comment

          • fizzix
            Prophet
            • Aug 2009
            • 3025

            #20
            Originally posted by Derakon
            Don't items remember their provenance, though? I.e. if I kill Maggot and get a magic dagger from him, when I 'I'nspect the item it should say "Dropped by Farmer Maggot at dungeon level 0" or words to that effect.

            Or is that just one of those features that was added in every variant but not Vanilla yet?
            it's in vanilla. but extracting that information seems harder than what i'm planning to do. Since that only gets written if the monster is visible when it dies, so I'd have to figure out how to override that. Then I'd have to back out that Farmer Maggot was a unique. Forget about figuring out if the monster that dropped it was generated in a vault.

            I think it's easier to get info on the monster, calculate its drop and then generate those items locally (don't even allocate them) and log them. There's some code to do this that I came across, and I may poach that.

            Comment

            • Derakon
              Prophet
              • Dec 2009
              • 9022

              #21
              Detect entire level (thus forcing all monsters to be visible).
              Hit monster.
              Add modification to provenance information to include if monster was standing in a vault square when killed.

              If provenance information is stored as a string, you can run a script afterwards to reverse-lookup monster names against the uniques list (assuming you care about the distinction between unique drops and normal drops). If it's stored as symbolic information (i.e. monster #54 at dlvl 20) then you can look up the monster info by its index and check if it's unique that way.

              Comment

              • camlost
                Sangband 1.x Maintainer
                • Apr 2007
                • 523

                #22
                Well, I figured that you'd just do a pass of object counting on the ground, delete the objects there, then kill each monster and do it again. I guess there's no reason you couldn't filter out uniques on the first monster pass and hit them on a later pass instead.
                a chunk of Bronze {These look tastier than they are. !E}
                3 blank Parchments (Vellum) {No french novels please.}

                Comment

                • PowerDiver
                  Prophet
                  • Mar 2008
                  • 2820

                  #23
                  Originally posted by fizzix
                  I'm thinking of putting all totals into longs (can I use floats?)
                  There's nothing wrong with using floating point, but always use doubles instead of floats.

                  Comment

                  • Derakon
                    Prophet
                    • Dec 2009
                    • 9022

                    #24
                    2^64 gets you about eighteen quintillion, so I don't think floating point is really necessary compared to unsigned long. Even signed long is nine quintillion. Just how many times were you planning to run this simulation? A very conservative guess would still have a single character finding less than a hundred thousand items in their lifetime, which would let you run the simulation trillions of times before running out of room.

                    (NB this is using the American "short scale", million = 10^6, billion = 10^9, etc)

                    Comment

                    • Magnate
                      Angband Devteam member
                      • May 2007
                      • 5110

                      #25
                      Originally posted by Derakon
                      Don't items remember their provenance, though? I.e. if I kill Maggot and get a magic dagger from him, when I 'I'nspect the item it should say "Dropped by Farmer Maggot at dungeon level 0" or words to that effect.

                      Or is that just one of those features that was added in every variant but not Vanilla yet?
                      It's in V, the ORIGIN_FOO codes.

                      fizzix - what's behind your choice of -25/>+1 levels for artifacts? The latter in particular makes little sense: +1 level OOD is roughly the same likelihood as +2 and a whole lot different from +0. I'd suggest:

                      More than 25 levels shallower

                      25 to 1 level shallower

                      At depth

                      1 to 10 levels deeper

                      More than 10 levels deeper

                      ... if you don't fancy that much granularity, combine the 2nd/3rd and the 4th/5th
                      "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                      Comment

                      • PowerDiver
                        Prophet
                        • Mar 2008
                        • 2820

                        #26
                        Originally posted by Derakon
                        2^64 gets you about eighteen quintillion, so I don't think floating point is really necessary compared to unsigned long
                        It has nothing to do with necessary. Longs have more bits of precision than doubles, if you are worrying about necessary. It's just simpler, particularly if you do division and do not want to worry about casting to avoid truncation. If you are going to be calculating standard deviations etc it is downright bizaare to avoid floating point.

                        It's not the 1970s. There's nothing wrong with using floating point.

                        Comment

                        • RogerN
                          Swordsman
                          • Jul 2008
                          • 308

                          #27
                          There's nothing wrong with using floating point, but always use doubles instead of floats.
                          Seconded. This is especially important when working primarily with addition and subtraction (ie adding up lots of numbers from a monte carlo simulation). If you're only using multiplication and division then you can frequently get away with less precision.

                          At single precision you've only got 23 bits of mantissa to work with, which doesn't get you very far.

                          Comment

                          • fizzix
                            Prophet
                            • Aug 2009
                            • 3025

                            #28
                            I took camlost's suggestion of killing the monsters and picking up their items. It seems to work and the numbers are adding up properly. Some amount (1-2 at deeper levels) of items get killed because of insufficient drop room. This probably occurs more often with monsters in vaults. Either way, I've decided not to worry about these lost items even though you possibly lose some good items.

                            (another possibility is to remove all the traps in each level. I think I'll do that. Cataloguing traps is dumb anyway)

                            Time to sim still looks reasonable on my computer, but it might be rough on slower computers.

                            I'll try to have a semi-complete version up on git later today or tomorrow.

                            Comment

                            • fizzix
                              Prophet
                              • Aug 2009
                              • 3025

                              #29
                              Finished up potion generation. And cleaned up the output a bit so it's more readable. 1000 sims doing 20 levels (20k total levels) takes less than 2 minutes on my laptop, and it's unlikely to get much slower. No swag gets deleted on drops anymore.

                              Going to finish up consumables, and then do work on the egos, hopefully be done by the end of the day. (Ego and gold counts are mislabeled currently)
                              Attached Files

                              Comment

                              • buzzkill
                                Prophet
                                • May 2008
                                • 2939

                                #30
                                That's cool but hard to read. The text cleanup will be nice. A quick glance, confirms what I've always thought. A vast majority of artifacts are dropped by everyday-in-depth-monsters, not uniques, not vaults.
                                www.mediafire.com/buzzkill - Get your 32x32 tiles here. UT32 now compatible Ironband and Quickband 9/6/2012.
                                My banding life on Buzzkill's ladder.

                                Comment

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