Calling a function from a scripting language like Lua or Python

I am creating a game, where part of the game play component is writing the logic for an AI. To do this, I would like to link a scripting language like python or lua to my game, then give the user a function that they may edit, which will be called by one of my c++ functions that handles game play. It would be ideal to let the bot be programmed in c++; however, having the user compile their bot into a .o file and then linking it to the game would be tedious, especially for users not very adept in c++ and using console commands. This is the reason I would like to use a scripting language, as it could be interpreted during run time.

For example:
in .cpp file i would like to do something like this
-import a scripting language
-open the file
-call function that writes to a .txt file
-parse the data from the .txt file
-execute based on the new data

Is it possible to use a scripting language in this fashion? If so, are there any resources that help explain how to do this?

Any other ideas for implementing a somewhat dynamically programmed AI would be greatly appreciated.

Cheers,
Sidebottom

Hello,

Here you can find some interesting reading about embedding scripting langage in C++:

There are also this plugin to use javascript with Unreal (can be really good for your need) :

And similar plugin using Haxe instead of Javascript:

I hope this help you ! :slight_smile:

You can also look at Skookum Script ā€¦ there is a FREE code plugin on the Marketplace: SkookumScript in Code Plugins - UE Marketplace

Check out the website for more information: SkookumScript Unreal Engine 4 Plugin - SkookumScript

Programming AI with unreal.js is really fun. :slight_smile: (We do code our AI in javascript)

Jackblue,

Thanks, UnrealJS seems to be exactly what Iā€™m looking for!

Cheers,
Sidebottom