-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scripting languages #17
Comments
I hate myself for suggesting this, but you might consider adding javascript to the list of supported scripting languages. It's hugely popular, as sad as that makes me. |
@jonesmz is it popular among game developers? |
@jayrulez No idea! I certainly hope not. But it is hugely popular in the general programming world. Consider also issue #18 , which includes soft plans to support WebAssembly / Emscripten. Maybe scripting support wouldn't have any influence on that PR, maybe it would. But keeping Javascript support in mind (Either because it'll be supported, or because it'll explicitly not be) would be meaningful when considering the intersection between this issue and #18 |
The Emscripten route will end up just using JavaScript natively as the entire engine gets converted to js / webasm. So I'd probably wait to see how that goes first, and then evaluate whether we also want javascript as scripting language for non-web as well (most likely yes, but maybe majority of js users just want a web version). In any case it will certainly be nice to be accessible to such a big user base. |
Hi! |
It sounds interesting. I'll consider it but from a quick look it seems Haxe would require significantly different approach to the languages above, since it cross-compiles to other languages rather than running a virtual machine (but correct me if I'm wrong, I just took a quick look). bsf relies on communicating with the scripting VM in order to add various functionality like serialization, scanning for dependencies, etc. (basically it needs the language to have some kind of reflection). So if I do decide to go with that approach some core concepts about the API would need to change, which I haven't really had a chance to properly think about. |
I think, Haxe externs fit the alternative approach you described. Two-way binding (bfs <-> hxcpp) is also possible with CFFI Prime. Haxe experts give some insights on this -- snowkit/hxcpp-guide#1 |
I'm not seeing any usage of C++ calling into Haxe in the CFFI/CFFI Prime examples. I did find an example of it being done elsewhere, by passing a callback from Haxe to C++, and then invoking the callback. So I guess it's technically possible. It remains to be seen how flexible that approach is and if there are any limitations to types being passed. I'm a bit wary about potential limitations since it doesn't appear to be something that's commonly used. |
Currently for me, C# used a main scripting language is fine, as an alternative scripting language, I would use LUA as I used it when working on IRB and when I worked at Gameloft on Dungeon Hunter II. Lua is still used a lot in games. But for now for me, C# is ok, I don't feel the need to try to implement lua. Checked a look on HAXE, and it could help support lots of Scripting language at once! Don't know if it would integrate well with what is already there... |
With Blender 2.8 removing altogether the Blender's embedded game engine, I'm one of possibly many people who would certainly give a In that respect, being able to create and launch an application directly from Python would be a very welcomed feature. |
@christianclavet proletariatgames integrated Haxe with Unreal Engine; they use it in production -- https://www.proletariat.com/our-games/ how cool is that? |
@jeebus3000 I know Armory3D quite well actually (Haxe again ;-) ), but we have a massive code base in Python, and after tinkering a bit, I do not quite see how I could efficiently reuse that Python codebase if I were to use Armory... |
I am going to focus on finishing up C# support first, since that is mostly done already. So it might take me a bit to get around to Python or Lua. Since this seems to be a popular topic, if someone does want to take on the task themselves take a look at the following:
|
When you say Python, do you mean at least 3.6+ or are you interested in targeting 2.7x for compatibility with DCCs until VFXPlatform 2020? |
Undecided at the moment, but since most of the framework tends to focus on newer technologies, quite likely we'll go with the most recent version. |
Awesome. Do you have any thoughts on how you'd want Python component evaluation would work with the current threaded task system? |
I'm not that familiar with Python so I'm not sure what you mean by component evaluation. The task system is currently not exposed through the script API. Most higher level languages have their own functionality for handling threading, so the preference is to use those directly. If needed it can eventually be exposed. |
One alternative that you can consider is Wren: https://github.com/munificent/wren. Otherwise you won't go wrong with Lua honestly. |
I don't have an ETA for it yet, but I'm hoping I can squeeze it in soon. Hopefully sometime around v1.1 release, which should happen near the end of the year. |
For lua you probably want to look into sol2 -> https://github.com/ThePhD/sol2 I'm using sol2 in my own engine for registering type in lua environnement -> https://github.com/Milerius/shiva/blob/master/modules/lua/shiva/lua/lua_helpers.hpp#L19 I'm sure that you can do something similar with you're RTTR system |
sol2 looks nice. If you are ever interested in doing script binding for for bsf let me know. |
I will do it anyway for my game engine, i'm using lua as scripting langage and i plan to use bsf, so i will probably do it and then make a pr when this will work |
@BearishSun Can you explain how work the
So i can start to investigate for integrate sol2 and lua bindings ? |
First grab BansheeSBGen source and build it:
You can take a look at Some script bindings aren't auto-generated and use custom wrappers. Those are provided in the Banshee project under
Finally, Some code isn't auto-generated. Stuff like GUI I haven't updated yet to use the auto-generator. Certain types like It's a big task, but hopefully this gives you some information on where to start. |
cling based C++ as scripting language / hot code reload
|
bs::f currently comes with an automated script binding generator that generates bindings for the Mono runtime and outputs C# binding code. This binding generator should be extended to support Lua, Python and Java. Scripting plugins that know how to communicate between bs::f and runtimes for those languages should also be added.
The scripting API might need to be extended so an app can be created fully from a scripting language. Currently the systems allows the user to create custom components, in which a majority of engine functionality is exposed. But initial start-up and window creation is not currently exposed.
An alternative approach to scripting language support is to use the script binding generator to generate SWIG interface, which can then output bindings for a variety of languages. However SWIG only allows for one-way method calls, making some bs::f operations like auto-serialization not possible. However this approach does allow the user to just use bs::f as a plain library in their scripting language.
It remains to be seen which approach is best.
The text was updated successfully, but these errors were encountered: