Scripting language, for game logic.

C

Chrstfer

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.
 
M

Miles Bader

Chrstfer said:
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
 
C

Chrstfer

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

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

Chrstfer

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.
 
A

Alf P. Steinbach /Usenet

* 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
 
M

Miles Bader

Chrstfer said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,829
Messages
2,569,737
Members
45,525
Latest member
RosalindSa

Latest Threads

Top