pyAngband's thread

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sirridan
    Knight
    • May 2009
    • 560

    #46
    So I posted the source of what I have so far. The map is a 2D array of characters, (well a list of lists of characters... anyway) which I know isn't good, but it works *for now*.

    Anyway, I'm thinking of implementing a (the?) DungeonCell class, which would just be the container which holds every bit of info about each 'cell' in the dungeon. So, the class would basically have this:

    Code:
    class DungeonCell(object):
        def __init__(self, x, y, terrain_id, flags):
            self._x = x
            self._y = y
            self._terrain_id = terrain_id
            self._flags = flags
            self._items = []
            self._monster = None
    x & y are the coords of that cell

    terrain_id is the key to a structure holding information on the terrain for that spot, easy enough.

    flags is just that, flags which say if that cell is lit up, been lit up, trap border, etc.

    Items is a list of items in that particular cell, if any

    monster is the monster currently in that cell, if any

    There would be a Dungeon class which holds the cells and such. Any thoughts or suggestions? Thanks for any input

    Comment

    • takkaria
      Veteran
      • Apr 2007
      • 1951

      #47
      Originally posted by Sirridan
      So I posted the source of what I have so far. The map is a 2D array of characters, (well a list of lists of characters... anyway) which I know isn't good, but it works *for now*.

      Anyway, I'm thinking of implementing a (the?) DungeonCell class, which would just be the container which holds every bit of info about each 'cell' in the dungeon. So, the class would basically have this:

      Code:
      class DungeonCell(object):
          def __init__(self, x, y, terrain_id, flags):
              self._x = x
              self._y = y
              self._terrain_id = terrain_id
              self._flags = flags
              self._items = []
              self._monster = None
      x & y are the coords of that cell

      terrain_id is the key to a structure holding information on the terrain for that spot, easy enough.

      flags is just that, flags which say if that cell is lit up, been lit up, trap border, etc.

      Items is a list of items in that particular cell, if any

      monster is the monster currently in that cell, if any

      There would be a Dungeon class which holds the cells and such. Any thoughts or suggestions? Thanks for any input
      That's the right way to go about it, pretty much what V will look like by 3.2, I think...
      takkaria whispers something about options. -more-

      Comment

      • Sirridan
        Knight
        • May 2009
        • 560

        #48
        Edit files...

        So, thinking about edit files today. Mostly because my fiance is on the other computer which has the current code. I need to remember to commit... ANYWAY

        I want edit files for pyAngband to be more readable and editable. I want one to be able to read an entry and figure it out (mostly at least) without having to read and re-reference a guide at the start of the file. So here are my proposals for such things, and as always comments and suggestions are more than welcome!

        Code:
        object_class.txt - object classes and subclasses, 
        ---------------------
        class: Edged
           items: Dagger, Long Sword, Short Sword, Blade of Chaos
           type: Weapon
        class: Hafted
           items: Mace, Two-Handed Great Flail, Mace of Disruption
           type: Weapon
        class: Scroll
           items: Phase Door, Word of Recall, *Destruction*
           type: Consumable
        class Ring
           items: Speed, Resist Fire, Resist Cold, Acid, Digging
           type: Ring
        class Amulet
           items: Magi, ESP
           type: Amulet
        class Potion
           items: CLW, CSW., CCW, Life, etc.
           type: Consumable
           
        this pretty much goes on, and of course these entries are not complete.
        May or may not happen, depending on how I do objects, but it would be cool
        to define them all inside a file, right?
        
        object.txt - base items
        ---------------------
        object: Dagger
            class = Edged
            display = '|'
            color = gray
            weight = 14
            damage = 1d4
            value = 30
            rarity = 0
            level = 0 to MAX
            desc = 'A short blade, good for opening arteries and tickling giants.'
        
        object: PDSM
            class = Dragon Armor
            display = '['
            color = purple
            weight = 300
            ac = 30
            damage = 1d2
            value = more than you have
            rarity = you may never see it
            level = 90 to MAX
            resists = 'fire, cold, elec, acid, poison, sound, chaos, shards, pretty much everything'
            activation = BREATHE_ELEMENTS, recharge = 300 + 1d300
            desc = 'You found a PDSM? You lucky dog!'
        
        ego.txt - ego items!
        ---------------------------
        ego: Dwarven
             name: '%o (Dwarven)'
             classes: Armor
             subclasses: Metal Scale Mail, Splint Mail, Plate Mail, etc.
             ac = '2d4'
             value = 30000
             rarity = 1
             level = 10 to MAX
             resists = 'fire' (I know, but just an example...)
             abilities = 'Free Action, Resist Blind'
             powers = 'str + 1d2, con + 1d2, infra + 1d2'
        
        ego: Weapon of Flame
             classes: Edged, Hafted, Polearm
             name: '%o of Flames'
             value = 2000
             rarity = 1
             level = 0 to MAX
             resists = 'fire'
             abilities = 'Brand Fire'
        
        monster.txt - monsters!
        ----------------------
        
        (this monster isn't 'real', just an example)
        monster: TOWNW
             race = 'none' (actually this is omitted if no race)
             name = The One Who Never Was
             hp = 15000, sp = 3000 (sp for 4Gai, not needed if nyi)
             rarity = 0
             level = 150
             resists = 'time, plasma, gravity, force'
             immune = 'fire, acid, cold, elec, poison, sound'
             vulnerable = 'none' (omit if none, just here to show)
             drop = quality (good, excellent, normal, etc), count = num of treasures
             attacks = 'HIT: 6d6 + 20, HIT: 6d6 + 20, HIT_DEGRADE'
             spells = 'TIMEBALL, DESTRUCTION, DISINTEGRATE, GRAVITYBALL': 1 in 5,
                           'BR_TIME, BR_GRAV, BR_PLASMA': 1 in 3
             flags = 'AVOID_50' (prevent damage 50% of time)
             desc = 'A paradox of existence, it never was yet it is here.  Reality twists away as if to escape.'
        
        (if it doesn't cast the first set of spells 1 in 5, it has a 1 in 3 chance to breathe, etc, so different spells could now have different probabilities. at least before new AI is implemented, then again, this may be scrapped for simplicity)
        Otherwise edit files keep looking like that, and can be split up into different files. There would be a master file so that file parsing is done in correct order (such as object classes and subclasses being done before objects themselves)

        Again, any thoughts/feelings/advice is appreciated!

        Comment

        • AnonymousHero
          Veteran
          • Jun 2007
          • 1393

          #49
          Wouldn't it be easier to just use a standard format such as SEXPs or YAML? Writing parsers is fun and all, but it just seems like a waste of time when such alternatives exist with (mostly) bug-free code already written .

          Comment

          • fph
            Veteran
            • Apr 2009
            • 1030

            #50
            Originally posted by AnonymousHero
            Wouldn't it be easier to just use a standard format such as SEXPs or YAML? Writing parsers is fun and all, but it just seems like a waste of time when such alternatives exist with (mostly) bug-free code already written .
            His data file format already looks identical to YAML to me. Maybe I am missing a comma somewhere though.
            --
            Dive fast, die young, leave a high-CHA corpse.

            Comment

            • Sirridan
              Knight
              • May 2009
              • 560

              #51
              Good plan! Yaml looks pretty interesting actually... my first goal is to get set on a format, second is to convert existing angband edits into that format.

              The primary goal of moving angband to python is for easier modification and variant making... so an easy to read format like yaml will help much.

              EDIT: The pyYAML docs have a lot of angband object references, kinda ironic in a way, eh? http://pyyaml.org/wiki/PyYAMLDocumentation

              Comment

              • Sirridan
                Knight
                • May 2009
                • 560

                #52
                Project is not dead, so don't worry! I'll try and push something new to GIT later on today or tomorrow. Real life has been quite murderous with work and holidays and all that jazz.

                Comment

                • Magnate
                  Angband Devteam member
                  • May 2007
                  • 5110

                  #53
                  Originally posted by Sirridan
                  Project is not dead, so don't worry! I'll try and push something new to GIT later on today or tomorrow. Real life has been quite murderous with work and holidays and all that jazz.
                  No worries - you have years before we give up on you! Good luck with keeping up your enthusiasm.
                  "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                  Comment

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