glob2-devel
[Top][All Lists]
Advanced

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

Re: [glob2-devel] Embedded scripting language (again)


From: Bradley Arsenault
Subject: Re: [glob2-devel] Embedded scripting language (again)
Date: Wed, 22 Feb 2006 15:53:58 -0800

On 2/21/06, Matthew Marshall <address@hidden> wrote:
> On Tue 21 Feb 2006 07:15, Stéphane Magnenat wrote:
> > All this said, perhaps python is suitable. I just would like too see better
> > how to implement checkpointability and our special multithreading.
> > Arguments such as "this feature is not usefull" do not convince me.
>
> Well, this would be easy to implement (from the example in the wiki):
>
> from glob2 import *
>
> squares = [Area(60, 0, 1), Area(31, 0, 1)]
>
> @as_thread
> def introduction():
>     show("Get to the sand square in your apponents base.")
>     yield 10
>     hide()
>
> def lose_condition(area, team):
>     while area.occupied(team):
>         yield 1
>     lose(team)
>
> register_thread(lose_condition, squares[0], 0)
> register_thread(lose_condition, squares[1], 1)
>


Thats quite a good way of representing things, I was thinking of a
more callback based interface but generators do indeed work and are
elegant. But what is yielded may have to be elaborated upon.


>
> Note that I am showing two ways of doing a thread: a) using a decorator and,
> b) manually registering (With paramaters to be passed.)  Also note that this
> technically does not used threads, but generators.  This makes it
> deterministic, and IMHO far less painful.
>
> This is simply the first thing that came to mind as an answer to your request.
> There are quite a few other problems with using python that would need
> careful consideration...  Perhaps I'll write more tomarrow; I need to get to
> bed now.
>
> MWM
>
>
> _______________________________________________
> glob2-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/glob2-devel
>


I would like to see an embedded language replace more than just sgsl,
one that may also provide an interface for custom ai, or one that
could be used to describe random maps (for Giszmos new system).

Oner thing forwarned, scripted unit behaviour should be avoided,
because this alters the gameplay of the game, and other "scripts" will
become dependant on this script either being there or not being there.




reply via email to

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