Best code examples for terrain generation, AI and quests?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • droof
    Apprentice
    • Dec 2013
    • 71

    Best code examples for terrain generation, AI and quests?

    I want to learn more about how terrain generation, monster AI and quests work.

    I'm looking for the Angband variants that offer the best code example for each feature, so I can play around in the code and learn from it. Also maybe try to port a feature from one variant to another as a learning exercise if that isn't too tricky.

    So far I've found these variants as examples:
    1 - Terrain / room generation: Unangband or Zangband
    2 - Monster AI: Oangband or Sangband (is 4GAI still the best example?)
    3 - Quests: no idea

    From what I've seen in code, Unangband has the most variety, but Zangband has very clean and tidy code. So I'll probably look into Zangband first, because it is easier to read and change.

    I've only heard about 4GAI being the best Angband AI, originating from Oangband and Sangband. Is that still true and if so, which variant should I look into as the easiest to read or most recent example?

    Which Angband variant has the best code example for quests?

    If anyone can give me advise, please let me know.
  • Nick
    Vanilla maintainer
    • Apr 2007
    • 9637

    #2
    Terrain: If you're looking at wilderness, FAangband has generation which is different from Z (and descendants) or Un. For room generation, I'd actually look at the template approach in current V; if you want true procedural rather than templates, I think PosCheng may have some (but I'm not sure).

    O, S, FA and NPP all have 4GAI; NPP is possibly the most accessible, but I would recommend going back to a quite old version - 0.5, or maybe even 0.4 before UnAngband terrain came in.

    NPP and Steam have random quests available from town; I believe they got this from EyAngband, but I'm not 100% sure. For fixed quests, I think all the Zangband family have them; I think they are dependent on having wilderness.

    I'm sure I've got some of this wrong and will be corrected
    One for the Dark Lord on his dark throne
    In the Land of Mordor where the Shadows lie.

    Comment

    • Pete Mack
      Prophet
      • Apr 2007
      • 6883

      #3
      Nick is right: for cleanest code, start from current V and add features. It is MUCH cleaner than any of the older branches.

      Comment

      • EpicMan
        Swordsman
        • Dec 2009
        • 455

        #4
        For quests you might look at ToME 2 and Portralis (was NewAngband). Both have multi-stage quests taking place over multiple locations.

        Hengband/Poschengband have pretty cool quests, but they are basically just instances / special levels.

        Comment

        • Gwarl
          Administrator
          • Jan 2017
          • 1025

          #5
          Originally posted by Nick
          I'm sure I've got some of this wrong and will be corrected
          Fixed quests come from Kangband, which didn't have an overworld as such.. just an elaborate town/wilderness area (seven of them, handmade). Z took quests from there.. in fact it's impossible (or just difficult and never before attempted) to have fixed quests outside of town afaik.

          Comment

          • droof
            Apprentice
            • Dec 2013
            • 71

            #6
            I spent quite some time with room templates, but problem was that I recognised all my own templates. I hope true room generation will keep me more surprised while playing and tweaking.

            I'll start with just a room generator, since that looks more modular and maybe easier to understand and start with.

            For 4GAI, I found NPP 0.5 on github. Looks like NPP's melee2.c is roughly Sang's monmove.c. I'll have fun with them. Is there some kind of manual that explains 4GAI and how it hooks into Angband?

            I'll check out EyAngband and Kangband for random and fixed quest code, or else Steam and Zang if I can't find working links to Ey and Kang. Quest code is probably more difficult than rooms and AI, so I'll keep that for last.

            Great sources, thanks everyone!

            Comment

            • Pete Mack
              Prophet
              • Apr 2007
              • 6883

              #7
              Yes, NPP AI is good. (So is O/FA.)

              Comment

              • wobbly
                Prophet
                • May 2012
                • 2631

                #8
                NPP has AI which is strong but to my mind it can be annoying and feels unnatural. For an example watch an umber hulk which will not use a corridor instead moving parallel to it through the wall. It's harder but feels a little off.

                Comment

                • takkaria
                  Veteran
                  • Apr 2007
                  • 1951

                  #9
                  Originally posted by droof
                  For 4GAI, I found NPP 0.5 on github. Looks like NPP's melee2.c is roughly Sang's monmove.c. I'll have fun with them. Is there some kind of manual that explains 4GAI and how it hooks into Angband?
                  There has been quite a lot of chat on this forum about how having super-smart monsters a la 4GAI is maybe not actually the best thing for gameplay. If you search for AI related threads I'm sure it'll come up. Monster mana also seems like a bit of a dead end to me. As Nick put it recently, you just end up killing the monster twice: first you drain its mana and then you drain its HP.

                  The original 'manual' for the 4GAI code is avaiable here:


                  Andrew Doull wrote a four-part series about the 4GAI that I seem to remember was worth reading too: http://roguelikedeveloper.blogspot.c...e-history.html
                  takkaria whispers something about options. -more-

                  Comment

                  • wobbly
                    Prophet
                    • May 2012
                    • 2631

                    #10
                    Almost forgot Sil's AI is worth a look though it would be harder to port to a different variant.

                    Comment

                    • Nick
                      Vanilla maintainer
                      • Apr 2007
                      • 9637

                      #11
                      I took a copy of the 4GAI manifesto and put it here too, in case the archive fails.

                      An example of 4GAI gone a bit crazy is the O/NPP/FA implementation of player ghosts, whose thing was that the player knew everything about them, but they also knew everything about the player. Most people would just leave the level rather than fight one...

                      Takkaria and I had a bit of discussion about V's monster AI recently and broadly came up with
                      • it's actually pretty decent already and
                      • the best way to improve it might be to have different patterns of behaviour for different monster types, rather than just clever or stupid.
                      One for the Dark Lord on his dark throne
                      In the Land of Mordor where the Shadows lie.

                      Comment

                      • droof
                        Apprentice
                        • Dec 2013
                        • 71

                        #12
                        If 4GAI is the point where AI is getting too smart, then maybe that's not a bad place to learn AI from. Dumbing down AI is probably easier than making AI smarter, so I'll start from the top and work my way down. Any change I make probably makes the AI dumber by accident

                        It's quotes like these from the 4GAI manifesto that really motivate me to want to learn more about AI: "At times, you will wonder if you aren't really playing MAngband.".

                        Doull's blog is an interesting read. I agree that the AI should show intelligence and personality, not necessarily be intelligent. I'd like the AI to be able to surprise me in behaviour like procedural generation can surprise me in level design. To be able to surprise the developer, like the original Rogue did.

                        Comment

                        • Derakon
                          Prophet
                          • Dec 2009
                          • 9022

                          #13
                          The smarter you make AI, the harder it gets to support a highly-asymmetrical game design. There's no way the player can be facing down against a Great Wyrm of Balance if that wyrm is intelligently using all the abilities available to it. And the player is expected to kill thousands of foes that are statwise considerably more powerful than they are. Basically, if you make Angband with really smart AI, then you are making a very different game from Vanilla. That's totally fine, just be aware that 4GAI is variant territory for a reason.

                          Comment

                          • droof
                            Apprentice
                            • Dec 2013
                            • 71

                            #14
                            Is that why Sangband has skills instead of classes, to make the game design less asymmetrical over time to compensate for gameplay changes presented by 4GAI?

                            I mean, with classes you'll have lasting strengths and weaknesses in combat. With skills you can first play to your initial favorite strengths, then over time compensate for weaknesses even if it takes a couple of levels. This also helps players gain access to abilities in the end game that would otherwise have been restricted by class, while stronger enemies have fewer to no restrictions on abilities. So asymmetrical game design at the start, but symmetrical at the end.

                            Or have I understood this all wrong?

                            Comment

                            • PowerWyrm
                              Prophet
                              • Apr 2008
                              • 2986

                              #15
                              Originally posted by Derakon
                              The smarter you make AI, the harder it gets to support a highly-asymmetrical game design. There's no way the player can be facing down against a Great Wyrm of Balance if that wyrm is intelligently using all the abilities available to it. And the player is expected to kill thousands of foes that are statwise considerably more powerful than they are. Basically, if you make Angband with really smart AI, then you are making a very different game from Vanilla. That's totally fine, just be aware that 4GAI is variant territory for a reason.
                              TomeNET. Good luck killing Sauron there with a mundane character, as he will automatically use his HEAL or TELE_XXX spells when under x% life. Basically uses the same AI as any player. Oh and you have to suffer through Mt Doom (all lava, no digging, no recall) to reach him too
                              PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!

                              Comment

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