Gamedev: how do i control AI with lua scripting?
My game is in C ++ and I want the AI to be driven by lua scripting, but I have no idea what scripting and integration looks like in C ++.
If the script looks like
if (whatever_happening) do_something
if (....) .....
etc
And in every frame in C ++ I have to call every enemy:
foreach(enemy)
enemy.handleAi(luascript.file)
Or is it wrong and I have to deal with it differently?
source to share
To answer another question about what AI scripts look like, this is more appropriate for gamedev.stackexchange . Have a look at this question and answers: https://gamedev.stackexchange.com/questions/2194/new-to-creating-ai-where-to-start
source to share
Luabind is a library that helps create bindings between C ++ and Lua. It has the ability to expose functions and classes written in C ++ to Lua. It will also provide functionality to define classes in lua and allow them to be inferred from other lua classes or C ++ classes. Lua classes can override virtual functions from C ++ base classes.
source to share