Original Post
I'm trying to embed Python into a game and have some questions about it. More specifically, I'm trying to use Python to implement parts of a component-based system I'm working on. I'm using Boost Python. All I've done so far is tinkered with the Boost Python wrappers around the Python C API and I've managed to load scripts and evaluate free functions. Eventually, I'd like to be able to: 1.) Load scripts and evaluate generic objects. Given a symbol name "foo", I want to be able to extract its value, whether it be a callable object (like a free function) or a simple variable within the __main__ dictionary. 2.) Expose an API to Python scripts, giving them access to a component object, which is exported from C++. I'm sure these are common ideas. I was wondering if anyone is willing to share their thoughts, experiences, and maybe even code regarding all of this. How have you embedded Python? How do you typically handle the loading and execution of scripts? I don't think I need too much power or low-level functionality (just evaluating objects should be enough). How do you generally go about exposing an API to Python? I think that may be the most difficult part. So far, I'm surprised at how easy it can be to get a Python script running and to extract values from it. Thanks!