improved GCU code in HEAD

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • d_m
    Angband Devteam member
    • Aug 2008
    • 1517

    improved GCU code in HEAD

    I just checked in some changes that I hope will make playing Angband in GCU (ncurses) even better than it already is! I mostly play Angband this way, although I'm not sure how many other people do anymore.

    Here are the changes. If anyone either notices problems linked to them, or has other issues, please let me know.

    1. On some terminals (gnome-terminal for instance) recent builds end up drawing the background not as black but as a dark-grey, which is disconcertingly bright. In the process of fixing this, I had Angband start using the default-bg provided by ncurses. This will make things like transparency or non-ANSI colored terminals work, rather than drawing black (or dark grey, or whatever).

    2. I fixed an obscure autoconf error which meant that terminals with color-changing capabilities would never actually get to do their thing. Probably no one will notice this.

    3. I made it so that on terminals supporting 256 colors (e.g. xterm-256color) you get the same range of colors as in the other ports. I have found this to be really nice.

    Anyway, I'm interested in feedback on this. Arguably #1 is sub-optimal, since people can choose dumb terminal background colors; I am (perhaps wrongly) assuming that getting things working properly in gnome-terminal, etc. is more important than supporting this.
    linux->xterm->screen->pmacs
  • Nick
    Vanilla maintainer
    • Apr 2007
    • 9647

    #2
    Nice - this has gone straight into FA.
    One for the Dark Lord on his dark throne
    In the Land of Mordor where the Shadows lie.

    Comment

    • Magnate
      Angband Devteam member
      • May 2007
      • 5110

      #3
      Originally posted by d_m
      I just checked in some changes that I hope will make playing Angband in GCU (ncurses) even better than it already is! I mostly play Angband this way, although I'm not sure how many other people do anymore.
      ...
      Anyway, I'm interested in feedback on this.
      I use -mgcu a lot, primarily over ssh (because I haven't yet learned how to set up x11 forwarding!). Many thanks for your work on this - your #1 I had noticed before, and I think I had also noticed the colours thing.

      But my biggest two issues with -mgcu are both difficult to reproduce:

      1. The numpad keys get messed up sometimes (I think this is specifically related to PuTTY - ticket #796)

      2. The solid wall characters sometimes revert to #s and %s. I think this is locale-related, but I'm not sure. Sometimes I go to "interact with visuals" and find there are no ascii graphic characters at all, only numbers and letters and the basic punctuation symbols.

      If you have any knowledge about either of these I'd be grateful for advice.
      "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

      Comment

      • Pete Mack
        Prophet
        • Apr 2007
        • 6883

        #4
        Originally posted by Magnate
        I use -mgcu a lot, primarily over ssh (because I haven't yet learned how to set up x11 forwarding!).
        ssh -Y doesn't work?

        Comment

        • d_m
          Angband Devteam member
          • Aug 2008
          • 1517

          #5
          Originally posted by Magnate
          1. The numpad keys get messed up sometimes (I think this is specifically related to PuTTY - ticket #796)
          I'm going to investigate this... I bet it has to do with calling (or failing to call) the keypad() function, or something else strange. Unfortunately I don't have a Windows machine to test with. I'll see if I can reproduce this with PuTTY on Linux; if not I may be sending some patches your way.

          Originally posted by Magnate
          2. The solid wall characters sometimes revert to #s and %s. I think this is locale-related, but I'm not sure. Sometimes I go to "interact with visuals" and find there are no ascii graphic characters at all, only numbers and letters and the basic punctuation symbols.
          I'm not really familiar with the "interact with visuals" so you'll have to be more specific about what you're doing. That said, my guess is that this issue has to do with what the value of $TERM is (and by extension, the values in the termino/termcap database on the host you're playing Angband on). I think the graphics come from the ACS (alternate-character set) which xterm and many other terminals define.

          I'm attaching a pretty useful C program to inspect what curses believes about your terminal. You can compile it with "gcc -lncurses -o tty-colors tty-colors.c"
          Attached Files
          linux->xterm->screen->pmacs

          Comment

          • david3x3x3
            Scout
            • Jun 2009
            • 28

            #6
            I just tried out this version. This has the same problem for me that all of the 3.1.1 versions have had. It could be a problem with my PC configuration. I run the xterm-242-3.fc11.i586 package on Fedora 11. Every time I run Angband within an Xterm window, all of the wall characters are invisible. I prefer playing Angband with # signs for the wall characters rather than solid blocks. I haven't figured out the -mx11 flag to get # signs, either.

            Comment

            • Pete Mack
              Prophet
              • Apr 2007
              • 6883

              #7
              You can always override the default (borked) prefs with your own.
              In the "features" knowledge menu, "interact with visuals", and set the value to what you want. Then save your prefs.
              But that's a lot of work, for so many features.

              Alternatively, edit font-x11.prf, and delete all the overrides for granite and permanent walls.

              Comment

              • d_m
                Angband Devteam member
                • Aug 2008
                • 1517

                #8
                Originally posted by david3x3x3
                I just tried out this version. This has the same problem for me that all of the 3.1.1 versions have had. It could be a problem with my PC configuration. I run the xterm-242-3.fc11.i586 package on Fedora 11. Every time I run Angband within an Xterm window, all of the wall characters are invisible. I prefer playing Angband with # signs for the wall characters rather than solid blocks. I haven't figured out the -mx11 flag to get # signs, either.
                Please give me the output of:

                Code:
                infocmp
                Are you running from within screen? Over SSH? If I were you, I'd try different TERM types (vt100, xterm, xterm-256color, vt220, etc) to see the different effects. E.g. "TERM=xterm angband -mgcu"

                At this point, I think making some subopts to control GCU graphics (e.g. whether or not to use the ACS) would be good. I have definitely seen issues with the ACS in certain UTF-8 terminals, as well as in misconfigured environments.
                linux->xterm->screen->pmacs

                Comment

                • d_m
                  Angband Devteam member
                  • Aug 2008
                  • 1517

                  #9
                  Originally posted by d_m
                  At this point, I think making some subopts to control GCU graphics (e.g. whether or not to use the ACS) would be good. I have definitely seen issues with the ACS in certain UTF-8 terminals, as well as in misconfigured environments.
                  Well, I've already taken my own advice.

                  If you play SVN HEAD, as of r1628 you should see two new subopts. -a(scii) does not use the fancy ACS graphic characters, so it will give you old-style # walls. -g(raphics) is the default behavior currently, which mostly means the solid walls using the ACS_CKBOARD character.

                  While there is an argument (I guess) that manually editing the tiles supersedes this, many terminals don't correctly advertise their capabilities--in those cases, being able to say "this terminal doesn't actually have ACS graphics so don't use them" is nicer than expecting the user to create a custom termcap file, or custom Angband graphics.
                  linux->xterm->screen->pmacs

                  Comment

                  • david3x3x3
                    Scout
                    • Jun 2009
                    • 28

                    #10
                    Originally posted by d_m
                    Please give me the output of:

                    Code:
                    infocmp
                    Code:
                    #       Reconstructed via infocmp from file: /usr/share/terminfo/x/xterm
                    xterm|xterm terminal emulator (X Window System),
                            am, bce, km, mc5i, mir, msgr, npc, xenl,
                            colors#8, cols#80, it#8, lines#24, pairs#64,
                            acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
                            bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
                            clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M,
                            csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
                            cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
                            cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
                            cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
                            dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K,
                            flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG,
                            ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L,
                            ind=^J, indn=\E[%p1%dS, invis=\E[8m,
                            is2=\E[!p\E[?3;4l\E[4l\E>, kDC=\E[3;2~, kEND=\E[1;2F,
                            kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~,
                            kPRV=\E[5;2~, kRIT=\E[1;2C, kb2=\EOE, kbs=\177, kcbt=\E[Z,
                            kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
                            kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~,
                            kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q,
                            kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~,
                            kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~,
                            kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~,
                            kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S,
                            kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~,
                            kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~,
                            kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q,
                            kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~,
                            kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~,
                            kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~,
                            kf48=\E[24;6~, kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q,
                            kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~,
                            kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~,
                            kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~,
                            kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~,
                            kf8=\E[19~, kf9=\E[20~, khome=\EOH, kich1=\E[2~,
                            kind=\E[1;2B, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
                            kri=\E[1;2A, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El,
                            memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM,
                            rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l,
                            rmir=\E[4l, rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m,
                            rmul=\E[24m, rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7,
                            setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
                            setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
                            setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
                            sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
                            sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h,
                            smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m,
                            smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n,
                            u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd,
                    Are you running from within screen? Over SSH?
                    No.

                    I'll try out the new option that you added.

                    Comment

                    • david3x3x3
                      Scout
                      • Jun 2009
                      • 28

                      #11
                      Originally posted by david3x3x3
                      I'll try out the new option that you added.
                      I tried it out. The walls are no longer invisible under xterm, however the -a option doesn't seem to have any effect. The wall characters are graphics. I'm running angband -mgcu -- -a. I assume that's the correct syntax.

                      Comment

                      • d_m
                        Angband Devteam member
                        • Aug 2008
                        • 1517

                        #12
                        Originally posted by david3x3x3
                        I tried it out. The walls are no longer invisible under xterm, however the -a option doesn't seem to have any effect. The wall characters are graphics. I'm running angband -mgcu -- -a. I assume that's the correct syntax.
                        That's really strange. Does the help menu list -a and -g as new options?

                        Did you make clean? Are you running r1628? I have no explanation for the behavior you see, although I'm glad the wall tiles are working for you now. I tested -a and -g on a number of terminals and both work fine for me.

                        Later today I will try running Angband in an xterm with your termcap file and see what happens.
                        linux->xterm->screen->pmacs

                        Comment

                        • david3x3x3
                          Scout
                          • Jun 2009
                          • 28

                          #13
                          Originally posted by d_m
                          That's really strange. Does the help menu list -a and -g as new options?
                          Yes.

                          I was browsing through the source, and I see the -g option around line 783 of main-gcu.c, but I don't see anything to read the -a option.

                          Comment

                          • david3x3x3
                            Scout
                            • Jun 2009
                            • 28

                            #14
                            I added these lines to my code:

                            Code:
                                            else if (prefix(argv[i], "-a"))
                            	                        use_alt_charset = 0;
                            It works fine.

                            Comment

                            • d_m
                              Angband Devteam member
                              • Aug 2008
                              • 1517

                              #15
                              Somehow I managed to clobber that code before committing--I had something basically identical which I thought I checked in.

                              Anyway, thanks for catching that; it's fixed in HEAD now.

                              Do you have any idea why the graphics started working for you? Did you change any settings?
                              linux->xterm->screen->pmacs

                              Comment

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