This topic is now archived and is closed to further replies.


What is the best way to Use a scripting language.

Recommended Posts

HexDump    233
Hello guys, I have been thinking in adding scripting capabilities to my engine. I would like to be able to add classes dinamically for example different classes of enemies, enemies logic, events, methods, etc... to the game without recompile it. After thinking of it during somedays I have reach to the conclusion that if I want to get this I need to write lot of code in thet scripting language (or this is what I think), but I don´t like the idea, because of speed. Another thing that should be pointed is who has the responsability of load this classes? and instantiate them?, I mean how should be all this mess setup to achieve what I´m looking for. So, I need someone to guide me in this labirynth and tell me if this is possible (it is because, Unreal and others do), and the best way to achive it. I will be really pleased if anyone could point me to any source code or something on inet to clear all this mess. Note: My prefered scripting language is Python. Thanks in advance, HexDump.

Share this post

Link to post
Share on other sites
thedustbustr    191
I hope you realize your post got moved

I refer you to the last reply here for a brief summary of how I call python from c++.

To get you started, you should check out the python extending and embedding tutotial (, the python-c api reference (, the boost.python library (, download at, and this great article on Python "weightless threads" (

Personally, I reccommend using the Very-High-Level-Embeddning (its mentioned in the embedding tutorial) as much as possible. I found that everything I needed to do could be done through the high-level python interface. (Again, see that post I mentioned above). Python weightless threads can be used to great effect with this to avoid script-blocking-c++-execution problems.

As for source, you may wish to look at the CrystalSpace engine source - they have a python plugin. If you like, you can email me for some of my implementation.

Read up and you''ll start getting ideas.


Share this post

Link to post
Share on other sites