aka how to get a lisp console to your (running) game?
There aren't many choices if you want a Common Lisp interpreter embedded in your application. In fact, I only found ECL, thats made and suitable for this. Its only downloadable in source code form, but its very easy to compile - even under Windows.
Ok, we found a suitable Lisp, time to think about the script development. Wouldn't be nice if we had an environment to develop, load and test the game scripts, alter parameters, etc while running the game? Well, there is THE free Lisp development environment: Emacs + Slime. And you can use it to connect to remote lisps to work with them! Thats my solution.

Building ECL
You have to edit a Makefile to enable some features, and fire away nmake at the Visual Studio command prompt in msvc directory. Not in the docs, but you'll need the yasm assembler installed somewhere on path too. After this, an nmake install creates a package directory with ECL executables, libs and other system components.Slime/swank
If your a lisper, you know what to do to get, install and use Slime. For the game console we need only the lisp engine side parts of it, named swank. The other part is run by Emacs, when you M-x slime-connect.Swank is the *.lisp and the ChangeLog files from the Slime package in the root and contrib directories. The listing to the rigth shows them.
Running swank
First, we have to load and run swank in our ECL instance. This is accomplished in a fairly standard way. The only problem is, that ECL (under Windows) only supports the NIL communication style, and this doesn't work very good with Emacs Slime interactive mode.For a seamless cooperation you need to run swank in a separate thread (process in ECL/Lisp terms) from top level. The solution is in this ecl user mail list post.
Here comes the procedure to run swank in ECL:
1. Make sure, we have our swank on ASDF load path:
>ecl
ECL (Embeddable Common-Lisp) 12.12.1 (git:UNKNOWN)
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help. Top level in: #.
> (require "asdf")
;;; Loading #P"c:/zzzz/asdf.fas"
("ASDF")
> (push #p"zzz/swank/" asdf:*central-registry*)2. Load swank:
(#P"zzz/swank/")
> (push #p"zzz/swank/contrib/" asdf:*central-registry*)
(#P"zzz/swank/contrib/" #P"zzz/scripts/swank/")
> (require "swank")3. Start swank server in separate thread, on port 55555:
;;; Loading "zzz/swank/swank.asd"
;;; Loading "zzz/swank/swank-loader.lisp"
...
;;; Warning: These Swank interfaces are unimplemented:
(ACTIVATE-STEPPING ADD-FD-HANDLER ADD-SIGIO-HANDLER BACKGROUND-SAVE-IMAGE DUP EXEC-IMAGE FRAME-CALL LIST-CALLEES LIST-CALLERS MACROEXPAND-ALL MAKE-FD-STREAM REMOVE-FD-HANDLERS REMOVE-SIGIO-HANDLERS RESTART-FRAME RETURN-FROM-FRAME SAVE-IMAGE SLDB-BREAK-AT-START SLDB-BREAK-ON-RETURN SLDB-STEP-INTO SLDB-STEP-NEXT SLDB-STEP-OUT TOGGLE-TRACE) ("SB-BSD-SOCKETS" "SOCKETS")
> (mp:process-run-function "swank"Swank is running, our Lisp is waiting for connections and hack. Jump over to Emacs, and try to meet!
#'(lambda ()
(swank:create-server :dont-close t :port 55555)))
#
> ;; Swank started at port: 55555.
No comments:
Post a Comment