New to Lisp and some questions

Whatever is on your mind, whether Lisp related or not.
citrus
Posts: 2
Joined: Fri Nov 28, 2008 9:41 am

New to Lisp and some questions

Post by citrus » Fri Nov 28, 2008 10:20 am

Had a conversation in the classroom about programming languages and someone brought up Lisp. I had heard the name before but didn't know much if anything about it. After a few google searches I found out that Lisp is supposed to be 1. Simple 2. Fast to develop with 3. Fun? What shocked me the most was that a company (Naughty Dog) had created commercial games using some kind of modified version of Lisp for PS and PS2 :o . So far I have been using C and QuakeC to make Quake mods and engine tweaks, and thought of learning Python to make my own games using Pygame.

Here is where Lisp comes into the picture.. If it's easy to use and fast to develop with and already proven to work in modern, graphical games - then why not Lisp? I view the (un)popularity of Lisp as a double edged sword, on the other hand using it would make one 'stand out from the crowd' - but that sentiment would likely wither fast when I'd run into a roadblock and suddenly have no one or very little support in the form of communities and forums. So would I be 'begging for it' by picking a language that is often not used for the purpose I'd want to use it for (game making if it's not clear by now :P) instead of something mainstream like Python or C#.

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: New to Lisp and some questions

Post by ramarren » Fri Nov 28, 2008 12:55 pm

First, note that Lisp is actually a family of very different languages, most important being Common Lisp, Scheme and Emacs Lisp, and lots of specialized dialects, like the one Naught Dog used. Also, Clojure recently appeared, which is a very interesting Lisp running on Java virtual machine. And what they mostly have in common is essential syntax, so it is mostly impossible to generalize.

Of course, one theory about lack of popularity of Lisps is about the syntax. Lisp syntax is very regular, usually minimizing "syntax sugar" to only literals and quoting, which I think scares away people who less read the code and more "look at the pictures", i.e. take cues from graphical appearance of the syntax. To such people Lisp code usually looks like a blob of parentheses, and so they claim that it is unreadable, and hence useless. On the other hand most Lispers, like me, claim that Lisp is supremely readable, because it doesn't distract with punctuation, leaving only the words. Readability is always subjective, but this seems to even more individually varied than usual.

I use Common Lisp, although "use" may be an exaggeration, since I haven't written any program more serious than PNG decoder really, but I think it's definitely better for writing games than Python, as it is both much faster and more more expressive. There are optimizing compilers for Common Lisp, like SBCL, which are very fast, see for example http://www.lrde.epita.fr/~didier/resear ... .imecs.pdf. And macros and CLOS, which are features very rare among languages.

Of course, there are also problems... the community, which many will claim doesn't even exist, is much smaller and more fractured than of mainstream languages. But it is I think pretty helpful most of the time. Just don't ask how to create executables ;) . One consequence of the smaller community is lesser number of libraries. Most of the primitives for writing games are there (bindings for SDL/OpenGL and so on), but if you want to write a game in CL you must be prepared to sometimes fill some holes yourself.

But I would recommend at least trying to learn Lisp. There is very good "Practical Common Lisp" book available for free.

Paul Donnelly
Posts: 148
Joined: Wed Jul 30, 2008 11:26 pm

Re: New to Lisp and some questions

Post by Paul Donnelly » Fri Nov 28, 2008 2:54 pm

citrus wrote:I view the (un)popularity of Lisp as a double edged sword, on the other hand using it would make one 'stand out from the crowd' - but that sentiment would likely wither fast when I'd run into a roadblock and suddenly have no one or very little support in the form of communities and forums. So would I be 'begging for it' by picking a language that is often not used for the purpose I'd want to use it for (game making if it's not clear by now :P) instead of something mainstream like Python or C#.
You're pretty much bang-on. Writing software in Lisp is great... but sometimes before you can go ahead and do that, you've got to write/repair bindings or libraries that would be ready and waiting for you in other languages. OTOH, with Lispbuilder-SDL (I just started using these bindings a couple days ago, and they seem good) you have all you need to write a game of some description.

Exolon
Posts: 49
Joined: Sat Jun 28, 2008 12:53 pm
Location: Ireland
Contact:

Re: New to Lisp and some questions

Post by Exolon » Sat Nov 29, 2008 6:02 pm

Paul Donnelly wrote:OTOH, with Lispbuilder-SDL (I just started using these bindings a couple days ago, and they seem good) you have all you need to write a game of some description.
I've had a little trouble with it on my Mac (e.g. the audio code crashes in my simplest test programs for some reason, perhaps due to how the Mac version of the SDL library is written). But so far it seems nice for 2D stuff; certainly more complete and easy to get working for a newbie like myself than anything else I've seen.

Leonidas
Posts: 6
Joined: Sun Jun 29, 2008 7:58 am

Re: New to Lisp and some questions

Post by Leonidas » Tue Dec 02, 2008 3:29 pm

Ramarren wrote:I think it's definitely better for writing games than Python, as it is both much faster and more more expressive.
As for speed it doesn't matter really because most time is spent in SDL which is written in C anyway. Same goes for OpenGL.

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: New to Lisp and some questions

Post by ramarren » Wed Dec 03, 2008 1:40 am

Leonidas wrote:As for speed it doesn't matter really because most time is spent in SDL which is written in C anyway. Same goes for OpenGL.
If you are writing a game bound by graphics, then yes, but it not impossible to write a game which requires a lot of processing. Especially since games are usually soft real time, and computation tend to come in bursts, like e.g. pathfinding. Of course, one could write those parts in C as well, but at some point you might just give up and rewrite entire thing in C/C++ anyway.

Really, I'm just impressed how Common Lisp manages to be both highly expressive and very efficiently compiled (well, it's implementation, rather than language, quality), so I have brought it up, even though I admit that for programs primarily composed of calls to external libraries it does not really matter.

citrus
Posts: 2
Joined: Fri Nov 28, 2008 9:41 am

Re: New to Lisp and some questions

Post by citrus » Wed Dec 03, 2008 10:31 am

A small update I thought appropriate.

I decided to give Lisp a go and started by studying the MIT open course material (very interesting stuff). It's a long way ahead until I'll be writing games, probably longer than if I'd gone with some other language, but I hope I'll learn something I otherwise wouldn't and that in the end it'll be worth it.

Ohh, and thanks for the replies.

Balooga
Posts: 14
Joined: Tue Jul 15, 2008 1:20 pm

Re: New to Lisp and some questions

Post by Balooga » Wed Dec 03, 2008 3:05 pm

Exolon wrote:
Paul Donnelly wrote:OTOH, with Lispbuilder-SDL (I just started using these bindings a couple days ago, and they seem good) you have all you need to write a game of some description.
I've had a little trouble with it on my Mac (e.g. the audio code crashes in my simplest test programs for some reason, perhaps due to how the Mac version of the SDL library is written). But so far it seems nice for 2D stuff; certainly more complete and easy to get working for a newbie like myself than anything else I've seen.
The sound from lispbuilder-sdl-mixer is flakey on Windows as well. The only stable platform for sound seems to be Linux. I'm going to blame the SDL_mixer library.

Exolon
Posts: 49
Joined: Sat Jun 28, 2008 12:53 pm
Location: Ireland
Contact:

Re: New to Lisp and some questions

Post by Exolon » Wed Dec 03, 2008 5:20 pm

Balooga wrote:The sound from lispbuilder-sdl-mixer is flakey on Windows as well. The only stable platform for sound seems to be Linux. I'm going to blame the SDL_mixer library.
Heh, yes, I thought this might have a hand in the problem :) I can actually get an mp3 playing; something just dies when I try to shut the mixer subsystem down and subsequent starts don't work without killing and restarting the Lisp image.

Balooga
Posts: 14
Joined: Tue Jul 15, 2008 1:20 pm

Re: New to Lisp and some questions

Post by Balooga » Mon Jan 12, 2009 10:44 am

Exolon wrote:
Balooga wrote:The sound from lispbuilder-sdl-mixer is flakey on Windows as well. The only stable platform for sound seems to be Linux. I'm going to blame the SDL_mixer library.
Heh, yes, I thought this might have a hand in the problem :) I can actually get an mp3 playing; something just dies when I try to shut the mixer subsystem down and subsequent starts don't work without killing and restarting the Lisp image.
I'm busy implementing a mixer for lispbuilder-sdl in Lisp that does not rely on SDL_mixer.

- Luke

Post Reply