In what cases are what scripting languages better than others?
All answers are appreciated, please provide a description, and describe in what cases the language excels in.
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.
Sign up to join this communityIt is widely used in the game industry, from independent games (Aquaria) to AAA titles (Civilization V).
The core reason? I would say because it is easy to learn and easy to incorporate into your games. Scripting, in general, isn't difficult. I think the real reason you should go with Lua is because it's proven which results in much more resources out there for you to learn from.
It provides "meta language" features. You can implement object-oriented structures, or pure procedural functions, etc. It has a very simple C interface, and gives the engine developer a lot of flexibility in the language itself.
Artists tend to love Lua too because it's very approachable, with plain and forgiving syntax. If your codebase is C or C++, I would highly recommend it.
It has good runtime performance when compared to other scripting languages like Python. (...and it has full support for closures.)
It has a small memory footprint (approx 150k), it has excellent C/C++ bindings making it easy to add new game specific APIs, it is easy to pick up, it is flexible - i.e Has elements of OO, imperative and functional - none of which are mandatory, it has good buy-in from from mod community from games such as WoW etc.
Squirrel has an interesting history. It was built after a game architect had issues with Lua's unpredictable garbage collection, and crazy everything is null even if it doesn't exist.
Squirrel is the sripting language used in Left 4 Dead 2. The API is very lua-like (Squirrel's author loves Lua's design).
So Squirrel is an awesome language as it's kinda 2nd generation Lua. It took the good ideas and removed the annoying eccentricities.
Same from Lua:
New to Squirrel:
Squirrel's primary disadvantage is it's not Lua. Lua is much more widely used. But if that's not an issue Squirrel is an easy win. However, often the language's popularity is useful feature in itself, so the decision is not so clear cut.
PRO's
Possible CON's:
This one is used by several teams. It's faster than Lua and better at threading.
This one has been used in several games (e.g. Civilization IV).
It is very easy to teach to non-programmers/designers. It is even easier to pick up for developers since it essentially reads like pseudocode. Being dynamically typed is just one of the aspects that help to get people with little to no prior coding experience up and running fast with the language.
Possible cons:
This is a possible option as you can download JavaScript engines. There are more JavaScript programmers than any other type of programmer.
This specialized language has been used in several adventure games and it is particularly suited to those games.
This allows you to use the Novell implementation of the .NET framework for scripting.
Here's another page about embedding mono in your application.
The Mono framework is faster than most (perhaps all?) of scripting languages out there because it's not interpreted, and because there's a layer between the compiler and the instruction set, it allows you to program in a variety of languages including C# and dialects of Python, Lua and Javascript.
Possible cons:
Some find this one much easier to bind to C++ than Lua.
That being said, I suspect Lua has a few advantages that make it compelling for commercial games developers:
If you're just writing a hobby project, though, I'd say that AngelScript's at least worth a look.
Well, guile specifically.
With guile you can have your own DSL (Domain Specific Language) just for your game. Once you get used to the parentheses and prefix notation, scheme is heaven to work with.
This is a hybrid dynamic/static typed language used to create Flash games, which can be widely distributed on the web. It is fairly well supported with libraries like Flixel, FlashPunk and Box2d.
Yes, writing a compiler and/or interpreter for a scripting language might take a week or two, but in the long run the flexibility will pay of many times. Just don't go to far astray and reinvent brainfuck.
You should choose a scripting language that has stable and well-supported bindings to your game's primary development language.
If you are writing your game in C or C++, then there are pretty solid bindings available for Python and Lua. If you are writing your game for the .NET platform (using C# or another language), then I highly recommend using either IronPython or IronRuby. Both are complete language implementations that leverage Microsoft's Dynamic Language Runtime (DLR), which provides excellent performance and very tight integration with the .NET Framework. Interoperability between C# and IronPython/IronRuby is pretty smooth these days, especially with the introduction of dynamic callsite binding in C# 4.0.
Choosing one scripting language over another is dependent on your specific requirements. Some of the options you have to choose between could be:
If you have an existing team that will use the scripting language or a lead (level)designer that will use the scripting, then go with whatever their language of choice is. They will be spending their time with it, so they should be catered to.