Ok, I've updated the howto.  I had to change it to use the mandelbrot
example instead of squashed, which is a bummer because squashed more
resembles a game.  Squashed and other examples that use *bmp-path*
wont work because the path is determined at compile time and is
absolute, not relative.  The modifications needed to fix it are very
minor but I feel it is a somewhat distracting detail to add.  The
howto accomplishes the original goal anyway.

I sent my friend the mandelbrot files and it runs fine on his machine.
 So I think this is ready to be published.

Anthony

----------------------------------------------
This is a how-to for building a distributable game(standalone
executable) using CLISP and lispbuilder-SDL on Windows.

1.  Install CLISP.  Version 2.41 (non-cygwin with readline and
gettext) was used for this howto.  It can be downloaded here:
http://clisp.cons.org/

2.  Install lispbuilder-SDL as described in the documentation
(http://lispbuilder.sourceforge.net/).  Follow all instructions with
the following exception: Use CFFI version 061116. Version 060225 does
not work.  CFFI can be downloaded here:
http://common-lisp.net/project/cffi/tarballs/?M=D

3.  Make sure everything works.  Try to run an example.  From the
CLISP prompt run:

[1]> (asdf:operate 'asdf:load-op :lispbuilder-sdl-examples)
... lots of loading text ...
0 errors, 0 warnings
NIL
[2]> (sdl-examples:mandelbrot)
NIL

See the game run.  If the game does not run properly, troubleshoot,
then continue to step 4.

4.  Create a directory to put all of the distributable files in.  For
example:

[3]> (ext:make-dir  "C:\\appz\\")
T
[4]> (ext:make-dir  "C:\\appz\\mandelbrot\\")
T

5.  Create a main entry point for your game.  We will simply used the
 mandlebrot example that we ran in step 3.  Create the MANDELBROT-MAIN
 function:

[5]> (defun mandelbrot-main ()
       "mandelbrot: main entry function"

       (cffi:define-foreign-library sdl
          (t (:default "SDL")))

       (cffi:use-foreign-library sdl)

       (sdl:with-init ()
         (sdl-examples:mandelbrot))
         (ext:quit))
MANDELBROT-MAIN

6.  Next, create the standalone executable.

*** One important thing to note here is you must call SAVEINITMEM from
the CLISP prompt and not SLIME.  If you do it from SLIME you will get
a socket error in your executable. ***

[6]> (ext:saveinitmem "c:\\appz\\mandelbrot\\mandelbrot.exe"
                 :init-function #'mandelbrot-main
                 :NORC t
                 :script t
                 :executable t
                 :quiet t)
2912060 ;
728015

7.  Copy other support files to the distribution directory:

[7]> (ext:copy-file "C:\\clisp-2.41\\full\\*.dll" "C:\\appz\\mandelbrot\\")

((#P"C:\\clisp-2.41\\full\\libiconv-2.dll"
  #P"C:\\appz\\mandelbrot\\libiconv-2.dll" 1410765)
 (#P"C:\\clisp-2.41\\full\\libintl-8.dll"
  #P"C:\\appz\\mandelbrot\\libintl-8.dll" 1888606)
 (#P"C:\\clisp-2.41\\full\\readline5.dll"
  #P"C:\\appz\\mandelbrot\\readline5.dll" 229888))

Copy over the SDL.dll.

[8]> (ext:copy-file "C:\\windows\\system32\\SDL.dll" "C:\\appz\\mandelbrot\\")

((#P"C:\\WINDOWS\\system32\\SDL.dll" #P"C:\\appz\\mandelbrot\\SDL.dll" 258048))

8.  Try running C:\appz\mandelbrot\mandelbrot.exe.  If it runs then
you can now distribute the files located in C:\appz\mandelbrot\.  Note
that the CLISP console is present when running the game.  To hide the
console screen take a look at this link:
http://www.frank-buss.de/lisp/clisp.html

9.  Now go make some games!
_______________________________________________
application-builder mailing list
[email protected]
http://www.lispniks.com/mailman/listinfo/application-builder

Reply via email to