views:

360

answers:

4

I am looking into designing a game scripting language and was wondering what people employed in the games industry considered essential items/properties for a good game scripting language. This includes things like:

  • static vs dynamic types
  • Who should it be aimed at: programmers or designers?
  • syntax(must it look like C?)
  • How high level should it be? (C vs Lisp for example -- or imperative vs functional)
  • What must it be able to do. How fast does it need to be?

Also, I have heard from a few sources that scripts tend to be very simple as they are written by designers more than programmers. Is this the case?

+6  A: 

How about looking into languages that are actually used for scripting in games like Python and Lua for some ideas?

Both happen to be dynamically typed, and in terms of syntax, Python is very not C-like, and Lua is not terribly similar to C.

Probably the reason why they are used for game scripting is the ease of embedding the language as a scripting engine, if anything else. If the language is to be designed with designers in mind, then the perhaps the requirements for the language would have to be changed in order to fit the designers needs, rather than having a language that is more easily integrated into a game.

coobird
+1  A: 

My ideal game scripting language would have a Python-like syntax and could be embedded into other languages as easily as LUA.
Additionally, it should be able to be embedded inside XNA, which does currently (and will probably forever) lack the reflection features that LuaInterface and embedded IronPython depend upon.

+3  A: 

You seem to be asking a very general question (if you don't know what the scripting language has to do, or how fast it needs to be) and expecting specific answers.

The main reason for a scripting language is to allow people to change the game without hacking the source code. Let's go with that.

It should therefore be aimed more at designers, since they aren't going to hack the source code, and the programmers will. It needs to be fast enough to run the game properly. It needs to be powerful enough for the designers to put in whatever it is they're going to put in. (Yes, these are vague answers, but you don't give enough information to be more specific.)

So, forget about the features that would be of use primarily for programmers, like any particular syntax model or static typing. Designers aren't baby-ducked on C syntax, and don't want to worry about static typing or memory management.

There's some real advantages to using an already established language. The designers might have some experience with it, it's already documented, and a lot of the hard stuff has already been done for you. This includes the language design: programmers are not necessarily good at seeing what is good about a scripting language.

This suggests something like Lua or Python.

David Thornley
I totally agree with this - there is not and cannot be a 'right' answer for what scripting needs to do as it depends on the application and the team.
Kylotan
+1  A: 

It depends partially on what department will be doing the majority of scripting. If the level designers, for example, are doing a large portion of scripting then the best type of language would be something closer to natural language that doesn't require a steep learning curve. A level designer doesn't necessarily want to learn complex syntax like C/C++ just to play a sound.

A pseudo language might look like this (TES Construction Set scripting is like this):

script MagicCaveDoorScript
    on UseAction
     if HasItem magicDoorKey
      PlaySound2D magicDoorOpen
      ChangeArea magicCave01
     else
      Message "You need the magic door key to enter..."
     end
    end
end

But if the programmers are the ones doing a lot of the scripting then its probably more flexible and powerful to use a more complex language like Lua or Squirrel with classes, objects and such.

One good side of creating a "simpler" scripting language is that implementation isn't nearly as complex as the more difficult languages and would allow you to also easily develop tools to create scripts via a GUI, such as choosing from a list of sounds to play, a list of monster items to attach, etc.

Nick Bedford