Using C ++ and scripting together

I design simple games as a hobby. For my new project, I want some parts to be scriptable. I am familiar with python, but not against learning new languages. Here is the question:

I plan to implement path detection, field of view, conflict detection, etc. in C ++, but I want to use scripts for authorized AI machines, event scripts. What structure is used for this kind of work? I suppose I can get a C ++ program to run a python process, which in turn calls C ++ methods, but it seems inefficient. Another idea is to create a library that will be called from python, which is also not very attractive. What is the usual way to do this (except for writing your own language and parser?) I heard that lua is popular for embedding in C programs.

+3
source share
4 answers

, lua tcl API- API . . , , tcl, , lua. , ++, luabind API, .

AI- , Zed Shaw - . AI , .

python, , .

+6

Python? ....

Embed.

+4

Google Javascript engine V8. , ++, , .

http://code.google.com/p/v8/

+3

, Tcl Lua c/++. , . , , - Guile.

If you're interested in embedding a scripting language in your C ++ application, check out Swig . Swig can automatically generate glue code for several scripting languages, including the python that you already know. The main advantage is that it handles many scripting languages.

+2
source

Source: https://habr.com/ru/post/1771887/


All Articles