SDL2 port when ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shirish
    Rookie
    • Aug 2018
    • 23

    #16
    I would rather have the maintainer be with us rather than having a fork because a fork takes a lot of time. I do not know what targets the maintainer has but if mobile is going to be a space then android has quite a bit of support with libsdl2

    https://wiki.libsdl.org/Android .

    Of course all osses are moving to libsdl2 from libsdl1.2 . Even SBC's like raspberry pi and like are moving to libsdl2

    See https://choccyhobnob.com/raspberry-p...-raspberry-pi/ as an example and games like bzflag https://github.com/BZFlag-Dev/bzflag/issues/94 , wine https://www.winehq.org/announce/3.0.3 and few others . There is also this interesting discussion at https://www.gamedev.net/forums/topic...n-to-use-sdl2/

    Comment

    • Nick
      Vanilla maintainer
      • Apr 2007
      • 9637

      #17
      Originally posted by t4nk
      So... question to the maintainer:
      NIck, let's be realistic here, textui2 will never make it into Angband. However, main-sdl2.c is a plausible addition to the game. It's just another frontend, after all. SDL1 is an obsolete library, and SDL2 port, as you know, has more and better functionality. I can register on Github again and send a pull request. What do you say?
      That sounds good. I’m hoping to be back working on Angband in a couple of weeks, and will pull it in then.

      I wouldn’t necessarily say never for textui2 either , but I am an optimist
      One for the Dark Lord on his dark throne
      In the Land of Mordor where the Shadows lie.

      Comment

      • shirish
        Rookie
        • Aug 2018
        • 23

        #18
        Originally posted by Nick
        That sounds good. I’m hoping to be back working on Angband in a couple of weeks, and will pull it in then.

        I wouldn’t necessarily say never for textui2 either , but I am an optimist
        Having the maintainer's blessings is good.

        @t4nk now it's upto you, let me know when you want to sign up for either github.com or gitlab.com

        Update - The repo. (wherever it's hosted) would be to test and get feedback from each other and if and when it's clean and mergeable state get it into angband main repo. Win, win for all.

        Comment

        • t4nk
          Swordsman
          • May 2016
          • 336

          #19
          Originally posted by shirish
          Having the maintainer's blessings is good.

          @t4nk now it's upto you, let me know when you want to sign up for either github.com or gitlab.com

          Update - The repo. (wherever it's hosted) would be to test and get feedback from each other and if and when it's clean and mergeable state get it into angband main repo. Win, win for all.
          OK. I'll be busy tomorrow, I think I can do it the day after tomorrow. Or at least, I'll upload somewhere the three files required - main-sdl2.c, the updated main.c and the Makefile (which also needs updating), as you seem to have some interest in trying it out. The frontend does have some revolutionary features, such as the ability to use resizable fonts - .ttf, .otf and stuff. Amazing, right? (or, rather, it's amazing that Angband still uses the .fon files in 2018...)

          Comment

          • shirish
            Rookie
            • Aug 2018
            • 23

            #20
            sure, take your time. This is how angband is shown in Debian testing -

            Code:
            $ aptitude show angband
            Package: angband                         
            Version: 1:3.5.1-2.2+b1
            State: not installed
            Priority: optional
            Section: games
            Maintainer: Chris Carr <rantingman@gmail.com>
            Architecture: amd64
            Uncompressed Size: 3,254 k
            Depends: libc6 (>= 2.14), libncursesw6 (>= 6), libsdl-image1.2 (>= 1.2.10), libsdl-mixer1.2, libsdl-ttf2.0-0,
                     libsdl1.2debian (>= 1.2.11), libtinfo6 (>= 6), libx11-6, angband-data
            Recommends: xfonts-base
            Suggests: angband-audio, angband-bigtiles
            There are however couple of angband audio bugs which have been there a while -



            and



            maybe an updated SDL build with the SDL2 frontend, audio etc. may fix some of the problems. Of course the maintainer would have to do the packaging part but it might work. I would signal to the maintainer that we are going to try and have an updated build with SDL2 .

            This is how most libsdl2 libraries look , just sharing the working parts at the moment -

            Code:
            $ dpkg -L libsdl2-mixer-dev
            /.
            /usr
            /usr/include
            /usr/include/SDL2
            /usr/include/SDL2/SDL_mixer.h
            /usr/lib
            /usr/lib/x86_64-linux-gnu
            /usr/lib/x86_64-linux-gnu/libSDL2_mixer.a
            /usr/lib/x86_64-linux-gnu/pkgconfig
            /usr/lib/x86_64-linux-gnu/pkgconfig/SDL2_mixer.pc
            /usr/lib/x86_64-linux-gnu/libSDL2_mixer-2.0.so
            /usr/lib/x86_64-linux-gnu/libSDL2_mixer.so
            There are coding documentation examples in -
            Code:
            /usr/share/doc/libsdl2-mixer-dev/examples/playmus.c
            /usr/share/doc/libsdl2-mixer-dev/examples/playwave.c
            Unfortunately (or not) the bigtiles package is no more there

            Code:
            $ aptitude show angband-bigtiles
            No candidate version found for angband-bigtiles
            Package: angband-bigtiles
            State: not a real package
            Let's focus though on one thing at one time, the other things we can try to do later if we can.

            Comment

            • Magnate
              Angband Devteam member
              • May 2007
              • 5110

              #21
              Hi Shirish, thanks for the email. It's funny how life happens sometimes, I was thinking only the other day it's time I updated Angband in Debian, 4.x must be pretty mature now and I expect some free time this fall ... and lo, something happens to pull me back.

              I can't promise anything soon, but months rather than years. I'll start with a bog-standard package of Angband 4.x, then I'm going to fix up angband-audio, then I'll see if I can help on SDL2.

              Derakon, Nick - hope you're well.

              CC
              "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

              Comment

              • Nick
                Vanilla maintainer
                • Apr 2007
                • 9637

                #22
                Originally posted by Magnate
                Hi Shirish, thanks for the email. It's funny how life happens sometimes, I was thinking only the other day it's time I updated Angband in Debian, 4.x must be pretty mature now and I expect some free time this fall ... and lo, something happens to pull me back.

                I can't promise anything soon, but months rather than years. I'll start with a bog-standard package of Angband 4.x, then I'm going to fix up angband-audio, then I'll see if I can help on SDL2.

                Derakon, Nick - hope you're well.

                CC
                Good to hear from you! Am currently recovering from surgery according to plan, so let's call that well
                One for the Dark Lord on his dark throne
                In the Land of Mordor where the Shadows lie.

                Comment

                • Derakon
                  Prophet
                  • Dec 2009
                  • 9022

                  #23
                  Good to see you, Magnate! I'm doing decently well. Life continues on, no great peaks nor abyssal chasms.

                  Comment

                  • t4nk
                    Swordsman
                    • May 2016
                    • 336

                    #24
                    I sent the pull request:
                    This adds main-sdl2.c, an SDL2 port of the game. It also adds a Makefile to compile it, but no changes to autoconf system.


                    For those who are interested in compiling it (instructions for Debian-based systems!):

                    You'll need three libraries: the "base" SDL2, SDL2_ttf (fonts stuff) and SDL2_image (loading .png files and such). Also, their dependecies (Freetype, zlib and co). If you want sounds, you'll also need SDL2_mixer. In short:
                    Code:
                    apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev
                    Clone the repo and switch to sdl2 branch:
                    Code:
                    git clone https://github.com/t4nk074/angband
                    git checkout sdl2
                    Configure Angband without any frontends (just in case):
                    Code:
                    cd angband
                    ./autogen.sh
                    ./configure --with-no-install --disable-curses --disable-x11
                    (I think other stuff is disabled by default)

                    Now compile the game using Makefile.sdl2:
                    Code:
                    cd src
                    make -f Makefile.sdl2
                    If you want sounds, use this instead:
                    Code:
                    cd src
                    SOUND=yes make -f Makefile.sdl2
                    Now it should work... well, works for me
                    Code:
                    cd ..
                    ./angband
                    Let me know if there are any problems!

                    Comment

                    • shirish
                      Rookie
                      • Aug 2018
                      • 23

                      #25
                      Reply in-line :-

                      Originally posted by t4nk
                      I sent the pull request:
                      This adds main-sdl2.c, an SDL2 port of the game. It also adds a Makefile to compile it, but no changes to autoconf system.


                      For those who are interested in compiling it (instructions for Debian-based systems!):

                      You'll need three libraries: the "base" SDL2, SDL2_ttf (fonts stuff) and SDL2_image (loading .png files and such). Also, their dependecies (Freetype, zlib and co). If you want sounds, you'll also need SDL2_mixer. In short:
                      Code:
                      apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev
                      Clone the repo and switch to sdl2 branch:
                      Code:
                      git clone https://github.com/t4nk074/angband
                      git checkout sdl2
                      Shouldn't this be from inside the repo. I have done the following -

                      Code:
                      ~/games$ git clone https://github.com/t4nk074/angband angband-t4nk074
                      Cloning into 'angband-t4nk074'...
                      remote: Counting objects: 56527, done.
                      remote: Compressing objects: 100% (30/30), done.
                      remote: Total 56527 (delta 15), reused 14 (delta 8), pack-reused 56489
                      Receiving objects: 100% (56527/56527), 64.93 MiB | 287.00 KiB/s, done.
                      Resolving deltas: 100% (45476/45476), done.
                      Then -

                      Code:
                      ~/games$ cd angband-t4nk074/
                      ~/games/angband-t4nk074$ git checkout sdl2
                      Branch 'sdl2' set up to track remote branch 'sdl2' from 'origin'.
                      Switched to a new branch 'sdl2'
                      I would be updating my answer as I do the next steps.

                      Originally posted by t4nk
                      Configure Angband without any frontends (just in case):
                      Code:
                      cd angband
                      ./autogen.sh
                      ./configure --with-no-install --disable-curses --disable-x11
                      (I think other stuff is disabled by default)

                      Now compile the game using Makefile.sdl2:
                      Code:
                      cd src
                      make -f Makefile.sdl2
                      If you want sounds, use this instead:
                      Code:
                      cd src
                      SOUND=yes make -f Makefile.sdl2
                      Now it should work... well, works for me
                      Code:
                      cd ..
                      ./angband
                      Let me know if there are any problems!
                      The compilation terminated see https://paste.debian.net/1043948/

                      This is when I have all the -dev versions that were needed -

                      Code:
                      $ apt-cache policy libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev
                      libsdl2-dev:
                        Installed: 2.0.8+dfsg1-2
                        Candidate: 2.0.8+dfsg1-2
                        Version table:
                       *** 2.0.8+dfsg1-2 500
                              500 http://deb.debian.org/debian buster/main amd64 Packages
                              100 http://deb.debian.org/debian unstable/main amd64 Packages
                              100 /var/lib/dpkg/status
                      libsdl2-ttf-dev:
                        Installed: 2.0.14+dfsg1-2
                        Candidate: 2.0.14+dfsg1-2
                        Version table:
                       *** 2.0.14+dfsg1-2 500
                              500 http://deb.debian.org/debian buster/main amd64 Packages
                              100 http://deb.debian.org/debian unstable/main amd64 Packages
                              100 /var/lib/dpkg/status
                      libsdl2-image-dev:
                        Installed: 2.0.3+dfsg1-1
                        Candidate: 2.0.3+dfsg1-1
                        Version table:
                       *** 2.0.3+dfsg1-1 500
                              500 http://deb.debian.org/debian buster/main amd64 Packages
                              100 http://deb.debian.org/debian unstable/main amd64 Packages
                              100 /var/lib/dpkg/status
                      libsdl2-mixer-dev:
                        Installed: 2.0.2+dfsg1-2
                        Candidate: 2.0.2+dfsg1-2
                        Version table:
                       *** 2.0.2+dfsg1-2 500
                              500 http://deb.debian.org/debian buster/main amd64 Packages
                              100 http://deb.debian.org/debian unstable/main amd64 Packages
                              100 /var/lib/dpkg/status
                      Last edited by shirish; September 24, 2018, 16:08.

                      Comment

                      • takkaria
                        Veteran
                        • Apr 2007
                        • 1951

                        #26
                        You should probably run ./configure with --disable-sdl-mixer too. (Hi magnate!)
                        takkaria whispers something about options. -more-

                        Comment

                        • shirish
                          Rookie
                          • Aug 2018
                          • 23

                          #27
                          Originally posted by takkaria
                          You should probably run ./configure with --disable-sdl-mixer too. (Hi magnate!)
                          Hi all,

                          I retried and failed -

                          Code:
                          ~/games/angband-t4nk074$ ./autogen.sh
                          *info* running aclocal (-I m4)
                          *info* running autoheader
                          *info* running autoconf
                          and then - will be sharing just the start and end messages -

                          Code:
                          ~/games/angband-t4nk074$ ./configure --with-no-install --disable-curses --disable-x11 --disable-sdl-mixer
                          checking build system type... x86_64-unknown-linux-gnu
                          checking host system type... x86_64-unknown-linux-gnu
                          checking target system type... x86_64-unknown-linux-gnu
                          .....
                          .....
                          configure: creating ./config.status
                          config.status: creating mk/buildsys.mk
                          config.status: creating mk/extra.mk
                          config.status: creating mk/sinclude.mk
                          config.status: creating src/autoconf.h
                          config.status: src/autoconf.h is unchanged
                          
                          Configuration:
                          
                            Install path:                           (not used)
                            binary path:                            ..
                            config path:                            /home/shirish/games/angband-t4nk074/lib/
                            lib path:                               /home/shirish/games/angband-t4nk074/lib/
                            doc path:                               /home/shirish/games/angband-t4nk074/doc/
                            var path:                               /home/shirish/games/angband-t4nk074/lib/
                          
                          -- Frontends --
                          - Curses                                  Disabled
                          - X11                                     Disabled
                          - SDL                                     Disabled
                          - Windows                                 Disabled
                          - Test                                    No
                          - Stats                                   No
                          
                          - SDL sound                               Disabled
                          Still got the same issue -

                          Code:
                          shirish@debian:~/games/angband-t4nk074$ cd src/
                          shirish@debian:~/games/angband-t4nk074/src$ SOUND=yes make -f Makefile.sdl2
                                  CC snd-sdl.c           
                          snd-sdl.c:25:10: fatal error: SDL/SDL.h: No such file or directory
                           #include <SDL/SDL.h>
                                    ^~~~~~~~~~~
                          compilation terminated.
                          make: *** [Makefile.sdl2:100: snd-sdl.o] Error 1
                          Perhaps it should be -
                          SDL2/SDL.h

                          Code:
                          $ dpkg -L libsdl2-dev | grep SDL.h
                          /usr/include/SDL2/SDL.h
                          /usr/include/SDL2/SDL_haptic.h
                          /usr/include/SDL2/SDL_hints.h
                          I was able to fix it by doing in sdl2.c -

                          Code:
                          $ cat snd-sdl.c | grep include
                           *    are included in all such copies.  Other copyrights may also apply.
                          #include "angband.h"
                          #include "init.h"
                          #include "sound.h"
                          #include <SDL2/SDL.h>
                          #include <SDL2/SDL_mixer.h>
                          just changed SDL/SDL.h and SDL/SDL_mixer.h to SDL2/SDL.h and SDL2/SDL.mixer.h

                          and was able to compile -

                          Code:
                          ~/games/angband-t4nk074/src$ SOUND=yes make -f Makefile.sdl2
                                  CC snd-sdl.c           
                                LINK angband             
                          cp angband ..
                          Last edited by shirish; September 24, 2018, 17:08.

                          Comment

                          • t4nk
                            Swordsman
                            • May 2016
                            • 336

                            #28
                            Originally posted by shirish
                            The compilation terminated see https://paste.debian.net/1043948/
                            Ah, I see. I have SDL1 headers installed, so gcc looks into /usr/include and there is "SDL" directory there. You have only SDL2, so you have /usr/include/SDL2 (but not /usr/include/SDL). So it fails to find it (SDL_mixer API hasn't changed between 1 and 2).

                            Anyway, looks like you're close snd-sdl.c has two lines:

                            Code:
                            #include <SDL/SDL.h>
                            #include <SDL/SDL_mixer.h>
                            (lines 25 and 26)

                            Those need to be replaced with:

                            Code:
                            #include <SDL.h>
                            #include <SDL_mixer.h>

                            Comment

                            • shirish
                              Rookie
                              • Aug 2018
                              • 23

                              #29
                              @t4nk, I just did that, see above

                              Btw we don't seem to have any graphics, it still shows up in ASCII mode with the skeletons as background.

                              I did try -
                              Code:
                              ~/games/angband-t4nk074$ ./angband -g -ssdl -msdl2
                              Also angband doesn't seem to have any options for windowed mode from what all I could see/gather -

                              Code:
                              $ ./angband --help
                              Usage: angband [options] [-- subopts]
                                -n             Start a new character (WARNING: overwrites default savefile without -u)
                                -l             Lists all savefiles you can play
                                -w             Resurrect dead character (marks savefile)
                                -g             Request graphics mode
                                -x<opt>        Debug options; see -xhelp
                                -u<who>        Use your <who> savefile
                                -d<dir>=<path> Override a specific directory with <path>. <path> can be:
                                  scores (default is /home/shirish/games/angband-t4nk074/lib/scores)
                                  gamedata (default is /home/shirish/games/angband-t4nk074/lib/gamedata)
                                  screens (default is /home/shirish/games/angband-t4nk074/lib/screens)
                                  help (default is /home/shirish/games/angband-t4nk074/lib/help)
                                  info (default is /home/shirish//.angband/Angband/info)
                                  pref (default is /home/shirish/games/angband-t4nk074/lib/customize)
                                  fonts (default is /home/shirish/games/angband-t4nk074/lib/fonts)
                                  tiles (default is /home/shirish/games/angband-t4nk074/lib/tiles)
                                  sounds (default is /home/shirish/games/angband-t4nk074/lib/sounds)
                                  icons (default is /home/shirish/games/angband-t4nk074/lib/icons)
                                  user (default is /home/shirish//.angband/Angband)
                                  save (default is /home/shirish/games/angband-t4nk074/lib/save)
                                               Multiple -d options are allowed.
                                -s<mod>        Use sound module <sys>:
                                   sdl   SDL_mixer sound module
                                      
                                -m<sys>        Use module <sys>, where <sys> can be:
                                   sdl2   SDL2 frontend
                              Also for the mixer, shouldn't it be sdl2_mixer. I haven't been able to hear any sound
                              Last edited by shirish; September 24, 2018, 17:19.

                              Comment

                              • t4nk
                                Swordsman
                                • May 2016
                                • 336

                                #30
                                p.s. Hi, Takkaria

                                Comment

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