🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Does the C++ code call scripts, or vice versa?

Started by
5 comments, last by VThornheart 20 years, 5 months ago
I''ve been trying to do more reading on game scripting, and I think it''s confused me. Do you build C++ code, and it calls scripts, or is it the scripts that are run and the C++ code that is called? Is there anywhere on the net that lays this sort of thing out in an easy to digest manner? Thanks so much for your help! =)
-Vendal Thornheart=) Programming for a better tomorrow... well,for a better simulated tomorrow. ;)
Advertisement
I''ve never used an external scripting engine inside C++. So I''m not 100% sure.

Common sense would tell me, and after reading a few of the shorthand docs on a few. I think you have general functions to control the script.

Loading, pausing, executing, etc. Advanced features such as binding C++ functions to script, etc. And most likely a set of functions to get runtime values, such as variables and things.

To me that''s all it would take to make some really nice dynamic levels. If you had an event system, you would most likely have to have a system to set runtime values and fire triggers / functions.
Interesting... ah, that does make sense. Do you (or does anyone) have any useful links or resources to check out? I think I''ve given up on making my own scripting language, so if there''s tutorials or articles on using Lua, Python etc... to do the job I''d be very interested! =)

There''s one that seems to be linked to a lot on this subforum about Python (at Gamesutra), but the article is more about why you should use Python and not about how its used and such.
-Vendal Thornheart=) Programming for a better tomorrow... well,for a better simulated tomorrow. ;)
quote: Loading, pausing, executing, etc...

Don''t you mean "parsing," and not "pausing?"
quote: Original post by VThornheart
I''ve been trying to do more reading on game scripting, and I think it''s confused me. Do you build C++ code, and it calls scripts, or is it the scripts that are run and the C++ code that is called?
Depends on your architecture. If your "main game" is written in C++, then it will call scripts written in other languages. If your main game is written in the scripting language (Humongous Games uses Python as the main language, with modules written in C++), then the C++ will be called from there. Furthermore, it is possible to have a scripting language call a C++ function that calls a scripting language function during its operation - though why you''d do that is beyond me.

The point is, there is no inherent structure imposed. The languages are aware of each other; assign roles as you choose.
Hmm, fascinating! Very interesting indeed. Do you have any good resources that could help out?
-Vendal Thornheart=) Programming for a better tomorrow... well,for a better simulated tomorrow. ;)
quote: Original post by VThornheart
Hmm, fascinating! Very interesting indeed. Do you have any good resources that could help out?
Not really. My preferred method is to write Python extension modules in C++, but I haven''t had to in a long while since I haven''t been programming games, and since there''s already a ton out there.

Maybe if I was writing a 3D engine, for which I consider PyOpenGL an inadequate solution...

This topic is closed to new replies.

Advertisement