Sign in to follow this  
malune

The use of Lisp in games

Recommended Posts

malune    104
I've recently been interested in using Common Lisp to create a game of some sort, but there are a few things that I am unclear on. I've looked at previous threads on this topic but could not find what I was looking for. I've done some minimal C/C++ games programming in the past but I now seem to prefer programming in Common Lisp. What I essentially want to do is either : a) Create a C++ 3D engine which interfaces with Common Lisp for game logic and everything else, meaning Common Lisp would be the highest layer of abstraction. or, b) Create a Lisp 3D engine which interfaces with C++ for any extra needed libraries. I like the idea of extending Lisp in the same way that Python can be extended, but I have no idea how to do this, does anyone have any pointers as to where I should start? Also another thing is, would the garbage collector in CMUCL cause problems for real time graphics? Would it even be conceivable to create a full 3D engine in Lisp? Thanks.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Naughty Dog (Jax & Daxter) used scheme in some of their games, a quick search on google brought up this:

http://www.spies.com/~palevich/CLRScheme/WhyLispSucksForGames.htm

might give you some insight

-- best, Chris

Share this post


Link to post
Share on other sites
marijnh    182
It's not common lisp, but I've been able to write C++-libraries for mzscheme ( http://www.plt-scheme.org/ ) very easily. I suppose common lisp implementations would make that easy too. Just read some docs and jump into it.

Share this post


Link to post
Share on other sites
Extrarius    1412
Every common lisp compiler will have SOME way of interfacing between the lisp and extrnal c-based apis (or, technically, 'cdecl{as MS calls it} calling convention'-based apis). The problem is that common lisp is so old that the standard doesn't specify such interfaces, so they'll be completely compiler-dependant.

Share this post


Link to post
Share on other sites
Quote:
Original post by Extrarius
Every common lisp compiler will have SOME way of interfacing between the lisp and extrnal c-based apis (or, technically, 'cdecl{as MS calls it} calling convention'-based apis). The problem is that common lisp is so old that the standard doesn't specify such interfaces, so they'll be completely compiler-dependant.


I don't think age is the main problem, Lisp might be older than C, but Common Lisp is not. The problem is probably more related to the fact that this kind of extension interacts more directly with the underlying architecture and that it was too hard to get everyone to agree about it...

I've seen some libraries that attempted to create foreign function interfaces for several Lisps, but none of them covered all the Lisps I was interested in at the time (CMUCL, SBCL, GCL, clisp, Corman Lisp). A lot of this has probably to do with the licenses as well, GCL and clisp are GPL, and Corman is a commercial Lisp.

If you want to do a multi-platform game with Lisp I would probably recommend that you write an I/O-client with as little game code as possible in C++ and use some IPC mechanism to communicate with the Lisp server. I think all major Lisps have support for sockets (although I did have some problems with GCL's), so that's perhaps easiest.

I'm not sure if Lisp is really worth the trouble when it comes to games programming, and that's too bad because it's a cool language. I might make an attempt some day, using Corman in Windows and CMUCL in Unix + SDL or something similar for the client.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this