Skip to main content
GameDev.net gamedev.net
🔒 Locked

Game programming in Lisp

Started by robinei Apr 28, 2004 at 4:55 PM 15 replies 10.1k views
Original Post
robinei
robinei
I''ve recently acquired a fascination for Lisp, and I''m reading "ANSI Common Lisp" by Paul Graham. Luckily I also get Allegro Common Lisp for free at my university. What I''m wondering is how practical is Lisp for game programming? I''m thinking in particular of the graphical/engine element(nothing more than 2d for now though). Does anyone have experience with it? Is it fast enough? Or is engine programming more in the C++ domain? In that case how is Lisp as an extension language for a C++ engine?
Woodsman
Woodsman
quote:
Original post by robinei
I''ve recently acquired a fascination for Lisp, and I''m reading "ANSI Common Lisp" by Paul Graham.

Great book.


quote:
Original post by robinei
Luckily I also get Allegro Common Lisp for free at my university.

What I''m wondering is how practical is Lisp for game programming? I''m thinking in particular of the graphical/engine element(nothing more than 2d for now though).
Does anyone have experience with it? Is it fast enough?

Why not give it a try? It''s certainly quick enough to get started. I''m not sure about Allegro but check out the Corman CL libraries for SDL/OpenGL.

SDL Bindings
Corman Lisp

You should also search these forums. I have a ton of links, but Lisp is King and What''s So Great About Lisp cross my mind.
Cheers.


If a plant cannot live according to its nature, it dies; so a man.

(princ(substitute #\Space #\0(format()"~36R"5688852237040631986030796883)))
If a plant cannot live according to its nature, it dies; so a man.
flangazor
flangazor
quote:
What I''m wondering is how practical is Lisp for game programming? I''m thinking in particular of the graphical/engine element(nothing more than 2d for now though).

Abuse is a 2d platform game written in Common Lisp.

If you use Debian Linux you can install it with "sudo apt-get install abuse-sdl".
robinei
robinei
I downloaded the abuse source, and it''s engine is C++ code. It apparently just uses Lisp for game logic.
I guess it was perhaps a cutting edge game when it came out, so it probably needed the extra bit of speed. But are there any examples of games written exclusively in Lisp?

SDL for Lisp sounds great, since that''s what I''ve been using in C++.
flangazor
flangazor
quote:
I downloaded the abuse source, and it''s engine is C++ code. It apparently just uses Lisp for game logic.
Why does that matter? If that matters, why doesn''t it seem to matter that SDL is written in C?
Thrump
Thrump
Naughty dog have used lisp in at least some of their titles:

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

Jak, Crash, etc..
Nekhmet
Nekhmet
> In that case how is Lisp as an extension language for a C++ engine?

I think there are a lot of people using C/C++ to do the rendering, and lisp-like languages to do the scripting and logic.

I love common lisp, it''s a fascinating language.

robinei
robinei
Are there any library versions of Lisp which integrates like Lua, into C/C++ programs?
SiCrane
SiCrane
Do you count dialects of Lisp? There''s TinyScheme
robinei
robinei
quote:
Original post by SiCrane
Do you count dialects of Lisp? There''s TinyScheme


Thanks, I''ll check it out. I guess the idea behind all of them are the same? Hvor much beyond function/macro names differ between them?
SiCrane
SiCrane
Hvor?

Scheme is very similar to Lisp, but lacks some of Lisp''s functionality. You can think of it as a subset of Lisp. (Boy am I going to get crucified for saying that.) For example, Scheme lacks packages, arrays, and hash tables.

They also spell somethings differently. (Like setq vs. set!)
robinei
robinei
Ok, thanks.

quote:
Original post by SiCrane
Hvor?


I mean "how"! I actually managed to write the norwegian word...
Extrarius
Extrarius
If you want to see some games implemented in Lisp, you can look at John''s book of Lisp games . It seems they''re all text-based, but it should help somewhat to see how the logic is implemented in lisp (I haven''t looked over them, but I''m betting its different from the style in whatever language you''re used to)
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
civguy
civguy
quote:
Original post by SiCrane
Hvor?

Scheme is very similar to Lisp, but lacks some of Lisp's functionality. You can think of it as a subset of Lisp. (Boy am I going to get crucified for saying that.) For example, Scheme lacks packages, arrays, and hash tables.

They also spell somethings differently. (Like setq vs. set!)
Heh, you could've at least mentioned the shared namespace for functions and non-functions in Scheme, higher dynamicity, Scheme's continuations or some other bigger difference instead of the obvious name differences. Scheme is not simply a subset, because it does some things quite differently. Here's a good list on Common Lisp vs Scheme.

[edited by - civguy on April 30, 2004 3:34:11 AM]
Nekhmet
Nekhmet
I just wanted to point out - there are lots of embeddable intepreters out there, many of them Lisp-like. You should look into several before you choose one - there are a lot of options.

Also, Scheme may lack hash tables, but I think most implementations of scheme "throw in" a hash table implementation along with a bunch of other handy data structures. Admittedly, it''s not portable to other scheme dialects, but that usually doesn''t matter so much if you''re using this as an embedded scripting language in a game. I''ve never tried "libguile", but it looked good last time I read up on it.

Type "scripting languages" (with the quotes) into google.

- Josh
pTymN
pTymN
There is a lot of research at my school NC State University, about using lisp for video games, especially plot scripting.

If there was a good wrapper package that was designed to make C++ libraries accessable to the lisp runtime, then lisp would make a great language. I''m currently looking into the issues of writing one myself...
 
Nekhmet
Nekhmet

> If there was a good wrapper package that was designed to make C++ libraries accessable to the lisp runtime, then lisp would make a great language.

Look up "SWIG" on google.

- Josh

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.