Future-proof cross-platform interface library, only GCU / ncurses?

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

    Future-proof cross-platform interface library, only GCU / ncurses?

    When I try to compile older angband variants, I see all kinds of libraries break. SDL 1 breaks, because SDL 2 is the new standard and is not backward compatible. GTK breaks too. If the variant is no longer maintained, these probably no longer compile.

    It looks like only GCU / ncurses and X11 always compile consistently even for unmaintained variants. And ncurses also has built-in Windows and Mac support (not X11?). So does that mean ncurses is the only future-proof interface that will work on any platform, or is there another cross-platform interface library that is highly recommended today?
  • Pete Mack
    Prophet
    • Apr 2007
    • 6883

    #2
    X11 works on Mac with a bit of effort. (On Windows too, but I hate it.) At some point you are just better dropping in a new(er) main-xxx.c file and a modern makefile. (All you need to change is makefile.src)

    Comment

    • Nick
      Vanilla maintainer
      • Apr 2007
      • 9647

      #3
      There has been an SDL2 interface written for V, but Ihaven't looked at it properly and am not sure how complete it is.
      One for the Dark Lord on his dark throne
      In the Land of Mordor where the Shadows lie.

      Comment

      • PowerWyrm
        Prophet
        • Apr 2008
        • 2987

        #4
        What's wrong with SDL 1? The libs are still available, so you shouldn't have any problem compiling...
        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

        • Gwarl
          Administrator
          • Jan 2017
          • 1025

          #5
          Originally posted by droof
          When I try to compile older angband variants, I see all kinds of libraries break. SDL 1 breaks, because SDL 2 is the new standard and is not backward compatible. GTK breaks too. If the variant is no longer maintained, these probably no longer compile.

          It looks like only GCU / ncurses and X11 always compile consistently even for unmaintained variants. And ncurses also has built-in Windows and Mac support (not X11?). So does that mean ncurses is the only future-proof interface that will work on any platform, or is there another cross-platform interface library that is highly recommended today?
          What I did of course was use a javascript terminal emulator to provide a frontend - everything then runs everywhere. There are no graphics though. Yet.

          But I hope to one day find the time to do it. Plain text output is very ordered and it wouldn't be difficult to give a computer a general description of what an angband output is attempting to display in order to present it graphically.

          Comment

          • fph
            Veteran
            • Apr 2009
            • 1030

            #6
            What is your goal here? Compiling old versions of Angband, or figuring out which interface you should use for a variant you are developing?
            --
            Dive fast, die young, leave a high-CHA corpse.

            Comment

            • droof
              Apprentice
              • Dec 2013
              • 71

              #7
              I'm trying to find my way through the Unangband codebase. It's huge and I'd prefer not to worry about interfaces and platform compatibility as I focus on gameplay changes without causing bugs on specific interfaces.

              I see a lot of custom code for platform-specific interfaces. X11 for Linux, Win32 for Windows, Carbon for Mac. Each interface has a lot of custom code.

              Ideally I'd prefer a single worry-free maintenance-free write-once interface for all platforms, so that all platforms run on the same code and making testing easier.

              From compiling older unmaintained variants, ncurses and X11 seem code maintenance free. These always work and never cause trouble for me, even if the last code update was 2003 (like zangband). Even though I'm running the latest Ubuntu.

              SDL 1 does still work with some lib dependency effort, but the SDL 2 compatibility break doesn't make it maintenance free like ncurses or X11.

              Ncurses says it supports Windows natively since version 5.8, so if that works as easy as any other Windows application, this might be my best bet.

              Is there any other interface library that is worth reading up on for me, to create a "write once, use anywhere, don't worry about the singular interface code anymore and just focus on gameplay" kind of interface?

              Can ncurses or X11 run on Windows without the user having to jump through hoops to get it running if they have a pre-compiled binary?

              Comment

              • AnonymousHero
                Veteran
                • Jun 2007
                • 1393

                #8
                Originally posted by droof
                Is there any other interface library that is worth reading up on for me, to create a "write once, use anywhere, don't worry about the singular interface code anymore and just focus on gameplay" kind of interface?
                Ah, the old "write once, use anywhere" idea . The closest you're probably going to get is if you represent everything using an RGB bitmap and just write that to some abstract "screen". However, that leaves you without (true) console support and you'd have to write basically everything yourself (or rely on libraries).

                (Input is a separate matter, but keyboard is usually not *that* bad to just map more-or-less directly. However, it does have to integrate cleanly into the event loop.)

                Most graphical UIs can support this type of application with minimal "shim" code, but performance can be an issue, especially on high-resolution screens. (If you're using e.g. OpenGL or similar, you should be fine, but... that's not really universal, so...)

                Originally posted by droof
                Can ncurses or X11 run on Windows without the user having to jump through hoops to get it running if they have a pre-compiled binary?
                No. (Well, ncurses maybe, but I'm doubtful.)

                Comment

                • Gwarl
                  Administrator
                  • Jan 2017
                  • 1025

                  #9
                  It'll work fine with a precompiled binary. You may have to do some hacks with pdcurses to compile said binary though.

                  Comment

                  • droof
                    Apprentice
                    • Dec 2013
                    • 71

                    #10
                    The abstract screen approach is a fun idea. That sounds like a graphical equivalent of ncurses. If someone ever decided to pick that idea up, I'll use it

                    PDcurses works like a charm, that's great! I can compile for linux natively with ncurses and cross-compile for windows with pdcurses. Mac can probably do ncurses as well. PDcurses also supports SDL 1 and 2, very interesting if I can get the SDL library to cross-compile.

                    Now my GCU colors are messed up. My terminal only has 16 colors by default, so I'll optimize for those 16 colors and hope the Windows console build can use equivalent colors. Then back to the fun part, gameplay ^^

                    Thanks everyone!

                    Comment

                    • Pete Mack
                      Prophet
                      • Apr 2007
                      • 6883

                      #11
                      When I tried the SDL front-end (some time ago), the performance was unacceptable, though it is possible that this has changed.
                      Originally posted by PowerWyrm
                      What's wrong with SDL 1? The libs are still available, so you shouldn't have any problem compiling...

                      Comment

                      • takkaria
                        Veteran
                        • Apr 2007
                        • 1951

                        #12
                        The Windows frontend really very rarely needs any changes, it's pretty much been the same for at least 15 years. I'd advise keeping it rather than making people play a much less functional curses version.
                        takkaria whispers something about options. -more-

                        Comment

                        • droof
                          Apprentice
                          • Dec 2013
                          • 71

                          #13
                          Originally posted by takkaria
                          The Windows frontend really very rarely needs any changes, it's pretty much been the same for at least 15 years. I'd advise keeping it rather than making people play a much less functional curses version.
                          In Unangband most options of the Windows front-end don't respond or break the game. That's why was looking for a single front-end code alternative, to avoid having to deal with such problems.

                          Comparing that to the Zangband Windows front-end, everything except one option works. Nothing breaks. If I'd build on the solid Zangband base, then these front-ends are all fine.

                          Comment

                          • takkaria
                            Veteran
                            • Apr 2007
                            • 1951

                            #14
                            Originally posted by droof
                            In Unangband most options of the Windows front-end don't respond or break the game. That's why was looking for a single front-end code alternative, to avoid having to deal with such problems.

                            Comparing that to the Zangband Windows front-end, everything except one option works. Nothing breaks. If I'd build on the solid Zangband base, then these front-ends are all fine.
                            Ah, damn. I didn't realise Un had made such changes.
                            takkaria whispers something about options. -more-

                            Comment

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