[Gensouband] How does .live track victories/deaths?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cryomaniac
    Swordsman
    • Jan 2022
    • 284

    [Gensouband] How does .live track victories/deaths?

    How does the .live server track victories/deaths in the games in order to report them? I've noticed it didn't register my death in Gensouband - probably because the game over wording is slightly different.
  • Gwarl
    Administrator
    • Jan 2017
    • 1025

    #2
    Two ways:

    1. Anything sufficiently like more recent versions of Vanilla contains a header in the savefile which gives some basic character information, which angband.live reads.

    2. The "Exo patch", a small piece of code in load.c and save.c which outputs some basic character information to a text fiel on saving or loading the game. Examples:

    Repository for composband. Contribute to Owen-GHB/composband development by creating an account on GitHub.

    Repository for composband. Contribute to Owen-GHB/composband development by creating an account on GitHub.


    .live only recognises the win when the cause of death is 'Ripe Old Age'

    Comment

    • Cryomaniac
      Swordsman
      • Jan 2022
      • 284

      #3
      To be clear: The relevant code is in the new functions updatecharinfoS/updatecharinfoL, which work with a new file that contains info about current character in a parseable format. This is used to track character deaths and current status (race/class/level/location). They're called getting called in the savefile write/read functions.

      Is there any other new relevant code I'm missing?

      Is there a difference between the functions called on saving and loading?

      Comment

      • Gwarl
        Administrator
        • Jan 2017
        • 1025

        #4
        I think in many cases I only went with udpatecharinfoS with the reasoning that whatever character info might be written upon loading a save will be identical to the information output when that save was saved, so it's unneeded.

        The important parts are I guess the format and the directory that the output goes to. It's basically just JSON eg:

        {
        race: "Half-Orc",
        class: "Blackguard",
        mapName: "Angband",
        dLvl: "0",
        cLvl: "1",
        isDead: "0",
        killedBy: "(saved)"
        }

        Comment

        • Cryomaniac
          Swordsman
          • Jan 2022
          • 284

          #5
          Added this code to save.c/load.c, did a quick check on my PC - seems to work properly, it created a similar CharOutput.txt for me. Made the commit to my github project.

          Not sure if I can cleanly implement support for victory tracking - right now, the variant expects death cause to be just "ripe" if we're looking at a victory dump, tinkering with this could break old behaviour.

          Comment

          • Gwarl
            Administrator
            • Jan 2017
            • 1025

            #6
            If you can confirm that the killedBy field will be =="ripe" for a victory I can just add that as a condition for victory, possibly even for gensouband specifically in case of a variant having a unique called 'ripe'

            Comment

            • Cryomaniac
              Swordsman
              • Jan 2022
              • 284

              #7
              I don't have a winner character on hand right now to directly confirm that, but according to the source code, the p_ptr->died_from field (which will be copied to killedBy in the dump) can have following special values:

              "ripe" - Standard victory
              "triumph" - As an Outsider, win the game and leave Gensoukyou
              "hourai" - As a Chemist, make the Hourai Elixir and drink it
              "true_loser" - As Shion, defeat Serpent of Chaos in your super form

              Comment

              • Gwarl
                Administrator
                • Jan 2017
                • 1025

                #8
                I've added logic fro registering gensouband victories.

                I think I may have misled you about main-gcu.c I'm currently running into compile errors, can you revert that commit? I can take a look at implementing the customiseable subwindows myself later, it's not critical for this variant anyway since the hardcoded subwindow layout seems to come from Zangband and be very reasonable.

                Comment

                • Cryomaniac
                  Swordsman
                  • Jan 2022
                  • 284

                  #9
                  Changed to older version of main-gcu, made commit.

                  Comment

                  • Gwarl
                    Administrator
                    • Jan 2017
                    • 1025

                    #10
                    Seems to be working.

                    Comment

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