chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Question about embedding Chicken scheme


From: Kristian Lein-Mathisen
Subject: Re: [Chicken-users] Question about embedding Chicken scheme
Date: Thu, 24 Jan 2013 01:09:20 +0100



Hey Julian,

I like your idea of putting Scheme in games! I did this on my last pet-project, Cocoscheme. I'm doing what you're suggesting: I wrote bindings to C/C++ functions that manipulate the game-state. Except I used existing C/C++ libraries to do the hard work for me :) More precisely, in the case of Cocos2Dx, I manipulate the visible "scene graph", and with Chickmunk, I manipulate the virtual physical world. Both of those libraries are relatively easy to manipulate with Scheme bindings.

The Chickmunk bindings are the most mature, and might be worth looking into. They follow the Chipmunk C API very closely (I should rename it ... the names are confusing, I know!).

Are you planning on using any established game-engines or libraries? What will probably become very interesting is where your C++-code ends and where your Scheme begins.

So I have a crazy idea, how about writing all of it in Scheme? So instead of exposing a function to add a message to the UI, you can expose functions to draw the UI,  and do your game in Scheme. Then as you move along and things settle, you can port the slow/critical parts to faster C-code if you need to. Just a thought. There are several eggs for graphics available that might suit your drawing needs, like cairo or opengl.

Do keep us updated on your progress, we'd love to hear how this turns out! I'll sign up for alpha testing :)

Cheers,
K.


On Sun, Jan 20, 2013 at 4:40 PM, Julian Day <address@hidden> wrote:
On 20/01/2013 3:38 AM, Christian Kellermann wrote:
This is an excellent question! Yes, you can use chicken as an
embedded scripting language for your game. The manual has a section
dedicated to that topic (embedding not games unfortunately):
http://api.call-cc.org/doc/foreign/embedding
Thanks - I've looked at that, and was glad to see that embedding was well-supported.  It also looks like Visual Studio isn't a problem? I've looked at some other Schemes for embedding, and I've seen Windows (cygwin) at least once, which isn't an option.  I'm using Visual Studio in Windows and g++ in FreeBSD for my development, so I want to ensure that both are supported without too much trouble.

See for an introduction into embedding. From a gut feeling I'd say
that providing callable accessors for your scheme script to modify
your game state is easier than passing around a lot of state all
the time since all this state would have to be transformed into a
scheme object and back to C/C++...

I was thinking so too, basically providing an API layer to Scheme to allow some common game- and state-related tasks (adding messages to the UI, loading items/NPCs on the map, and so on).  If it's easy enough to expose C/C++ functions that can modify the game state, that's perfect.


So far people that use embedding have not spoken out loudly on this
list, but I am sure there are people using this feature. That would
be your clue guys! What are your experiences?

You will most probably have lots of questions, feel free to come
back and ask again. We value your feedback (and maybe that will
lead to better documentation in the first place).


Will do.  I've still got some tasks on my to-do list before I look at getting Scheme support added, but it's coming up soon.  My plan is to document my experiences as I go.  Hopefully this will provide some help for anyone else thinking of using Scheme as an embedded game language.

Thanks,
Julian


_______________________________________________
Chicken-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/chicken-users


reply via email to

[Prev in Thread] Current Thread [Next in Thread]