Page 1 of 2

New to Lisp and some questions

Posted: Fri Nov 28, 2008 10:20 am
by citrus
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#.

Re: New to Lisp and some questions

Posted: Fri Nov 28, 2008 12:55 pm
by ramarren
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.

Re: New to Lisp and some questions

Posted: Fri Nov 28, 2008 2:54 pm
by Paul Donnelly
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.

Re: New to Lisp and some questions

Posted: Sat Nov 29, 2008 6:02 pm
by Exolon
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.

Re: New to Lisp and some questions

Posted: Tue Dec 02, 2008 3:29 pm
by Leonidas
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.

Re: New to Lisp and some questions

Posted: Wed Dec 03, 2008 1:40 am
by ramarren
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.

Re: New to Lisp and some questions

Posted: Wed Dec 03, 2008 10:31 am
by citrus
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.

Re: New to Lisp and some questions

Posted: Wed Dec 03, 2008 3:05 pm
by Balooga
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.

Re: New to Lisp and some questions

Posted: Wed Dec 03, 2008 5:20 pm
by Exolon
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.

Re: New to Lisp and some questions

Posted: Mon Jan 12, 2009 10:44 am
by Balooga
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