Common Lisp wrapper

What it says on the tin: a place to discuss proposed new features.
Post Reply
MessiahAndrw
Gnoblar
Posts: 24
Joined: Thu Jun 28, 2007 2:29 pm

Common Lisp wrapper

Post by MessiahAndrw » Mon Jul 07, 2008 1:14 pm

I've noticed there are Ogre wrappers for .Net, Python, and Java, but is there one for Common Lisp?
0 x

User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
Contact:

Post by Klaim » Mon Jul 07, 2008 1:18 pm

I don't think there is, but i guess all participations are welcome :)
0 x

User avatar
aerique
Halfling
Posts: 59
Joined: Thu Oct 18, 2007 2:37 pm
Location: The Netherlands
Contact:

Re: Common Lisp wrapper

Post by aerique » Fri Jun 19, 2009 4:02 pm

I'm sure the OP has move on to greener pastures but I might as well use this thread to announce my Common Lisp (CL) wrapper for Ogre.

Having seen some discussions on these boards about functional programming and also Lisp let me say that if you are inexperienced with CL you should not use these wrappers to learn Lisp! You will walk away disillusioned. Just head to http://www.gigamonkeys.com/book/ and learn CL with that.

These wrappers provide a very thin layer of CL over the Ogre API so you will mostly be coding C++ in CL.


I've put up a first release of it at: Okra. It has two companion projects: Buclet and clois-lane being wrappers for Bullet and OIS respectively.

All are works in progress. For example, Buclet is a complete wrapper for Bullet's C API (which is pretty limited in itself) and clois-lane only supports mouse and keyboard at the moment.

Being a first release, what's the catch?
  • They are far from complete. While autogenerating wrappers saves a lot of time from doing it by hand almost each *.h file I add to the project requires some work to get working correctly.
  • No test-suite yet. The Ogre API is huge and it is simply not viable to test each and every autogenerated function. Consider everything that's not used in the examples to be untested.
  • No support for overloaded functions yet. I've made arbitrary choices of which functions are included in the bindings.
  • etc. etc.
Better late than never I guess :)
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: Common Lisp wrapper

Post by jacmoe » Fri Jun 19, 2009 5:11 pm

Practical Common Lisp is a great book. :wink:

I am very happy to see your project, Aerique. :)
You've PMed me about it, but I must have forgotten to reply :oops:

I'm a Lisp newbie, but I love the language - even the parentheses. :D
Given a good editor, they don't get in the way, and in contrast to C++, Lisp doesn't have curly brackets.
And the parentheses emphasize that code is data and data is code. And makes it really easy to parse.

The more I learn about Lisp, the more amazed I am about how modern it is.

And what's better than to learn a new language with your favourite Ogre?

Do you plan to make the binding more lispy?
Or are you keeping it low level?

Is this ECL, or .. ?
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
aerique
Halfling
Posts: 59
Joined: Thu Oct 18, 2007 2:37 pm
Location: The Netherlands
Contact:

Re: Common Lisp wrapper

Post by aerique » Fri Jun 19, 2009 8:58 pm

jacmoe wrote:Given a good editor
Emacs all the way for me. Like Lisp it is easy to extend but generally any feature that's available for another editor has been added to Emacs by someone and if not you can code it yourself.

Also, the first thing anyone should do is change Emacs' keybindings to what you're used to. That is Emacs. Don't let it get in the way but mold it into what you want it to be.
jacmoe wrote:And what's better than to learn a new language with your favourite Ogre?
You're free to do what you want but don't say I didn't warn you. :)
jacmoe wrote:Do you plan to make the binding more lispy?
Or are you keeping it low level?
The low-level interface (direct C++'ish access to the Ogre API) will and should always be available. Those are basically the autogenerated wrappers of Ogre's classes and member definitions.

A more lispy interface should slowly grow on top of it.
jacmoe wrote:Is this ECL, or .. ?
It uses CFFI and should run on any CL implementation that CFFI runs on. I've only tested and developed it on Linux using SBCL and Windows using CCL.
0 x

User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 1
Contact:

Re: Common Lisp wrapper

Post by Kencho » Fri Jun 19, 2009 9:07 pm

jacmoe wrote:I'm a Lisp newbie, but I love the language - even the parentheses. :D
That's a good start, jacmoe. I never got to that point :lol:

I'm not sure about the feasibility of this. My feel is that Ogre isn't suited for (C)Lisp. It's like writing a wrapper for Prolog: Even if you can do it, is it worth the effort? Will you take a good advantage of it? What I want to say is that I mostly see possible to write the logic of an application in Lisp, but writing the engine itself in C++ (which in turn calls Ogre) and let Lisp make the calls to the engine, rather than accessing the low-level pieces through wrappers right from Lisp.
0 x
Image

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: Common Lisp wrapper

Post by jacmoe » Fri Jun 19, 2009 9:24 pm

The advantages is that Lisp is faster than Python.
Given a good compiler, it's almost as fast as C.
Or so I've heard.
It is not exactly a new language, so they had time to make it efficient. :wink:
Of course, it depends on which CL implementation you choose.
AFAIK, CLISP is not as fast as SBCL, because CLISP tries to be easier to port across platforms.
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 1
Contact:

Re: Common Lisp wrapper

Post by Kencho » Fri Jun 19, 2009 10:07 pm

Well, I'm not as much into performance but ease to use. Regardless of how fast it is, I can't think of quick and easy to understand code written in Lisp for a large 3D application :( It's like trying to code Crysis in assembler just because it's theoretically the most efficient solution.
0 x
Image

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: Common Lisp wrapper

Post by jacmoe » Fri Jun 19, 2009 10:11 pm

You forget about CLOS (Common Lisp Object System (IIRC)) - you don't have to not use OO with Lisp.
Usually, Lisp code is much more compact than the equivalent C++ code.
A lot of people claim that Lisp is suited for large, complex programs. The more complex, the better suited.
I believe them. :wink:
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
aerique
Halfling
Posts: 59
Joined: Thu Oct 18, 2007 2:37 pm
Location: The Netherlands
Contact:

Re: Common Lisp wrapper

Post by aerique » Fri Jun 19, 2009 10:13 pm

Kencho wrote:What I want to say is that I mostly see possible to write the logic of an application in Lisp, but writing the engine itself in C++ (which in turn calls Ogre) and let Lisp make the calls to the engine, rather than accessing the low-level pieces through wrappers right from Lisp.
I'm not quite sure I understand you here? Isn't the engine (Ogre) already written in C++? (I would give my left nut for an Ogre port to CL)
Kencho wrote:Regardless of how fast it is, I can't think of quick and easy to understand code written in Lisp for a large 3D application :( It's like trying to code Crysis in assembler just because it's theoretically the most efficient solution.
Funny, I have that same feeling about large project written in C, C++, Java, etc. ;-)
0 x

User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 1
Contact:

Re: Common Lisp wrapper

Post by Kencho » Fri Jun 19, 2009 10:26 pm

aerique wrote:
Kencho wrote:What I want to say is that I mostly see possible to write the logic of an application in Lisp, but writing the engine itself in C++ (which in turn calls Ogre) and let Lisp make the calls to the engine, rather than accessing the low-level pieces through wrappers right from Lisp.
I'm not quite sure I understand you here? Isn't the engine (Ogre) already written in C++? (I would give my left nut for an Ogre port to CL)
Nope, Ogre is just the rendering engine. I was talking about the application engine (the code that ties the rendering, input, etc. subsystems). It's common to detach the application logic from the engine. I see implementing the logic part in Lisp, but not really the engine itself :)
jacmoe wrote:You forget about CLOS (Common Lisp Object System (IIRC)) - you don't have to not use OO with Lisp.
Usually, Lisp code is much more compact than the equivalent C++ code.
A lot of people claim that Lisp is suited for large, complex programs. The more complex, the better suited.
I believe them. :wink:
Didn't know about it. To be honest, my first contact with Lisp made me avoid any possible contact with it in the future, so I don't know most of the technologies related to it. CLOS sounds like a good deal though. I'm not speaking more about this as CLOS probably tears down all my points :lol:
0 x
Image

User avatar
aerique
Halfling
Posts: 59
Joined: Thu Oct 18, 2007 2:37 pm
Location: The Netherlands
Contact:

Re: Common Lisp wrapper

Post by aerique » Fri Jun 19, 2009 10:31 pm

Kencho wrote:Nope, Ogre is just the rendering engine. I was talking about the application engine (the code that ties the rendering, input, etc. subsystems). It's common to detach the application logic from the engine. I see implementing the logic part in Lisp, but not really the engine itself :)
Ah, gotcha. I'd really like to do all that in my favourite language. Like others do it in Python, Java, C++, Brainfuck, etc.
Kencho wrote:Didn't know about it. To be honest, my first contact with Lisp made me avoid any possible contact with it in the future,
Let me guess: university course intro to programming?

Anyway, to be clear since Lisp is actually a whole family of languages: these bindings are for Common Lisp
0 x

User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 1
Contact:

Re: Common Lisp wrapper

Post by Kencho » Sat Jun 20, 2009 2:53 am

aerique wrote:Let me guess: university course intro to programming?

Anyway, to be clear since Lisp is actually a whole family of languages: these bindings are for Common Lisp
Almost: Intro to AI :) However, I learned CLisp there indeed ;)
0 x
Image

User avatar
aerique
Halfling
Posts: 59
Joined: Thu Oct 18, 2007 2:37 pm
Location: The Netherlands
Contact:

Re: Common Lisp wrapper

Post by aerique » Sat Jun 20, 2009 2:59 pm

Kencho wrote:
aerique wrote:Let me guess: university course intro to programming?

Anyway, to be clear since Lisp is actually a whole family of languages: these bindings are for Common Lisp
Almost: Intro to AI :)
Yeah, uni courses are notorious for putting people off Lisp. Usually because students aren't allowed to use the full power of the language but must solve certain problems within parameters defined by the teacher. Like being able to only use recursion for a problem that would be easy to solve with plain iteration.

But then, maybe you just don't like CL at all :)
0 x

User avatar
aerique
Halfling
Posts: 59
Joined: Thu Oct 18, 2007 2:37 pm
Location: The Netherlands
Contact:

Re: Common Lisp wrapper

Post by aerique » Wed Sep 02, 2009 9:54 am

I don't really want to make a seperate thread for a public announcement yet since the code isn't quite ready for public consumption so I'll just add what I want to say here.

I've added a demo as Windows executable to the project page of Okra (my Common Lisp wrapper for Ogre): http://www.common-lisp.org/project/okra/ (see Downloads section: flock.zip. flock-sbcl.exe runs the fastest).

It's pretty slow due to several reasons not in the least due to the inner loop not being very optimised and I've mainly made it to collect comments and experiences so I can figure out what the best way is to distribute programs made using Okra.

If you try it out and whether it works or not, please mail me your results.
0 x

User avatar
aerique
Halfling
Posts: 59
Joined: Thu Oct 18, 2007 2:37 pm
Location: The Netherlands
Contact:

Re: Common Lisp wrapper

Post by aerique » Fri Sep 04, 2009 8:28 pm

I've put up a little demo at YouTube.
0 x

Post Reply