A
A
Anthony2283572021-05-20 23:15:44
C++ / C#
Anthony228357, 2021-05-20 23:15:44

What are the ways to implement a system of external scripts?

What are the main approaches to create a system of scripts for game engines? One way is to compile user scripts into .dlls and then load classes from them. What other approaches are there to get the code of external scripts in an already compiled program and execute functions from them, except for .dll or static libraries?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
E
Evgeny Shatunov, 2021-05-21
@Anthony228357

There are a lot of tools for solving this issue .
The solution method is always the same: you need to select and integrate a script engine into your project.
The question of choosing a scripting engine is very complex and depends on many non-obvious criteria. The answer to this question can only be given by an experienced engineer who has repeatedly dealt with different scripting engines. Because even between Lua, LuaJIT and Terra, the difference in functionality and integration features is very significant.
However, I will leave this question open. In extreme cases, you can always take a simple and easy Lua, if your eyes run wide, but there is no solution.
How integration is done. For example - so , so , so, so , so or so .
After integrating the script engine into your project, the functionality of your project can be transferred to the script side using the script engine API directly.
One of the criteria for choosing a scripting engine is its performance. In order not to occupy specialists with such a routine, once upon a time measurements of versions of various scripting engines were already carried out. The measurement results are available to everyone.
However, it is worth recalling that not always the fastest solution is the most optimal.

G
GavriKos, 2021-05-20
@GavriKos

Execution of actual scripts. Those. an interpreter is sewn in, and external scripts are written in a scripting language.
Once upon a time, Lua was popular for such a scheme.

I
Insolent Muzzle, 2021-05-20
@pluffie

You can write scripts in Lua and load them using the appropriate libraries

R
res2001, 2021-05-21
@res2001

Python is also used for a similar scheme. For example, in Tanks, if I'm not mistaken, they use it.
Browsers and node.js use JS - the scheme is similar.
In Far manager - Lua.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question