![]() |
|
|
| 6/28/99 |
|
I received an interesting email last week from one of our fans, Steve Carstensen, asking me why most game developers seem to arbitrarily chose their own scripting languages instead of opting for some existing language like Python, Scheme or Lisp. This is a very good question and one that has been on my mind for the longest time, too. So, today I would like to take you into the depths of scripting languages and their ways with games.
I believe the core of the questions is, why would anyone spend time to design, write and implement his own scripting language when there are so many proven languages out there that could do the job and supposedly save time that could instead be used on something more valuable. The question touches upon something that I have been evaluating and trying to fathom out myself. When we started “Torment” I had actually considered using a different scripting language than the one Bioware had implemented in the Infinity engine that drives the game. Unlike the languages Steve suggested I was particularly interested to see if Java and VBScript (a subset of Microsoft’s Visual Basic) would be more suitable for our needs. Both languages have gained enormous popularity through the dawn of the Internet and their use in countless web applications. When I looked into those languages I found they were indeed quite good for our basic needs and especially VBScript was very appealing. So why didn’t we use VBScript in Torment? The fact of the matter is because I was unable to find a decent virtual machine for the language that we could use. The “virtual machine” is the part of the language that takes the code and executes it. You know, it parses the code and does whatever the code tells it to - branching, calling subroutines, assigning values to variables, all the things a language does. All the virtual machines I found where either too large, to pricey or simply to useable in our environment and rewriting them would have caused as much trouble as using our ‘custom’ language. Especially since Microsoft ‘owns’ VBScript, you’re having a hard time finding any decent information or implementation on the matter, other than re-engineering their Internet Explorer, which didn’t seem very appealing to begin with because I personally despise that program. I looked into Python as well and quickly found that there’s not much information on the language kernel available at all and that it did not meet our requirements either. Back then I was intent on creating a message driven approach, which isn’t implicitly supported by any of these languages and would have meant serious re-writing of the code and the virtual machine, no matter which language we would go for. Eventually I dropped the ideas and decided to stick with what Bioware had given us, although it didn’t seem very satisfactory at first. Once we started scripting, Bioware’s implementation of their language started showing its real beauty however. The strength in this language, let’s call it IScript - for Infinity Script - for the lack of a better name right now, lies in its simplicity. One thing I was always a little weary about with Java or VBScript was that they were true programming languages and as such required programmers to work with them. This defeats the purpose of a scripting language however, because scripting languages have the purpose to allow literally anyone to write content for use with that particular language. The time to learn the language needs to be at a minimum and it needs to be very intuitive. Most of all however, a scripting language must be SAFE! In VBScript and Java in particular, the language contains too many mechanisms that would allow for mistakes and problems. If the language is error-prone you are not doing yourself a favor. You need to make sure the scripts can only do ‘safe’ things in order not to jeopardize the entire game in case you have a bad or erroneous script. Java hardly offered that because through its object oriented approach and the powerful language constructs it allowed and invited scriptors to write very sophisticated scripts. Without the proper experience, you are giving your game the kiss of death right then and there. While the safety of a scripting language has a lot to do with the actual implementation and how the game engine is accessed, complex language constructs invite ‘buggy’ scripts. We wanted to avoid that and IScript helps us a lot with that. The language is specifically designed for the needs that arise within the Infinity engine and it follows the logical thought process you have when you start thinking about the operations needed to bring elements in the game to life. With only a few commands you can bring whole areas in the game to life, while languages like Java, VBScript or Python would ask for much more code. And every line of code can cause trouble… I am not sure if this explanation is satisfactory or sufficient, but I hope it shows a little of the process that usually goes into the choice of a scripting language. While you could certainly use some of the elements of existing languages, most of the time we will need customized implementations. It’s one of the rules of the games industry - and one of its downfalls. Nothing that is in the market really works for us guys. Are we too demanding? Maybe, but usually, programming languages, code libraries and hardware drivers are not designed with games in mind. As a result we have traditionally been forced to find our own solutions and it’s gotten to a point that we now sometimes defy what the academic programming community or the market has to offer habitually, without thinking much about it. We know we can create more customized solutions without their help. Fortunately this has changed in recent years, and I know there are games out there that use Java and VBScript as their scripting languages of choice. Maybe we’ll use it too in the future - if Microsoft allows us to take a look at their virtual machines, that is.
Guido Henkel |
| Planescape: Torment & Design: © 1998 Interplay Productions. All Rights Reserved. © 1998 TSR, Inc. All Rights Reserved. Planescape, the Planescape logo, Advanced Dungeons & Dragons, Torment, the AD&D logo, and the TSR logo are trademarks of TSR, Inc. and are used by Interplay under license. TSR, Inc. is a subsidiary of Wizards of the Coast, Inc. Interplay, the Interplay logo, Black Isle Studios and the Black Isle Studios logo are trademarks of Interplay Productions. Exclusively licensed and distributed by Interplay Productions. All other trademarks and copyrights are property of their respective owners. |