Using Py++ to call Python code from C++

8 views
Skip to first unread message

Anders Elfgren

unread,
Feb 12, 2009, 1:43:38 PM2/12/09
to python-ogre...@googlegroups.com
Hi,

I'm just wondering if Py++ can work the "opposite" way of how it's used for Python-Ogre. We're making a game in C++, and we'd like to call scripts in Python. Can Py++ help us do this? :)

/Anders

--
-------------------------------------------------------
Anders Elfgren, AKA Srekel
Homepage: http://www.srekel.net
ICQ: 4596105

Roman Yakovenko

unread,
Feb 12, 2009, 2:57:43 PM2/12/09
to python-ogre...@googlegroups.com
On Thu, Feb 12, 2009 at 8:43 PM, Anders Elfgren <sre...@gmail.com> wrote:
> Hi,
>
> I'm just wondering if Py++ can work the "opposite" way of how it's used for
> Python-Ogre. We're making a game in C++, and we'd like to call scripts in
> Python. Can Py++ help us do this? :)

No :-(.

It is an interesting direction and it could be nice to have such
ability in Py++.
If you are willing to work together on this feature, than we can join
the efforts.

--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/

Ivan Vučica

unread,
Feb 12, 2009, 3:03:25 PM2/12/09
to python-ogre...@googlegroups.com
Not via Py++, but there's always Python API for C. 
--
Regards,

Ivan Vučica

OBJECT Networks :: www.objectnetworks.net
Cateia Games :: www.cateia.com
Zagrebački računalni savez :: www.zrs.hr
iv...@vucica.net :: ivan.vucica.net

Anders Elfgren

unread,
Feb 13, 2009, 3:08:27 AM2/13/09
to python-ogre...@googlegroups.com
Hi, thanks for the reply :)

I'll have to discuss it with my team members, but we'll probably end up doing it using just the Python C API. Boost::Python apparently requires RTTI and exceptions, and I don't think we're gonna have those enabled...

/Anders

Andy Miller

unread,
Feb 13, 2009, 4:13:21 AM2/13/09
to python-ogre...@googlegroups.com
You specifically have RTTI disabled ??? 

Is there a reason for this (I'm interested as the only project I've seen that was like this was the earlier versions of CEGUI and even that's changed with the latest build)...

Cheers

Andy

2009/2/13 Anders Elfgren <sre...@gmail.com>

Anders Elfgren

unread,
Feb 18, 2009, 1:42:20 PM2/18/09
to python-ogre...@googlegroups.com
Well, I don't think we have yet. However, we do have it disabled in the games we're working on professionally (this is just a hobby project), e.g. Just Cause 2.

In that code base, we have our own slimmed version of RTTI, for performance reasons.

/Anders

Roman Yakovenko

unread,
Feb 18, 2009, 2:13:28 PM2/18/09
to python-ogre...@googlegroups.com
On Wed, Feb 18, 2009 at 8:42 PM, Anders Elfgren <sre...@gmail.com> wrote:
> Well, I don't think we have yet. However, we do have it disabled in the
> games we're working on professionally (this is just a hobby project), e.g.
> Just Cause 2.
>
> In that code base, we have our own slimmed version of RTTI, for performance
> reasons.

Sorry for being of topic. May I ask you, to describe your "custom
RTTI", the test you made and the numbers?
Being a C++ developer for few years I didn't see the use case, where
compiler implemented RTTI was the bottleneck.

Anders Elfgren

unread,
Feb 19, 2009, 5:34:03 AM2/19/09
to python-ogre...@googlegroups.com
I can't go into exactly how it works, but basically each class has a static variable indicating it's type. Generated by a macro that takes the class name as a parameter.

Not sure there are any statistics, but the way I understand it is that RTTI increases the size of the executable, and when you're developing for consoles, every byte (ok, every kilobyte at least :) ) counts. I was recently in a meeting when someone said "I need 300kb for my implementation of X", which isn't easy to come by, really.

Not all our classes use our RTTI, I think it's mainly our "game objects".

/Anders
Reply all
Reply to author
Forward
0 new messages