Any recommendations for scripting language bindings for gameplay scripting?
19 replies, posted
General-ass question here, but:
I'm making a game engine from scratch. Again.
Does anyone here have any recommendations for scripting language integration, both choice of language and choice of implementation? I want all gameplay to be implemented in scripting. Last time I worked on making a game engine from scratch at school, I spent FAR too long getting V8 JavaScript integrated. V8 is a huge mess and probably works great for Chrome and the Node.js guys seem to have figured it out, but it's pretty difficult for anyone else to penetrate. So now I'm shopping around, seeing what others are using for scripting languages (mostly Lua), and looking for the best bindings and so forth. Any recommendations?
Right now I'm looking at [url=https://github.com/jeremyong/Selene]Selene[/url], but I'm open to other language and implementation suggestions.
C#? I have no idea how that can be implemented but it works well for Cities: Skylines in the modding department.
Look into it. Of course Lua is a suggestion (as always).
[QUOTE=takua108;48676419]General-ass question here, but:
I'm making a game engine from scratch. Again.
Does anyone here have any recommendations for scripting language integration, both choice of language and choice of implementation? I want all gameplay to be implemented in scripting. Last time I worked on making a game engine from scratch at school, I spent FAR too long getting V8 JavaScript integrated. V8 is a huge mess and probably works great for Chrome and the Node.js guys seem to have figured it out, but it's pretty difficult for anyone else to penetrate. So now I'm shopping around, seeing what others are using for scripting languages (mostly Lua), and looking for the best bindings and so forth. Any recommendations?
Right now I'm looking at [url=https://github.com/jeremyong/Selene]Selene[/url], but I'm open to other language and implementation suggestions.[/QUOTE]
You might be interested in: [url]http://www.squirrel-lang.org/[/url]
Which was made pretty specifically for games :v:
Lua is of course, the most widely adopted one.
If anyone knows anything about using C# runtime scripting in a C++ program, I'd love to know more. I'm trying to read up on it but I think I'm searching for the wrong terms.
[QUOTE=Profanwolf;48676719]Lua is of course, the most widely adopted one.[/QUOTE]
Is this true? I'm not calling you out, I genuinely don't know.
I feel we (forum members) are partial to this answer because the majority of us have a background in Garry's Mod Lua. I'm familiar with other games that use Lua but is it really that popular?
[QUOTE=foszor;48677370]Is this true? I'm not calling you out, I genuinely don't know.
I feel we (forum members) are partial to this answer because the majority of us have a background in Garry's Mod Lua. I'm familiar with other games that use Lua but is it really that popular?[/QUOTE]
To be fair, I sort of pulled that out my ass, but it has been my impression thus far that it's the most widely used. :v:
As a sample from wikipedia, games that implement it: [url]https://en.wikipedia.org/wiki/Category:Lua-scripted_video_games[/url] and engines that implement it for scripting: [url]https://en.wikipedia.org/wiki/Category:Lua-scriptable_game_engines[/url]
Some seem to use python as well, notable examples being EvE, the Mount&Blade series of games as well as Battlefield 2 & 2142: [url]https://wiki.python.org/moin/PythonGames[/url]
I'd not recommend python though, it's not very much fun to integrate into something else :v: (Squirrel and Lua are two [I]sane[/I] options there)
As a footnote, Valve uses Squirrel too as one of the possible languages to use for scripting: [url]https://developer.valvesoftware.com/wiki/Squirrel[/url] (though Lua is included there too)
[QUOTE=foszor;48677370]Is this true? I'm not calling you out, I genuinely don't know.[/QUOTE]
No, I'm positive Python and web languages are the most widespread scripting languages in reality.
Lua would still remain my choice for integration though.
[QUOTE=Profanwolf;48677431]To be fair, I sort of pulled that out my ass, but it has been my impression thus far that it's the most widely used. :v:
As a sample from wikipedia, games that implement it: [url]https://en.wikipedia.org/wiki/Category:Lua-scripted_video_games[/url] and engines that implement it for scripting: [url]https://en.wikipedia.org/wiki/Category:Lua-scriptable_game_engines[/url]
Some seem to use python as well, notable examples being EvE, the Mount&Blade series of games as well as Battlefield 2 & 2142: [url]https://wiki.python.org/moin/PythonGames[/url]
I'd not recommend python though, it's not very much fun to integrate into something else :v: (Squirrel and Lua are two [I]sane[/I] options there)
As a footnote, Valve uses Squirrel too as one of the possible languages to use for scripting: [url]https://developer.valvesoftware.com/wiki/Squirrel[/url] (though Lua is included there too)[/QUOTE]
I didn't even know Valve implemented a scripting language :v:
[QUOTE=bayrock;48677444]No, I'm positive Python and web languages are the most widespread scripting languages in reality.
Lua would still remain my choice for integration though.[/QUOTE]
I was assuming he was talking about game development here more specifically at least, and as integration inside of [I]another application[/I], not whatever people otherwise mean when they say "scripting language" which is a bit watered down (what's a scripting language really?). But I admit my post may have been unclear in that regard.
[editline]14th September 2015[/editline]
[QUOTE=thatbooisaspy;48677462]I didn't even know Valve implemented a scripting language :v:[/QUOTE]
It seems more like they built some awkward virtual machine which these other languages interface with, but yeah I was surprised too :v:
[QUOTE=Rocket;48677562]You'd need to [url=http://www.mono-project.com/docs/advanced/embedding/]embed mono[/url].[/QUOTE]
You only need to embed mono if you don't plan on making the engine windows-only, for a simple windows-only .NET scripting support you can simply implement the sandboxing and bindings in C# itself and call that from the unmanaged side.
[editline]14th September 2015[/editline]
That is, without embedding anything, if you want to make it portable later you can always embed mono that invokes the managed side instead of doing it directly.
[QUOTE=cartman300;48681478]You only need to embed mono if you don't plan on making the engine windows-only, for a simple windows-only .NET scripting support you can simply implement the sandboxing and bindings in C# itself and call that from the unmanaged side.
[editline]14th September 2015[/editline]
That is, without embedding anything, if you want to make it portable later you can always embed mono that invokes the managed side instead of doing it directly.[/QUOTE]
How would I go about doing this from C++? I'm looking all over the Internet and I can't find the information I need, but I think I'm not looking for the right terms, or something.
[QUOTE=takua108;48682006]How would I go about doing this from C++? I'm looking all over the Internet and I can't find the information I need, but I think I'm not looking for the right terms, or something.[/QUOTE]
Either [QUOTE=Rocket;48677562]You'd need to [url=http://www.mono-project.com/docs/advanced/embedding/]embed mono[/url].[/QUOTE] or you'd need to [URL="https://code.msdn.microsoft.com/CppHostCLR-e6581ee0"]host .NET[/URL].
In any case it's likely easier if you write some code on the managed side.
[editline]14th September 2015[/editline]
Mono security settings still don't do anything afaik, so you'd have to use something custom if you go with that.
I'm battling this question myself for my hobby engine.
Right now, I'm on the fence between Mono and Lua.
The biggest problem for me is finding a language with any decent editor available.
Mono/C# has Visual Studio, MonoDevelop, and many others.
Lua has a couple, including [url=http://studio.zerobrane.com/]ZeroBrane Studio[/url].
There's also [url=http://www.gmscript.com/]GameMonkey Script[/url] (basically Lua with C syntax), and [url=http://www.angelcode.com/angelscript/]AngelScript[/url] (basically C++), but neither has any good editors as far as I've found.
I'm working on a BASIC interpreter for backend web development. I will soon somehow incorporate it into a game scripting language. No clue how though lol
-snip-
if your game engine is written in C/C++, the obvious choice is Lua. it integrates easily, and is fairly efficient and lightweight.
if you're feeling experimental and also using C/C++, you can try wren at [url]https://github.com/munificent/wren[/url]
i personally like wren myself, but it's new and still in heavy development so it's not a solid choice to pick as of now
[editline]15th September 2015[/editline]
i checked out squirrel myself and it looks pretty cool
and reminds me of c++
that can be both a good and a bad thing i guess
I recommend Duktape ([url]http://duktape.org[/url]) ECMAScript
Sorry, you need to Log In to post a reply to this thread.