Scripting language, for game logic.

Discussion in 'C++' started by Chrstfer, Apr 11, 2011.

  1. Chrstfer

    Chrstfer Guest

    Im making a basic game, just to hone my skills and learn as much as i
    can. Id like to add a scripting language for the NPC and map
    generation stuff, to script AI for enemies, add new enemies, add new
    map tiles, etc. Im thinking about Python, but boost::python seems to
    want me to use the python as the program, and call functions on a
    library written in C++, instead of the C++ being the controller. Is
    there a way to have python scripts define new enemies and their AI,
    new tiles and their interactions, etc, and have the C++ be the
    program? Id like to be able to expose functions, classes and objects
    to Python. (Classes being those than can be derived from, objects
    being actual objects of other classes). Is this possible?

    If not, is there a C++ wrapper for Lua? the lua C API would probably
    work, but id like to have some abstraction between the C API and my C+
    +, mainly because i dont feel like id be up to using the C API, from
    the cursory looks ive had of it as an option. I will look into that
    and see if i was right or not.
    Chrstfer, Apr 11, 2011
    #1
    1. Advertising

  2. Chrstfer

    Miles Bader Guest

    Chrstfer <> writes:
    > If not, is there a C++ wrapper for Lua?


    There are many...

    I personally use SWIG, which has the advantage of being multi-lingual,
    very powerful, able to expose many C++ features easily, and somewhat
    simple to get started with -- but can be a bit bloated too (and it does
    have a learning curve when you want to use more advanced features).

    See: http://lua-users.org/wiki/BindingCodeToLua
    (this page is kind of disorganized, but it has a lot of links ...)

    -miles

    --
    Philosophy, n. A route of many roads leading from nowhere to nothing.
    Miles Bader, Apr 11, 2011
    #2
    1. Advertising

  3. Chrstfer

    Chrstfer Guest

    On Apr 11, 1:21 am, Miles Bader <> wrote:
    > Chrstfer <> writes:
    > > If not, is there a C++ wrapper for Lua?

    >
    > There are many...
    >
    > I personally use SWIG, which has the advantage of being multi-lingual,
    > very powerful, able to expose many C++ features easily, and somewhat
    > simple to get started with -- but can be a bit bloated too (and it does
    > have a learning curve when you want to use more advanced features).
    >
    > See:  http://lua-users.org/wiki/BindingCodeToLua
    > (this page is kind of disorganized, but it has a lot of links ...)
    >
    > -miles
    >
    > --
    > Philosophy, n. A route of many roads leading from nowhere to nothing.


    Thank you. Does this mean that there are no Python wrappers, or just
    none that you know of?
    Chrstfer, Apr 12, 2011
    #3
  4. Chrstfer

    Chrstfer Guest

    On Apr 11, 7:31 pm, Chrstfer <> wrote:
    > On Apr 11, 1:21 am, Miles Bader <> wrote:
    >
    >
    >
    > > Chrstfer <> writes:
    > > > If not, is there a C++ wrapper for Lua?

    >
    > > There are many...

    >
    > > I personally use SWIG, which has the advantage of being multi-lingual,
    > > very powerful, able to expose many C++ features easily, and somewhat
    > > simple to get started with -- but can be a bit bloated too (and it does
    > > have a learning curve when you want to use more advanced features).

    >
    > > See:  http://lua-users.org/wiki/BindingCodeToLua
    > > (this page is kind of disorganized, but it has a lot of links ...)

    >
    > > -miles

    >
    > > --
    > > Philosophy, n. A route of many roads leading from nowhere to nothing.

    >
    > Thank you. Does this mean that there are no Python wrappers, or just
    > none that you know of?


    Sorry, there does not appear to be an edit button.

    I didnt understand what you meant by multilingual, when you mentioned
    SWIG. I thought you meant it as a multilingual Lua wrapper. After
    looking into it i realize you meant it was a wrapper for multiple
    languages. Thanks you, sorry for my last post there.
    Chrstfer, Apr 12, 2011
    #4
  5. * Chrstfer, on 12.04.2011 01:31:
    >
    > Thank you. Does this mean that there are no Python wrappers, or just
    > none that you know of?


    There are lots of C++ wrappers for Python.

    Collectively they employ just about any technique you might think of, except of
    course the particular detailed way that oneself would like to have it...

    Anyway, you might start with the Boost Python interface.


    Cheers & hth.,

    - Alf

    --
    blog at <url: http://alfps.wordpress.com>
    Alf P. Steinbach /Usenet, Apr 12, 2011
    #5
  6. Chrstfer

    Miles Bader Guest

    Chrstfer <> writes:
    > Thank you. Does this mean that there are no Python wrappers, or just
    > none that you know of?


    I just don't know (I don't use python); but I do know about Lua.

    -Miles

    --
    Next to fried food, the South has suffered most from oratory.
    -- Walter Hines Page
    Miles Bader, Apr 12, 2011
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. BlackHawke
    Replies:
    12
    Views:
    1,550
    Andrew Thompson
    Jan 26, 2004
  2. Ron Stephens
    Replies:
    23
    Views:
    2,795
    Ron Stephens
    Apr 12, 2004
  3. DaveInSidney
    Replies:
    0
    Views:
    401
    DaveInSidney
    May 9, 2005
  4. spike
    Replies:
    8
    Views:
    1,439
    Steve Holden
    Feb 9, 2010
  5. nicom53

    making pacman game.... logic problems

    nicom53, Jun 16, 2008, in forum: Javascript
    Replies:
    1
    Views:
    75
    Thomas 'PointedEars' Lahn
    Jun 17, 2008
Loading...

Share This Page