Official announce of pyAngband

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Therem Harth
    Knight
    • Jan 2008
    • 926

    #16
    Originally posted by Sirridan
    Speaking of this, could anyone good with Git give me a few pointers? I have the repo set up with a key and all that, I just need to push the code over.
    Look here: http://help.github.com/git-cheat-sheets/ This should give you the basics.

    Comment

    • Magnate
      Angband Devteam member
      • May 2007
      • 5110

      #17
      Originally posted by Sirridan
      I'll deal with that nonsense last

      My priorities are (mostly in order):

      1. Get outline done, where I can create a character, items, etc
      2. Get edit files created and sorted out, I'll write a converter because I think a change in format is in order
      3. Hard-code a mini-dungeon to do some testing for movement, AI, and what-not
      4. Actually implement movement, AI, and what-not
      5. Everything else

      Of course each step has many sub-steps which then may have sub(-sub)* steps and so on. Hopefully as it moves closer and closer to completion, more people will be working on it

      Edit: Time for bed, work starts in 6 hours, and I have to be up in 5
      Sorry to miss the announcement, but well done and good luck. I look forward to arguing with other devs about moving V to python when you're done!

      An alternative, indexless edit file syntax has already been developed - I'm trying to get a link for you now in case it could save you some work.

      To get it onto github, from your local repo, do this:

      (git checkout master)

      git remote add [your preferred url to github.com] [your name for this remote, let's call it github] (hmm, actually I think those two arguments come in the other order)

      git push github (-a for all branches)

      ... oh, I just found you on github and noticed you've already done all that. Cool. Off to see how you've done the data structures ....
      "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

      Comment

      • Sirridan
        Knight
        • May 2009
        • 560

        #18
        I'm going to do a lot of work on this today, since I have the day off, slow day at the box factory I guess...

        Anyway I'm not sure what I want to do quite yet, so far I factored out a class according to Pete's suggestion in the other thread.

        As for edit files, I'm thinking of maybe doing XML, since it can be compressed, and then an XSL sheet can be added so that the edit files can double up as spoilers... Thinking the same thing for save files too, or at least character dumps. Who knows? It should be easy enough to make multiple ways to dump out character/edit data.

        Comment

        • Derakon
          Prophet
          • Dec 2009
          • 9022

          #19
          XML is too much work, and too painful to hand-edit. Use Python's pprint module to serialize data to text files, and then just import the file as a Python module to get access to the data.

          More generally, XML is useful when you want to have a data file format that can be read by many different languages, since practically everything has an XML importer. However, if you have a more restricted client base, then you can afford to use data formats that aren't as general-purpose, but are easier to use for the specific application. For example, JSON is great if your only use case involves Javascript, but not so great if you also need to be able to read the data in C and Perl.

          In this case, you have a file that is only going to be read by a single program which you control, so you may as well make things as easy as possible on yourself.

          EDIT: also, don't worry about the size of your files. Gone are the days when Angband needed to be as small as possible; even a cellphone will have gigabytes of storage available. Definitely don't have any binary file formats; way more trouble than they're worth. As you noted, you can just use compression libraries if you're really worried about sizes (though I personally would recommend just keeping everything as plaintext).
          Last edited by Derakon; October 28, 2010, 19:43.

          Comment

          • Sirridan
            Knight
            • May 2009
            • 560

            #20
            Right now, I'm going to use a super-easy-to-read-and-edit (tm) edit file structure, and it may change later as needed. Right now I just want it to work.

            Anyway, what's nice is I'm going to have it so you can split up the files as much as you want, so you can have object.txt split up into potions.txt, scrolls.txt, swords.txt, hafted.txt, etc.

            Comment

            • Derakon
              Prophet
              • Dec 2009
              • 9022

              #21
              pprint is super easy to read and edit. Check it out:
              Code:
              >>> foo = {"Name": "Sauron, the Sorceror", "HP": "Far too many", "Spells": ["Magic Missile", "Armageddon"]}
              >>> outputFile = open("config.py", "w")
              >>> import pprint
              >>> printer = pprint.PrettyPrinter()
              >>> outputFile.write("sauron = %s\n" % printer.pformat(foo))
              >>> outputFile.close()
              >>> import config
              >>> config.sauron
              {'HP': 'Far too many', 'Name': 'Sauron, the Sorceror', 'Spells': ['Magic Missile', 'Armageddon']}
              >>> readFile = open('config.py', 'r')
              >>> for line in readFile.readlines():
              ...     print line,
              ... 
              sauron = {'HP': 'Far too many',
               'Name': 'Sauron, the Sorceror',
               'Spells': ['Magic Missile', 'Armageddon']}
              If you want to split things across multiple files, which sounds reasonable to me, then you could have your main file import the other files, and then construct a list that pulls for the other files, e.g.
              Code:
              #object.py
              import potions
              import weapons
              import armor
              
              objects = potions.objects + weapons.objects + armor.objects
              Then potions.py would contain a variable "objects" which is a list of item records for all of the potions, and so on.

              Comment

              • Atarlost
                Swordsman
                • Apr 2007
                • 441

                #22
                Amen. Don't you remember the first time you tried to read an Angband edit file? They're not easy. You have to constantly reference the template until you memorize the field order.
                One Ring to rule them all. One Ring to bind them.
                One Ring to bring them all and in the darkness interrupt the movie.

                Comment

                • Pete Mack
                  Prophet
                  • Apr 2007
                  • 6883

                  #23
                  Or you can use JSON, which is a lot like pprint, and is actually a genuine standard serialization. (And, yes, it's got Python support.)

                  I agree with the other post: xml is a terrible format for data. It's excellent when there's metadata.

                  Comment

                  • Sirridan
                    Knight
                    • May 2009
                    • 560

                    #24
                    Using JSON, it's quite easy to edit and whatnot. Just copy paste the template and fill in the fields

                    Edit: example for weapon egos (WIP): http://github.com/Sirridan/pyAngband.../WeaponEgos.py
                    Last edited by Sirridan; October 30, 2010, 18:38.

                    Comment

                    • Zababa
                      Apprentice
                      • Sep 2009
                      • 99

                      #25
                      Good luck with pyAngband, Sirridan.

                      I just wonder why did you start off with it in Python 2.6/2.7. I have the impression that you will want to convert it to Python 3 later on, despite reporting that you had difficulties with every python version upgrade despite them being backward-compatible.

                      Now you know that Python 3 is not going to be backward-compatible, yet you have chosen to write it in Python 2. Did you actually try to convert something more complex from 2.7 to 3.x? When you said that you just have to be careful to write the code in a way from where it can be safely converted to 3, why don't you write in version 3 right away? It will save you all the troubles you will have to face during the conversion.

                      Anyway, I have read the discussion about rewriting Angband in Python and am very excited about that. I think Angband would greatly benefit from a more readable and easily modifiable code.

                      Comment

                      • Derakon
                        Prophet
                        • Dec 2009
                        • 9022

                        #26
                        There's a discussion on the 2/3 thing earlier in the thread. The practical upshot is that if you write your Python 2 code with an eye towards upgrading to 3 later, then the upgrade is pretty painless. The reason to not write in 3 from the get-go generally is that some library you depend on is not yet compatible with 3.

                        Comment

                        • Zababa
                          Apprentice
                          • Sep 2009
                          • 99

                          #27
                          I see, I forgot about the libraries.

                          Comment

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