This topic contains 7 replies, has 0 voices, and was last updated by  DeVice 13 years, 9 months ago.

  • Author
    Posts
  • #2268

    DeVice
    Participant

    Discovered that game a few days ago. Good old scorched earth, needed a revival for sure ! Congratulations on the keeping the gameplay in a 3D version (Worms3D and Lemmings3D learnt me how it could be disapointing).

    Thanks, it could be a good achievement, or perhaps I just lack imagination :).

    I built a CVS version today, on FreeBSD. I met a few things that needed a fix before being able to build / run the game.

    I’d like to know if i should make my “fixes” available back to the developers, and if so, what format they’d like to get (patch -ur would be my suggestion, but you may have different habbits).

    Patch format sounds great. Glad you built from CVS as it is very different from the Version 35 source. Does the server browsing work for you?

    I’d also like to know if this is the right place to discuss some other “bugs” i did not fix yet, and if not, have a pointer to the right place.

    Yeah, I think this is a good place. I would like to make sure the source code for the next version will compile on most systems out of the box as it was.

    #9946

    DeVice
    Participant

    Oh dang, i thought my question got unanswered cos the lil reply counter was = 0, so i did not look back here till now => sorry for the delay.

    Here’s my patch, only thing it does is allowing smooth building on FreeBSD :


    diff -ur scorched-CVS-20031107/configure.ac scorched/configure.ac
    --- scorched-CVS-20031107/configure.ac Sun Dec 7 18:43:23 2003
    +++ scorched/configure.ac Sun Dec 7 18:52:46 2003
    @@ -72,7 +72,11 @@
    AC_MSG_ERROR([*** Can't find the OpenGL library Try: http://www.opengl.org])
    fi

    -OPENGL_LIBS="-lGL -lGLU -lpthread"
    +if test `uname -s` != FreeBSD; then
    + OPENGL_LIBS="-lGL -lGLU -lpthread"
    +else
    + OPENGL_LIBS="-lGL -lGLU"
    +fi
    LIBS="$LIBS $OPENGL_LIBS"

    dnl Check for wxwindows
    diff -ur scorched-CVS-20031107/src/3dsparse/aseFile.tab.cpp scorched/src/3dsparse/aseFile.tab.cpp
    --- scorched-CVS-20031107/src/3dsparse/aseFile.tab.cpp Sun Dec 7 18:42:32 2003
    +++ scorched/src/3dsparse/aseFile.tab.cpp Sun Dec 7 18:52:46 2003
    @@ -5,7 +5,9 @@

    #define YYBISON 1 /* Identify Bison output. */

    +#if !defined(__FreeBSD__)
    #define alloca
    +#endif //!defined(__FreeBSD__)

    #define yyparse aseparse
    #define yylex aselex
    diff -ur scorched-CVS-20031107/src/client/ServerBrowserRefresh.h scorched/src/client/ServerBrowserRefresh.h
    --- scorched-CVS-20031107/src/client/ServerBrowserRefresh.h Sun Dec 7 18:42:33 2003
    +++ scorched/src/client/ServerBrowserRefresh.h Sun Dec 7 18:52:46 2003
    @@ -24,6 +24,9 @@
    #include
    #include
    #include
    +#if defined(__FreeBSD__)
    +#include

    Side notes :
    – The building process as described for linux in COMPILING works ok, just had to tell the autogen command where my wx-config is this way : ./autogen.sh –with-wx-config=/usr/X11R6/bin/wxgtk2-2.4-config
    – You may also want to replace any occurence of #include with #include , will avoid warning and future problems (i think malloc.h is flagged as deprecated anywhere now ? It may no longer exist soon on some systems.)
    – I was overzealous with the #ifdef and other tests to get sure my changes only apllies on FreeBSD. But some other systems may want to use some too (have no access to a linux box to test that currently).
    – Your sourcetree can be build with the -jX arg for make, could be worth telling it in the COMPILING file as it can speed up the build time a lot by building multiple files together. For instance on my Bi-Athlon 1.2Ghz, make -j8 take 4m11s to build, while the regular make without args took 7m50s (a typical monoprocessor machine user would run make -j4).
    – You may want to document that non-english langage settings could forbid to run the game. For instance, my LANG is set to fr_FR, which means sscanf() will not await dots but commas as decimal separator, leading to big trouble when reading all those floats from .txt model files 🙂 The easiest solution is to run the game using that command : LANG=”” scorched3d from a terminal window.

    #9947

    DeVice
    Participant

    Oh, and yes server browsing works ok.

    I have a couple of other issues to ask about, but need to do a bit more of homework before blindly reporting, will see a bit later.

    And, you may not know, but there’s an “official” port of the game in the FreeBSD ported applications (though it stil use version 35) tree. See the freebsd ported applications list. It means people can just install the game doing, as root user, cd /usr/ports/games/scorched3d-devel; make install clean (and optionally making world writable /usr/local/games/scorched3d/data/display.xml).

    #9948

    DeVice
    Participant

    Am installing Scorched3D on another FreeBSD box to make a 24/7 server available.

    In the meantime, writing up a kind of step by step guide to compile/install it to complete what i previously mentioned.

    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    INSTALLING SCORCHED3D 36.1 on FreeBSD 4.9 (Stable) from the source file
    Note : ports tree updated as of yesterday (05/Jan/2004 – new year wishes to everybody, by the way !)

    As root do :
    – install and then remove the scorched3d old version port (i hope the port maintener will update the port to 36.1 soon…) to have all the required dependencies set up (wxwindows, XFree, SDL …) :
    cd /usr/ports/games/scorched3d-devel && make install deinstall clean

    – add a link to help the build process later :
    ln -s /usr/local/include/SDL11 /usr/local/include/SDL

    Then you can drop root privileges and do :
    – get the src file :
    fetch http://heanet.dl.sourceforge.net/sourceforge/scorched3d/Scorched3D-36.1-src.tar.gz

    – extract the source tree :
    tar xvzf Scorched3D-36.1-src.tar.gz

    – get into the directory :
    cd scorched

    – Do the usual Linux build process with a few changes :
    chmod u+x autogen.sh
    CFLAGS=”$CFLAGS -I/usr/X11R6/include” LIBS=”$LIBS -L/usr/X11R6/lib” SDL_CONFIG=/usr/local/bin/sdl11-config ./autogen.sh –with-wx-config=/usr/X11R6/bin/wxgtk2-2.4-config –prefix=/usr/local

    (last param can be changed to wherever you want the game installed)
    make -j4
    (-j8 instead for peeps going dual-headed like i love to)
    make install
    (last step may need to be done as root again depending on where you told the game to be installed)

    And voila ! You should be ready to do some serious tank-crushing…

    OK i’ve verified my procedure to be working.

    #9949

    DeVice
    Participant

    I am sorry to use this place as a notepad, but i am in the process of updating the FreeBSD port for scorched3d and the following command line (which i will never remind without writing it down) is very helpfull in the process.

    So, reminder :


    for file in `find ./ -type f` ; do if (grep '#include ' $file || grep '#include /#include /' -e 's/#include ../../files/patch-`echo -n $file | sed 's/.///' | sed 's///-/g'`; fi; done

    In the meantime, whoever can describe me accurately what that line does will get my deep respect 😉

    #9950

    GoochRules
    Participant

    first… let’s pretty it up:


    1: for file in `find ./ -type f` ; do
    2: if (grep '#include ' $file || grep '#include 3: sed -e 's/#include /#include /' -e 's/#include 4: echo $file;
    5: diff -u $file.orig $file > ../../files/patch-`echo -n $file | sed 's/.///' | sed 's///-/g'`;
    6: fi;
    7: done

    synopsis: for each file found in the local directory and all subdirs that contains some specific strings, we’re going to run a search-and-replace or two, print the file out (to stdout), and then we’re writing out a diff of the original file with some more replacements… more specifically:


    1: for file in `find ./ -type f` ; do

    this one is simple, and it does (mostly) how it reads: for each ‘regular file’ (type f) in the current directory and all subdirs (find ./), we’re gona do some stuff (lines 2-6).


    2: if (grep '#include ' $file || grep '#include

    here we’re looking for either the string “#include ” or “#include


    3: sed -e 's/#include /#include /' -e 's/#include

    sed is a regular expression processor. it takes a list of options, followed by an input file, and an output file. I think. It looks like in this case $file (which is the iterator of the for loop) is used for input, and .orig is appended to that filename as the output file. I could have this backwards. the two expressions for sed here take the form: “s/find/replace”, or to replace all instances of #include with #include , and #include


    4: echo $file;

    this prints out the file to stdout. It is not immediately apparent why this is done (other than to clutter up the terminal… there must be some context that I am missing).


    5: diff -u $file.orig $file > ../../files/patch-`echo -n $file | sed 's/.///' | sed 's///-/g'`;

    let’s take this in two steps: A) being “`echo” and beyond, B) being everything before.
    A) looking ahead to step B) we see that we’re creating a filename… we do this by echo-ing the results from two sed expressions. everything between the first and second ‘`’ is run as a sub-expression, and the output is treated as a literal string (hence the echo). sed ‘s/.///’ replaces all occurrences of ./ with nothing (i.e, it removes ./ from $file). sed ‘s///-/g’ replaces all occurrences of / with -. the trailing ‘g’ means it does it ‘globally’.. i’m not sure what difference it makes here. so… it looks like part A spits out a string that originally was ./dir1/dir2/…dirn/file, but now is dir1-dir2-…dirn-file.
    b) diff compares two files, in this case $file.orig and $file. it then writes (using the “unified output format, specified by “-u) to stdout. stdout is piped to “../../files/patch-$stepA” using “>”, where $stepA is the “dir1-dir2-…dirn-file” stuff from A).


    6: fi;

    this ends the if statement. if we did not enter the statement, we jumped to here.


    7: done

    this ends the for loop… if the loop has not yet processed all the files found from “find ./ -type f”, then we go again from line 2 with the next $file.

    So, to conclude, this shell script creates diff files from all files in the current directory and all subdirectories. These diff files show where “#include ” was replaced with “#include ” and where “#include

    …btw, i did not know how sed, find, or diff worked before writing this post. All information provided i looked up using ‘man [sed|find|diff]’, and trying stuff out. It took me all of 30 minutes.

    #9951

    Chomsky
    Participant

    @device wrote:

    I am sorry to use this place as a notepad, but i am in the process of updating the FreeBSD port for scorched3d and the following command line (which i will never remind without writing it down) is very helpfull in the process.

    So, reminder :


    for file in `find ./ -type f` ; do if (grep '#include ' $file || grep '#include /#include /' -e 's/#include ../../files/patch-`echo -n $file | sed 's/.///' | sed 's///-/g'`; fi; done

    In the meantime, whoever can describe me accurately what that line does will get my deep respect 😉

    I can’t pass up a challenge….


    for each regular file $file found in the directory tree starting at the current working directory,

    if the file includes the text '#include '
    if the file also includes the text '#include
    then change all occurences of '#include
    ' to '#include '
    and change all occurences of '#include and backup the unchanged version of this file as $file.orig
    and dump the changed version of the file to standard output
    and create a unified diff which describes the changes we have made
    and name the diff as follows:
    ../../files/patch-(take the relative path to the file we changed, remove newline chars, delete the first single character (probably the first /), and change all other occurences of / to - )

    If you don’t mind my saying, I think that if you intend to have these changes merged into CVS, you should use #if defined (__FREEBSD__) to surround code which would cause compilation problems on other platforms. This stuff has to compile on a lot of different machines…

    The more, the merrier!

    cheers!

    C. Thomas
    Chomsky[OSX]

    #9952

    Chomsky
    Participant

    Saw that || as a | …..

    files that have ‘#include ‘ OR files that have ‘#include

    I think I need a new prescription on these glasses…

    c. thomas

    #9953

    DeVice
    Participant

    Not bad ! only a minor error 🙂 You got my respect anyway 😉

    @chomsky wrote:


    ...
    and dump the changed version of the file to standard output
    ...

    It just actually print out (echo $file) the name of the file that was changed.

    @chomsky wrote:

    If you don’t mind my saying, I think that if you intend to have these changes merged into CVS, you should use #if defined (__FREEBSD__) to surround code which would cause compilation problems on other platforms. This stuff has to compile on a lot of different machines…

    Yup, i will, but for now those patches will only be used by the FreeBSD port system against the 0.36.2 tarball, so it was not yet needed. Thanks anyway.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.