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.
(Remember, one language per answer)
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. (Remember, one language per answer) | ||||
feedback
|
Lua is widely used in the game industry. From independent games (Aquaria) to AAA titles (Civilization). The core reason? I would say because it is easy to learn and easy to incorporate into your games. But the same could be said for Python, I'm sure. 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.. If you feel like experimenting with something outside of the norm then I would start messing with another language. | |||||||||||||||||||
feedback
|
That depends on the game and its target platform. A game that runs 100 non-player characters (RTS games) has different needs from a game that runs just 2 (Street Fighter). A game that runs on a PC has different needs than a game that runs on a console. Lua is popular GameMonkey is used by several teams. It's faster than Lua and better at threading. Python has been used in several games. JavaScript is a possible option as you can download JavaScript engines. There are more JavaScript programmers than any other type of programer. There are also specialized languages. SCUMM has been used in several adventure games and it is particularly suited to those games. | |||||||
feedback
|
This depends on what you actually need it for. As David points out, Lua is very popular, although one game developer noted to me that he wasn't entirely sure why. I think its lightness is a common reason, but at that this point, I would expect a lot of people use Lua because that's become the de facto standard. It seems best for very lightweight modification. For a more fully-fledged approach, I'd say Python is the right choice. Civ IV used it to decent effect. | ||||
feedback
|
ActionScript 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. | ||||
feedback
|
Choosing one scripting language over another is dependent on your specific requirements. Some of the options you have to choose between could be: Speed of the interpreter - if the feature of scripting is solely used i.e. by developers to script static behaviour, then speed and a fully-fledged and extendable API may be the most important aspect. I had some good experiences with LUA there. Easy to learn, accessibility - for a content-/leveldesigner it may be hard to learn more complex scripting languages (depends on the background) to generate dynamic behaviour. In that case, the use of easy to learn (i.e. commonly used) and well documented languages could be more appropriate here. JavaScript or Python could be a good solution here. Workflow integration - if you have a specific production pipeline with already existing tools, it could be a bad idea to use a language which seems to work best for a given case if the other tools are working with a completely different one. This is especially valid if you have several programmers working on the different tools. In that case, it could be more efficient to use the "not quite fitting" language. | ||||
feedback
|
For completeness sake, another option is mono-script, which allows you to use the Novell implementation of the .NET framework for scripting. It's what Unity uses. 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. I'm not sure if it's free on all platforms however. | |||||
feedback
|
If you're working on a title for Windows and writing managed code running on top of the Common Language Runtime (CLR) - let's say e.g. in C# - I'd suggest you have a look at integrating (Iron)Python as scripting language. In my experience, Python 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. In addition to the language being easy to learn and powerful, the CLR and language teams at Microsoft (Anders Hejlsberg, Eric Lippert, Mads Torgersen, Jim Hugunin et al.) have done some great work in exposing compiler and runtime features via the new Dynamic Language Runtime (DLR) in .NET 4, making interoperability between statically typed code and dynamically typed code much more straightforward. From what I've seen and tried so far, boilerplate code is reduced to a minimum. It'll keep your codebase clean and maintainable. You can utilize this to keep the friction between the scripted parts of your game and the engine very low. Having both run within the same VM will also make it possible for the runtime to optimize more of your code during execution. | ||||
feedback
|
The answer very much depends on your environment. I am currently working with Unity, so I use a mono based language (in my case C#, but Javascript and Boo are also options). The answer depends entirely on your specific circumstances. | ||||
feedback
|
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. [grain of salt] If you don't have anybody or plan long term, then roll your own. 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. [/grain of salt] | |||||
feedback
|
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. | ||||
feedback
|
V8 Javascript from google. PRO's : Quite easy to use Constantly getting better Powerful and flexible Others As many mentioned , javascript is a common programmer tool. Adding it to my games has opened far more people who feel capable than other languages. It also supports a huge amount of casting and conversion to save on work for the programmer, also makes it really easy to use, works well with STL. Possible CON's : Documentation can be confusing Its really not the best. Examples Often a web of weirdness. Lacking in solid simplicity, it comes across as way higher level than it is. Templates Sometimes these are hated on, or avoided. SDK Codebase size Generated code size may be consider bloat. | |||||||||||||||
feedback
|
SquirrelSquirrel 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. | ||||
feedback
|
SchemeWell, 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. If you're going to use guile in a serious game, I would wait a couple of months until the 2.0 release as that will include, IIRC, an Ecmascript interpreter as well as the current scheme one. You can also expect to see large speed improvements. | ||||
feedback
|
Personally, I found AngelScript (see link below) much easier to bind to C++ than Lua when I was choosing a scripting language for my own project. (I actually wrote a small wrapper library for it to make it even easier to use, at the cost of some flexibility.) http://www.angelcode.com/angelscript/ That being said, I suspect Lua has a few advantages that make it compelling for commercial games developers: (a) It's more mature and widespread than AngelScript (b) Its syntax is easier for non-programmers (AngelScript is very C++-like) (c) It has a smaller footprint than AngelScript (at least as far as I recall) If you're just writing a hobby project, though, I'd say that AngelScript's at least worth a look. | ||||
feedback
|