From: Ben Blonder
Subject: Possibility of using lisp to script game; need advice
Date: 
Message-ID: <cdc2589b.0206120810.4ad995c7@posting.google.com>
I'm writing a naval tactics game in C++, and I've come upon the
problem of scripting the project. I need a system that will let me
talk to and manipulate objects in the game, after the game is
compiled. The scripts need to be able to control the behaviors of
ships, weapons, etc while the player is running the game.

Is it possible for lisp to fulfill this need, and if so can you point
me to some tutorials on integrating it with my project?

Thanks in advance.

From: Chris Beggy
Subject: Re: Possibility of using lisp to script game; need advice
Date: 
Message-ID: <87u1o8qvr7.fsf@lackawana.kippona.com>
···@sourcecod.com (Ben Blonder) writes:

> I'm writing a naval tactics game in C++, and I've come upon the
> problem of scripting the project. I need a system that will let me
> talk to and manipulate objects in the game, after the game is
> compiled. The scripts need to be able to control the behaviors of
> ships, weapons, etc while the player is running the game.
>
> Is it possible for lisp to fulfill this need, and if so can you point
> me to some tutorials on integrating it with my project?

Take a look at abuse and golgotha, games developed by
crackdotcom, whose source code is now available.  Both has lisp
scripting facilities.

Chris
From: John M. Adams
Subject: Re: Possibility of using lisp to script game; need advice
Date: 
Message-ID: <xaoadq02zdk.fsf@anarky.stsci.edu>
···@sourcecod.com (Ben Blonder) writes:

> I'm writing a naval tactics game in C++, and I've come upon the
> problem of scripting the project. I need a system that will let me
> talk to and manipulate objects in the game, after the game is
> compiled. The scripts need to be able to control the behaviors of
> ships, weapons, etc while the player is running the game.
> 
> Is it possible for lisp to fulfill this need, and if so can you point
> me to some tutorials on integrating it with my project?

Lisp can fulfull this need.  Librep and guile are two lisp
implementations designed for embedding.  I haven't used them.

If your game engine were in lisp, lisp would be the perfect scripting
solution.  On the other hand, if the majority of your code is going to
live in C++, you might also consider Python for your scripting.

-- 
John Michael Adams
From: Will Hartung
Subject: Re: Possibility of using lisp to script game; need advice
Date: 
Message-ID: <3d07c0f3$1_7@news5.nntpserver.com>
"John M. Adams" <·······@stsci.edu> wrote in message
····················@anarky.stsci.edu...
> ···@sourcecod.com (Ben Blonder) writes:
>
> > I'm writing a naval tactics game in C++, and I've come upon the
> > problem of scripting the project. I need a system that will let me
> > talk to and manipulate objects in the game, after the game is
> > compiled. The scripts need to be able to control the behaviors of
> > ships, weapons, etc while the player is running the game.

*snip*

> If your game engine were in lisp, lisp would be the perfect scripting
> solution.  On the other hand, if the majority of your code is going to
> live in C++, you might also consider Python for your scripting.

Perhaps there's more code in C++ (in the end), perhaps not.

This comes back to Sams suggestion of extending CLISP rather than embedding
it.

As an example, emacs is roughly 1/2 C and 1/2 Lisp in terms of its contents
(rough line count). And since it is generally accepted that Lisp gives more
"Bang for the buck" in terms of program functionality versus lines of code,
it can be argued that most of the code in emacs is Lisp.

Stories of gaming projects are rife with stories of having scripting
languages embedded within their game engines. Most successful "world" games
have a lot of code in their scripting language, with the "slow parts" deeper
within the engine.

So, a legitimate question is not "can I embed Lisp within my game engine for
scripting", it's "can I embed my engine in Lisp for performance and system
access"?

Why should only the scripting be easy to write and reloadable at runtime?
Why not a majority of the rest of the code as well?

Do you want this functionality only for development, or do you want to do be
able to do this after the product is done?

If you use your home grown scripting language, are you going to ship the
source for loading in the finished product, or are you going to compile it
to "something" and use that instead (speed, obfuscation, whatever).

Ya know, most Lisp implementations do that already.

Depending on your graphics overhead on a tactical naval game, I bet most of
your low level graphical stuff could be easily dumped into a C++ DLL, and
the "hard stuff" (tactics, planning, etc) and "easy stuff" (bookeeping,
score incrementing, dice rolling) could all be done in Lisp.

LispWorks for Windows and Corman Lisp are both affordable systems that could
easily take your GUI DLL and leverage it. Even moreso with Corman, because
you can get the source to the entire thing (but you'll need to talk with
Roger WRT licensing, I don't know if there are any issues or not). But at a
basic level, they both have free or very liberal redistribution licenses for
your final code.

And even better, when you decide to port the game to the Mac, or Linux, a
big chunk of your code will port more easily than C++. Just keep a solid (if
thin) abstraction layer between your code and the DLL.

Of course, odds are you already have a bunch of your code already written,
but I'd also bet it's mostly the display stuff anyway. "Let's get the mouse
moving, the buttons clicking, and the guns blazing, then we'll make it
work...".

Good Luck!

Regards,

Will Hartung
(·····@msoft.com)
From: sv0f
Subject: Re: Possibility of using lisp to script game; need advice
Date: 
Message-ID: <none-1206021740310001@129.59.212.53>
In article <···············@anarky.stsci.edu>, ·······@stsci.edu (John M.
Adams) wrote:

>If your game engine were in lisp, lisp would be the perfect scripting
>solution.  On the other hand, if the majority of your code is going to
>live in C++, you might also consider Python for your scripting.

The guy asked about Lisp.  In a Lisp newsgroup.  If you're gonna
suggest alternate scripting languages, perhaps you should tell
us why Python and not Lisp for the application he has in mind.
From: Christopher Browne
Subject: Re: Possibility of using lisp to script game; need advice
Date: 
Message-ID: <ae8k9k$4t098$1@ID-125932.news.dfncis.de>
The world rejoiced as ·······@stsci.edu (John M. Adams) wrote:
> ···@sourcecod.com (Ben Blonder) writes:
>> I'm writing a naval tactics game in C++, and I've come upon the
>> problem of scripting the project. I need a system that will let me
>> talk to and manipulate objects in the game, after the game is
>> compiled. The scripts need to be able to control the behaviors of
>> ships, weapons, etc while the player is running the game.
>> 
>> Is it possible for lisp to fulfill this need, and if so can you point
>> me to some tutorials on integrating it with my project?
>
> Lisp can fulfull this need.  Librep and guile are two lisp
> implementations designed for embedding.  I haven't used them.

SCM and SIOD (Scheme In One Defun) are also intended to be suitable
for this purpose.

You might get more milage out of embedding CLISP in the application,
though that's certainly a more complex option.

> If your game engine were in lisp, lisp would be the perfect
> scripting solution.  On the other hand, if the majority of your code
> is going to live in C++, you might also consider Python for your
> scripting.

.. And if we're to look past Lisp options, you might also consider
Lua, or Perl, or Ruby, or _Icon_, for that matter.
-- 
(concatenate 'string "chris" ·@cbbrowne.com")
http://www.cbbrowne.com/info/sgml.html
Nagging  is the  repetition  of unpalatable  truths. --Baroness  Edith
Summerskill
From: Sam Steingold
Subject: Re: Possibility of using lisp to script game; need advice
Date: 
Message-ID: <sa0adq0h34h.fsf@glip.premonitia.com>
> * In message <····························@posting.google.com>
> * On the subject of "Possibility of using lisp to script game; need advice"
> * Sent on 12 Jun 2002 09:10:21 -0700
> * Honorable ···@sourcecod.com (Ben Blonder) writes:
>
> I'm writing a naval tactics game in C++, and I've come upon the
> problem of scripting the project. I need a system that will let me
> talk to and manipulate objects in the game, after the game is
> compiled. The scripts need to be able to control the behaviors of
> ships, weapons, etc while the player is running the game.
> 
> Is it possible for lisp to fulfill this need, and if so can you point
> me to some tutorials on integrating it with my project?

turning your project into a CLISP module is a way to make CLISP your
scripting engine. see <http://clisp.cons.org/impnotes/modules.html>.


-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Just because you're paranoid doesn't mean they AREN'T after you.
From: Geoff Summerhayes
Subject: Re: Possibility of using lisp to script game; need advice
Date: 
Message-ID: <g_KN8.135633$Ka.9145732@news2.calgary.shaw.ca>
"Ben Blonder" <···@sourcecod.com> wrote in message
·································@posting.google.com...
> I'm writing a naval tactics game in C++, and I've come upon the
> problem of scripting the project. I need a system that will let me
> talk to and manipulate objects in the game, after the game is
> compiled. The scripts need to be able to control the behaviors of
> ships, weapons, etc while the player is running the game.
>
> Is it possible for lisp to fulfill this need, and if so can you point
> me to some tutorials on integrating it with my project?
>
> Thanks in advance.

Crackdotcom's Abuse was a side-scroller written in C with a `toy'
Lisp built in to provide the main game logic, it read lisp files
during it's startup routine. They released the source when the
company went under, you shouldn't have too much trouble finding
a copy on the net.

--
Geoff
From: Ben Blonder
Subject: Re: Possibility of using lisp to script game; need advice
Date: 
Message-ID: <cdc2589b.0206121705.4e746966@posting.google.com>
"Geoff Summerhayes" <·············@hNoOtSmPaAiMl.com> wrote:
> Crackdotcom's Abuse was a side-scroller written in C with a `toy'
> Lisp built in to provide the main game logic, it read lisp files
> during it's startup routine. They released the source when the
> company went under, you shouldn't have too much trouble finding
> a copy on the net.

I grabbed a copy of the source. It looks very promising.

To the people who suggested writing the project in common lisp: the
OpenGL based 3D engine has already been rather completely implemented,
so this probably isn't an option. ;-)
From: Jochen Schmidt
Subject: Re: Possibility of using lisp to script game; need advice
Date: 
Message-ID: <ae8s8o$8vq$1@rznews2.rrze.uni-erlangen.de>
Ben Blonder wrote:

> "Geoff Summerhayes" <·············@hNoOtSmPaAiMl.com> wrote:
>> Crackdotcom's Abuse was a side-scroller written in C with a `toy'
>> Lisp built in to provide the main game logic, it read lisp files
>> during it's startup routine. They released the source when the
>> company went under, you shouldn't have too much trouble finding
>> a copy on the net.
> 
> I grabbed a copy of the source. It looks very promising.
> 
> To the people who suggested writing the project in common lisp: the
> OpenGL based 3D engine has already been rather completely implemented,
> so this probably isn't an option. ;-)

Well - it may still be an option. If you can make it possible to compile 
your 3D engine to a DLL you can easily embed it into a lisp-system. The 
reason this way is often suggested is that it is _much_ easier to include 
your C DLL into a Lisp-system than to include a Lisp-system into your C 
application. Lispsystems tend to have much better facilities to access C 
code than vice versa.

ciao,
Jochen

--
http://www.dataheaven.de
From: Marco Antoniotti
Subject: Re: Possibility of using lisp to script game; need advice
Date: 
Message-ID: <y6c8z5jjar5.fsf@octagon.mrl.nyu.edu>
Jochen Schmidt <···@dataheaven.de> writes:

> Ben Blonder wrote:
> 
> > "Geoff Summerhayes" <·············@hNoOtSmPaAiMl.com> wrote:
> >> Crackdotcom's Abuse was a side-scroller written in C with a `toy'
> >> Lisp built in to provide the main game logic, it read lisp files
> >> during it's startup routine. They released the source when the
> >> company went under, you shouldn't have too much trouble finding
> >> a copy on the net.
> > 
> > I grabbed a copy of the source. It looks very promising.
> > 
> > To the people who suggested writing the project in common lisp: the
> > OpenGL based 3D engine has already been rather completely implemented,
> > so this probably isn't an option. ;-)
> 
> Well - it may still be an option. If you can make it possible to compile 
> your 3D engine to a DLL you can easily embed it into a lisp-system. The 
> reason this way is often suggested is that it is _much_ easier to include 
> your C DLL into a Lisp-system than to include a Lisp-system into your C 
> application. Lispsystems tend to have much better facilities to access C 
> code than vice versa.

Just to give some kudos to the Xanalys folks, I must say that creating
a .DLL for your Lispworks application (along with the proper entry
points) is trivial.

Cheers

-- 
Marco Antoniotti ========================================================
NYU Courant Bioinformatics Group        tel. +1 - 212 - 998 3488
719 Broadway 12th Floor                 fax  +1 - 212 - 995 4122
New York, NY 10003, USA                 http://bioinformatics.cat.nyu.edu
                    "Hello New York! We'll do what we can!"
                           Bill Murray in `Ghostbusters'.
From: Jochen Schmidt
Subject: Re: Possibility of using lisp to script game; need advice
Date: 
Message-ID: <aeb9v6$iot$1@rznews2.rrze.uni-erlangen.de>
Marco Antoniotti wrote:
> Just to give some kudos to the Xanalys folks, I must say that creating
> a .DLL for your Lispworks application (along with the proper entry
> points) is trivial.

I've not tried that since this facility is up to now (LW4.2.6) limited to 
the Windows Edition.
As far as I know Franz' AllegroCL has such a facility (generating DLLs) 
too. If I remember right they even provide support for generating Linux 
shared libraries.
If I heard right then the upcoming release of Corman Lisp will support 
creating DLLs too.

ciao,
Jochen

--
http://www.dataheaven.de
From: John Wiseman
Subject: Re: Possibility of using lisp to script game; need advice
Date: 
Message-ID: <m2y9dhnxr4.fsf@server.local.lemon>
Jochen Schmidt <···@dataheaven.de> writes:

> As far as I know Franz' AllegroCL has such a facility (generating
> DLLs) too. If I remember right they even provide support for
> generating Linux shared libraries.

You might be interested in reading a few comments I wrote up about
creating DLLs with ACL:

  http://lemonodor.com/archives/000064.html

The gist is that it worked alright, though some aspects are a little
messy and there was one annoying bug.


John Wiseman
From: Cory Spencer
Subject: Re: Possibility of using lisp to script game; need advice
Date: 
Message-ID: <ae7u9f$jqb$1@nntp.itservices.ubc.ca>
Ben Blonder <···@sourcecod.com> wrote:

> Is it possible for lisp to fulfill this need, and if so can you point
> me to some tutorials on integrating it with my project?

You can also take a look at librep, which is an embeddable lisp dialect:

  http://librep.sourceforge.net/
From: Zachary Beane
Subject: Re: Possibility of using lisp to script game; need advice
Date: 
Message-ID: <slrnagf18s.eid.xach@xach.gwi>
In article <····························@posting.google.com>, Ben
Blonder wrote:
> I'm writing a naval tactics game in C++, and I've come upon the
> problem of scripting the project. I need a system that will let me
> talk to and manipulate objects in the game, after the game is
> compiled. The scripts need to be able to control the behaviors of
> ships, weapons, etc while the player is running the game.
> 
> Is it possible for lisp to fulfill this need, and if so can you point
> me to some tutorials on integrating it with my project?

It's definitely possible. Crash Bandicoot (a PlayStation game) used
Lisp for character control and AI. Franz has a page about it:

  http://www.franz.com/success/customer_apps/animation_graphics/naughtydog.lhtml

Another poster has mentioned Abuse, which used a Lisp-like homegrown
language. For examples of integration, there are a several non-game
projects that use Lisp or Lisp-like languages for scripting and
extending, including Emacs, GIMP, and Sawfish. They might provide you
with some ideas. I'm afraid I don't know of any tutorials, though,
sorry.

Zach
-- 
Zachary Beane     ····@xach.com