Edit File For Dungeon Generation?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Zero
    Apprentice
    • Jan 2008
    • 83

    Edit File For Dungeon Generation?

    We have an edit file for vaults, and that's great, but the standard room types like:

    Code:
    #########     #####    #########
    # # # # #     #   #    # # # # #
    ## # # ##   ### # ###  #       +
    # # # # +   #  ###  #  #       #
    ## # # ##   ### # ###  # # # # #
    # # # # #     #   #    ###+#####
    #########     ##+##
    These are hard-coded, as are their depths. The code that determines whether a room will be lit or dark on creation is also hard-coded. The number of monsters, traps, objects, veins, treasure... all hard-coded. Perhaps instead of the autoscum option, we should have an edit file that allows the specification of chances for pits, vaults, out-of-depth monsters and items, destroyed levels, and item quality.

    No, I'm not volunteering for the job!
  • takkaria
    Veteran
    • Apr 2007
    • 1951

    #2
    Originally posted by Zero
    We have an edit file for vaults, and that's great, but the standard room types like:

    Code:
    #########     #####    #########
    # # # # #     #   #    # # # # #
    ## # # ##   ### # ###  #       +
    # # # # +   #  ###  #  #       #
    ## # # ##   ### # ###  # # # # #
    # # # # #     #   #    ###+#####
    #########     ##+##
    These are hard-coded
    ... as they always will be without a scripting language ...

    as are their depths. The code that determines whether a room will be lit or dark on creation is also hard-coded. The number of monsters, traps, objects, veins, treasure... all hard-coded. Perhaps instead of the autoscum option, we should have an edit file that allows the specification of chances for pits, vaults, out-of-depth monsters and items, destroyed levels, and item quality.
    Seems like a reasonable idea, and probably makes some kinds of balancing easier. Has the nice advantage of separating various constants well out of the source, thus reducing magic numbers.

    (Not that you can separate out "item quality", since the game has no concept except in how it prices up items, which should be hardcoded.)

    No, I'm not volunteering for the job!
    It really shouldn't be too hard as long as the file is a simple key/value pair-type thing. The parser is the annoying bit.
    takkaria whispers something about options. -more-

    Comment

    • Zero
      Apprentice
      • Jan 2008
      • 83

      #3
      as they always will be without a scripting language
      We have an edit file for vaults. Why not an edit file for rooms in general? Too much work? I wouldn't criticize you if that's the reason, it just doesn't make sense to me that we'd need a scripting language to handle it.

      Seems like a reasonable idea, and probably makes some kinds of balancing easier. Has the nice advantage of separating various constants well out of the source, thus reducing magic numbers.
      Exactly. Reduce as many magic numbers as you can, and the code becomes much more modular and modifiable, making it easier for people to make variants.

      (Not that you can separate out "item quality", since the game has no concept except in how it prices up items, which should be hardcoded.)
      I was referring to the chances of a generated item being cursed, average, good, ego, or artifact at specified depths.

      Code:
      0 400 400 196 3 1
      1 395 395 205 4 1
      ...
      That would be level zero, 40%, 40%, 19.6%, .3%, .1% for cursed, average, good, ego, and artifact, respectively. I'm just pulling those numbers out of my ass as an example. You'd just load them into a 2-dimensional array, and then whenever you create an object, get a random integer from 0 to 999 to obtain the quality. I think that would make more sense than hardcoded percentages for going from one quality to another. If you think steps of .1% is too much and want finer control, you could just get a random number from zero to maxint and require the quality numbers for each level to add up to maxint:

      0 30000 30000 5000 500 36

      ... or something

      The reason I suggest this is in case people want to make variants with significantly more or less than 100 levels.
      Last edited by Zero; January 9, 2008, 18:09.

      Comment

      • takkaria
        Veteran
        • Apr 2007
        • 1951

        #4
        Originally posted by Zero
        We have an edit file for vaults. Why not an edit file for rooms in general? Too much work? I wouldn't criticize you if that's the reason, it just doesn't make sense to me that we'd need a scripting language to handle it.
        To specify the algorithms for dungeon generation in an edit file would be to invent a new scripting language, and that is not something I'm interested in doing.

        Exactly. Reduce as many magic numbers as you can, and the code becomes much more modular
        The modularity actually remains about the same, just with fewer magic numbers.

        and modifiable, making it easier for people to make variants.
        The "make it easier for people to make variants" argument sounds reasonable, but it's not -- the good variants make far, far more interesting changes than tweaking the edit files. You can change the flavour of the game substantially by changing the edit files, but the game is essentially the game.

        I was referring to the chances of a generated item being cursed, average, good, ego, or artifact at specified depths.

        Code:
        0 400 400 196 3 1
        1 395 395 205 4 1
        ...
        That would be level zero, 40%, 40%, 19.6%, .3%, .1% for cursed, average, good, ego, and artifact, respectively. I'm just pulling those numbers out of my ass as an example. You'd just load them into a 2-dimensional array, and then whenever you create an object, get a random integer from 0 to 999 to obtain the quality. I think that would make more sense than hardcoded percentages for going from one quality to another.
        There are no hardcoded percentages at the moment -- just a series of obscure and slightly crufty calculations -- so this kind of thing would be a substantial rethink of the way objects are generated. Not to say it's a bad idea, but it's not quite as simple as just transplanting a system to the edit files. In addition to this, you might actually want a formula to determine chances, rather than having a file describe each level line-by-line. To parse a formula, you again have to write essentially a small scripting language.
        takkaria whispers something about options. -more-

        Comment

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