Game Development Reference
In-Depth Information
'
stuff, which was written by a third party. There
s a lot of code there just to allow you
to pass in an arbitrary function that matches a particular signature. In most scripting
languages, such a system would be trivial. Functions are usually first-class objects,
which means they are treated like any other variable. You can pass them around,
assign them to other variables, and so on. An event system implemented purely in
Python or Lua probably wouldn
ttakememorethananhourtowrite.
Another big advantage to scripts is that they can usually be reloaded at runtime.
Scripts are loaded from the resource cache just like any other asset and interpreted
at runtime. It ' s pretty easy to imagine a system that would let you change a script
while the game was running and type a console command that would reload your
script right there. You wouldn
'
t even have to shut down the game! When I was
developing the minigames in Rat Race, this is exactly what we did. It made iterating
on those games extremely easy. I could play the minigame and fix issues as I found
them and then reload the script and do it again.
'
The Poster Child for Rapid Prototyping
When I worked at Planet Moon, there was a programmer who was in charge of
the camera system for DrawntoL fe.HeimplementedtheentirethinginLua
very quickly, moving the math functions to C++ as needed. This allowed him to
iterate with the designers very quickly, often making changes and reloading the
scripts while they were sitting right there. I think we went through a dozen
different camera schemes, all very different from each other. When the design
finally solidified, he moved most of it down to C++ for performance reasons.
This is a great example of what rapid prototyping buys you. If he had started in
C++, he wouldn
'
t have been able to iterate nearly as quickly.
Design Focused
An interesting side effect to scripting languages is that they tend to be a bit more
designer friendly. At Planet Moon, we had special scripts that designers were allowed
to modify. All of the AI on Drawn to Life, for instance, was configured through these
designer-facing scripts. This is a very powerful concept. By giving your designers
access to the scripting system, you give them the ability to prototype things in the
game without having to involve you directly.
The nature of most scripting languages enables you to take this a step further and
attach snippets of code to objects. For example, you could load up a creature and
pass in an AI script. You could even expose the scripts to the end-users and allow
them to mod your game. World of Warcraft does this with their HUD layout; with
some simple Lua script and XML, you can write your own custom UI.
 
 
Search WWH ::




Custom Search