guile-user
[Top][All Lists]
Advanced

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

Re: bgb, introduction...


From: Alex Shinn
Subject: Re: bgb, introduction...
Date: 28 Feb 2002 12:27:59 +0900
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1

[sorry for 2nd mail, forgot to include guile-user]

>>>>> "cr88192" == cr88192 sydney <address@hidden> writes:

    cr88192> I am one who goes between projects, as of right now I am
    cr88192> working on a game engine and trying to use guile for it
    cr88192> (considering rep and python as possible alternatives,
    cr88192> though I don't really know python...).

Ah, I was working on the same thing :) Started writing a generalized
game engine in Python, got the basics done, then decided what I really
wanted was Guile.  I wrote some Guile SDL bindings but haven't had time
to play more with this recently.  There are also some OpenGL bindings,
but I think these are both projects without real user-bases as of yet.
The Guile-Gtk bindings are more stable, but not as well suited to
gaming.

    cr88192> my problem: lack of documentation (at least that I can
    cr88192> find).

Documentation in CVS Guile (1.5.x) is much more thorough, you may want
to look into that.

    cr88192> how to invoke functions in guile from C? dealing with vars.
    cr88192> stopping program from exiting on undefined vars...

Do you want to extend a C Engine with Guile, or optimize a Guile Engine
with C?  If the former, you have to choose what primitive variables and
functions are available to Guile and work out the interaction.  The
latter is easier, because you can leave out most of the C initially, and
it's easier to re-work your design (as you're bound to end up doing at
least a few times).  But you will suffer a little in performance if the
core engine is Guile, which is not insignificant for a game engine.

    cr88192> personally I am a little more familiar with common lisp
    cr88192> than scheme, so really I can do very little and have it
    cr88192> work (not like I know common lisp very well either...).

    cr88192> actually a comparison of guile and rep would be helpful, or
    cr88192> both vs python, as I really don't know myself.

I'm not too familiar with rep (he types, shamefully running within
sawfish), but I can give a comparison of Scheme in general vs. Python.

The first thing that will strike you about Python is being annoyed at
the block structure.  Ignore it, you'll get used to it, it's just like
getting used to parenthesis.  After that you'll find Python is *very*
clean and simple and easy to use.  I find my old Python code easier to
read than any other code I've written, and Python is far from my
favorite language.

I think the main reason I left Python at the time was that it was in the
1.x days, and Python didn't have some really basic things like closures.
But there are other things that still limit you in 2.x.  One of the
first things I wanted to do was dynamic importing (of different story
modules) and this is clumsy because it has to be done with exec (eval).
For that matter, dynamically generating and evaling code is difficult
because for anything more than one statement you have to build up a
string and get the block indentation done right.  Higher-level
abstractions typically have to be done with OO techniques, which are not
always the right tool for the job.  Scheme encourages you to work more
with meta-programming, building functions of functions to get higher
abstractions.  You can do some of this in Python, but it's not as easy
or as natural, and lambda expressions are limited to one-liners.  Also,
I find Scheme's macros indispensable - sometimes the abstractions you
use are just a little unwieldy to work with directly, and macros let you
wrap them up in convenient syntax.

But again, if you're just extending a C engine with some scriptability,
then you're fairly limited in your extensibility to begin with, and
Python may suit you just as well.  It would probably be more popular
with end-users who want to make little tweaks to their favorite games
but are not experienced programmers.

HTH,
Alex



reply via email to

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