Announcement

Collapse
No announcement yet.

COMPILE: Linux Port

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Well, I went back to work on this today.

    First I had to make a few changes to get everything compiling under gcc 4.0.

    The trick of clicking the mouse did indeed get me to the main menu. I don't think this delay is related to the intro movie, because it still occurs when I give the nointromovie command line argument.

    I tried to get to the credits screen, since you claimed that you could, and I had to fix a couple of segfaults and allow the game to handle dos line endings in credits.txt to get there. In the process I unknowingly fixed the problem which was causing all the colours to be mixed up (except on the cursor - they're still wrong there - I don't know why because I don't know how I fixed it in the other instances). I can now get to the credits screen, but in doing so I get an error and no credits. I think this is due to the line ending being wrong again.
    Last edited by J Bytheway; September 19, 2005, 18:08.

    Comment


    • OK. Finally commited the changes described in the above post and a few more besides.

      With your changes to how anet works I had to fix a fair few compiler warnings in the anet code - I tried to avoid messing with anything which might affect how the library is used, but I don't know how successful I was.

      Also, I had to manually run through aclocal, autoheader, etc. for the anet configuration because simply running configure yielded an error when it tried to configure anet - it was looking for the "Cygnus configure script" in os/autoconf/config, which wasn't there.

      I suspect that the change I made which fixed the colour problem was the disambiguation in aui_blitter.cpp - the statements there had compiler-specific results which could end up with everything being shifted a byte, which would explain what happened. However, if that is the case then I don't know why the cursor is still displayed wrong.

      When I fixed the reading of credits.txt properly I was able to get to the credits screen and look at all the credits there. There remains only a minor graphical glitch with the flames.

      The options screen now works - I confirmed that the options are properly saved into and reloaded from userprofile.txt.

      I can get to the new game screen, but the text boxes are all broken.

      To launch a game, I tweaked the CD checking code so that it will read texture.dat from the current directory if it can't find it in the directory of the executable. I can confirm that the CD checking works properly (nice job there ).

      When I tried to launch a game, I first encountered errors caused by my not having copied the libraries to the plugin directory. When I fixed that I got to an error related to the tiles, which I have not investigated.

      Because I was fed up with waiting for ages for ctp2 to link every time I changed a cpp file, I reinstated some of the helper libraries. I may institute some more and see if it actually speeds the linking process.

      Now that there are so many things that it's possible to do, I decided that we needed to have a place to store a list of bugs. I created a file BUGS for this purpose and listed all the bugs I could think of in it. There's plently for us to get our teeth into.

      Comment


      • Celebration! The game works! . At least, it worked for me today for a few turns before segfaulting. I'll try to commit the relevant changes now, but it turned out that there were only a couple of things that needed to be changed to get to the game proper.

        The tileset error was simply caused by trying to load a file without including the path where it was located.

        After that, I fixed a problem where a void* was being cast to a uint32* and dereferenced when in fact it should have been simply cast to a uint32 (which only reinforces my opinion that some of this code is truly bizarre...).

        I am most surprised that the changes I made to remove non-POD data being passed through varargs calls all those months ago appear not to have caused any disasters yet...

        Of course, there are still many problems, particularly with the graphics. The list of bugs grows longer, not shorter, as things are fixed...
        Last edited by J Bytheway; September 24, 2005, 18:48.

        Comment


        • Jbytheway CONGRATS!

          I hope once you guys are satisified with it you'll continue to work on other code stuff.
          Formerly known as "E" on Apolyton

          See me at Civfanatics.com

          Comment


          • Originally posted by E
            I hope once you guys are satisified with it you'll continue to work on other code stuff.
            Probably this still takes a while, the synchronisation with the main branch is missing, and the changes have to work under windows as well.

            -Martin
            Civ2 military advisor: "No complaints, Sir!"

            Comment


            • Originally posted by Martin Gühmann
              Probably this still takes a while, the synchronisation with the main branch is missing, and the changes have to work under windows as well.
              Indeed. If you look at ctplinuxfan's plan of action, we're still quite a lot of bugfixing (and the merge with the windows code) short of milestone 2 (Indeed, I'm not sure how much of Johannes Sixt's work remains to be merged - really we're still aiming for milestone 1).
              Last edited by J Bytheway; September 24, 2005, 18:49.

              Comment


              • Well, I solved a few of the poblems which were causing segfaults during play - it's now possible to play for many turns without a crash. The graphics is still decidedly dodgy, although I managed (entirely incidentally) to fix the problem which was causing sprites to vanish.

                I've also added support for handling command line options in Linux, and now the nointromovie argument does indeed stop the blank screen problem, so I guess ctplinuxfan's diagnosis was correct after all.

                I don't know where to begin with the graphics bugs, so I tried getting the code to compile under Windows again. I made some progress, but then hit a very peculiar error in the STL somewhere with no clue as to what code is causing it.

                Comment


                • Here's a screenshot of the game running under linux. It shows three of the graphics problems:

                  - The sprite is missing (This is now fixed)
                  - The cursor colours are wrong
                  - The terrain blending isn't working properly
                  Attached Files

                  Comment


                  • Originally posted by J Bytheway
                    - The sprite is missing (This is now fixed)
                    Looks like the shadow is missing as well, I also encountered a missing sprite problem on windows, there the problem did not affect all units and the shadows are there.

                    And as I see the screen resolution is down. So probably still on the to do list.

                    -Martin
                    Civ2 military advisor: "No complaints, Sir!"

                    Comment


                    • Originally posted by Martin Gühmann
                      Looks like the shadow is missing as well, I also encountered a missing sprite problem on windows, there the problem did not affect all units and the shadows are there.
                      Well, this problem was certainly due to changes that have been made on the linux branch, so I doubt the two are related.

                      And as I see the screen resolution is down. So probably still on the to do list.
                      It is indeed. However, even if other resolutions were available I'd probably still use this one because it allows me to fit the debugger on the screen at the same time.

                      Comment


                      • Originally posted by J Bytheway
                        Here's a screenshot of the game running under linux. It shows three of the graphics problems:

                        - The sprite is missing (This is now fixed)
                        - The cursor colours are wrong
                        - The terrain blending isn't working properly
                        someone should have reported this for the ctp2 news
                        Co-Founder, Apolyton Civilization Site
                        Co-Owner/Webmaster, Top40-Charts.com | CTO, Apogee Information Systems
                        giannopoulos.info: my non-mobile non-photo news & articles blog

                        Comment


                        • Originally posted by MarkG
                          someone should have reported this for the ctp2 news
                          I guess it doesn't seem too newsworthy to me, since it's not the first time that someone's got CTP2 running this well under Linux, and of course I was involved, which naturally makes it seem less notable.

                          Nevertheless, if the implication of your comment is false, and it's not too late, I can submit some news.

                          Comment


                          • screenshots are always newsworthy
                            Co-Founder, Apolyton Civilization Site
                            Co-Owner/Webmaster, Top40-Charts.com | CTO, Apogee Information Systems
                            giannopoulos.info: my non-mobile non-photo news & articles blog

                            Comment


                            • I feel some more detailed instructions are required on how to get the game working under linux for anyone who is trying to, since deciphering the suggestions buried in this thread might be quite difficult. Here are the beginnings of such instructions:

                              - It is no longer possible to gain access to the SVN repository if you don't already have access. If anyone wants a copy of the source, ask, and I may be able to upload it somewhere.

                              - Checkout the linux branch of the source code with a command along the lines of:
                              $ svn co svn://ctp2.kaan.dk/ctp2/branches/linux ctp2

                              - Move into the directory you've just checked out and run
                              $ make bootstrap
                              which should run aclocal, autoheader, libtoolize, automake and autoconf. Don't worry about the warnings generated by aclocal, but if you get any error it's probably because you don't have all the necessary autotools installed. Ensure you have your distribution's autoconf, automake and libtool packages installed.

                              - Once that works, you can return to the root directory of the source tree and run
                              $ ./configure
                              Any errors at this stage are probably due to missing tools (such as byacc) or libraries (such as sdl). Install what you need. Remember that you need the development headers of libraries as well as the libraries themselves.

                              - Finally you can run
                              $ make
                              Again, you may get errors due to missing libraries (in theory the configure script should catch all these problems, but in practice ours isn't that good yet). Note that after installing libraries it may be necessary to rerun the configure script. Also, this stage could take a long time (on the order of an hour or more, depending on your CPU and memory), since CTP2 is a very large program. Be patient, and if you have to interrupt it with Ctrl+C, don't worry, it will start up again more or less where it left off.

                              - Now you need to get at an installation of CTP2 (probably on a partition where you have Windows installed). So, if you don't have CTP2 installed on Windows, then go and do so. If you don't have Windows installed, and can't do this, then fear not - it is possible to do a manual install, but I won't go into the details here. If your distribution is particularly spare then you may need to install something to be able to mount NTFS partitions.

                              - The ctp2 exectuable should have been compiled in ctp2_code, but you need to execute it from ctp2_code/ctp, so move into that directory and do
                              $ ../ctp2 nointromovie
                              (The nointromovie argument prevents you from having to click your way past the black screen which would otherwise be displaying the into movie, if movies were working).
                              It should start loading and then crash because it can't find all the necessary data files, but in the process it should have created a userprofile.txt for you.

                              - Edit that userprofile.txt (in a text editor of your choice). The last entry should be "RuleSets=". We want to use this option to specify where the executable should look for its files. We want to enter two paths, seperated by a semicolon. They must be relative paths not absolute paths (relative to the location from which you are running the executable). The first is the path to the ctp2_data directory checked out under linux, and the second is the path to the ctp2_data directory of the complete CTP2 installation (this can be on a read-only file system, such as an NTFS partition).

                              - Also in userprofile.txt you will find four lines like this:
                              Code:
                              MapPlugin0=dll\\map\\geometric.dll
                              MapPlugin1=dll\\map\\crater.dll
                              MapPlugin2=dll\\map\\plasma2.dll
                              MapPlugin3=dll\\map\\plasma2.dll
                              We need to put the map plugin libraries in these locations for ctp2 to find. Now, they will have these names, except with the 'dll' extension replaced by 'la', or 'a'. You can find them in ctp2_code/mapgen/.libs - copy everything out of there into ctp2_code/ctp/dll/map (Alternatively, you can alter the userprofile.txt to point to them in their original location).

                              - Copy the texture.dat file from the CTP2 installation (in ctp2_program/ctp) to the directory from which you are running the executable (this file is needed to make the CD check work properly, and is different for different versions of the CD).

                              - That should be everything! ctp2 should now work as well as it does for anyone under linux.

                              There is of course a good chance that there is more that I have forgotten. Post questions in this thread, with any error messages, etc. that you get, and we'll do our best to help make things work.
                              Last edited by J Bytheway; November 29, 2005, 14:15.

                              Comment


                              • [SIZE=1- Get access to the SVN repository by emailing kaan (see [url=http://apolyton.net/forums/showthread.php?s=&threadid=127998]here[/url] for details).
                                - Checkout the linux branch of the source code with a command along the lines of:
                                $ svn co svn://ctp2.kaan.dk/ctp2/branches/linux ctp2
                                - Move into the directory you've just checked out and run
                                $ ./autogen.sh
                                which should run aclocal, autoheader, libtoolize, automake and autoconf. Don't worry about the warnings generated by aclocal, but if you get any error it's probably because you don't have all the necessary autotools installed. Ensure you have your distribution's autoconf, automake and libtool packages installed.
                                - Once that works, you can run
                                $ ./configure
                                Any errors at this stage are probably due to missing tools (such as byacc) or libraries (such as sdl). Install what you need. Remember that you need the development headers of libraries as well as the libraries themselves.
                                Ok, I finally found some time to start working on this on my Mandriva 2006 partition. I downloaded, built and installed SVN, checked out the source, ran autoconf, got errors, installed autoconf and automake packages, ran ./configure, got errors, installed the byacc package, ran ./configure and it seems to get through just about everything fine now; it generates a bunch of makefiles and then gives me a slightly wierd error:

                                ...
                                config.status: creating ctp2_code/ui/Makefile
                                config.status: creating ctp2_code/ui/interface/Makefile
                                config.status: creating ctp2_code/os/include/config.h
                                config.status: executing depfiles commands
                                configure: configuring in ctp2_code/libs/anet
                                configure: running /bin/sh ctp2_code/os/autoconf/config/configure --prefix=/usr/local --cache-file=/dev/null --srcdir=.
                                /bin/sh: ctp2_code/os/autoconf/config/configure: No such file or directory
                                configure: error: /bin/sh ctp2_code/os/autoconf/config/configure failed for ctp2_code/libs/anet

                                Not sure what to do about this...is it really a problem? If so, any ideas what I need to do to fix it?

                                Actually, I'm rather proud of myself for getting this far by myself...I really haven't had much success building stuff from sources in the past, but I've been learning a lot about Linux development lately and it's starting to work a lot better.

                                -- Michael

                                Comment

                                Working...
                                X