Sunday, 24 November 2013

GDC Vault: Scripting, what I learned, and how it can be applied to Iron Heart.

When developing a game, it is absolutely critical for your programmers and designers to work closely together on key elements of the project. Whether this be camera functionality, weapon damage, or AI, the team has to come together in-order to create the most functional and fun game possible. However, because many designers are not programmers and cannot understand the complicated code of game logic, another method has to be used, and this is scripting and domain specific languages. Recently, we watched a very informative video from GDCvault called, "Scripting and AI: Flirting with the Dark Side". In this video it details how important scripting is to the game development process. This blog will focus on what I learned, and how I can apply to Iron Heart in the future.

Fact: programming takes time. Utilizing scripting languages for architecture can save months of development time, and save a lot of stress on developers shoulders. Scripting can be divided into three parts: component scripts, system scripts, and data scripts. Component scripts act like a soup where we have several components that are either coded or scripts.


Other components may also be split into script or code, as the gameplay and design relationship of components becomes more well understood. Component scripts act sort of as a middle ground where we can tie together different components depending on what you're trying to get. These components tend to be grouped together like a soup, if you want to think of it visually. System scripts are organized into boids which the system can access with ease. Data scripts are important because they can save out the state of the script, drive the system with data, and define the structure for both.

There are several benefits to scripting. As mentioned before, it can cut down production time significantly. But more important, it ties together programmers and designers closer. The advantage of this is that you get a level of cohesion and production efficiency that you could not get if you simply hard coded the system. For example, James Everett, a designer at Ubisoft who worked on Splinter Cell: Blacklist had this very same problem, where the hard coded stuff was to hard for him to work with. So the programmers developed easy to use scripting systems that would update any changes James made live into the program. It sped up production by months, even if it wasn't the most efficient system.

General Purpose Implementations

While all this is fine and dandy, how can I apply the magic of scripting to a game like Iron Heart?

Most scripts normally deal with game logic. They can be used to determine enemy stats like health, damage, etc, and can be used to determine how much damage is done to an enemy upon being hit, and other things. The advantage of this is that the designer knows exactly what he is changing (high designer expressiveness) and these calculations are not expensive in the least bit, so it doesn't adversely affect performance. So for implementation, the majority of my scripts would be game logic. Examples can include:

  • Determine enemy stats, damage, health, inventory space, etc
  • Can be used to determine level layout for spawn locations, certain item locations, etc.
  • Useful for determining particle effects, but not necessarily calculation them.
  • GUI's
  • Missions
  • Other important game triggers
As you can see through this list, scripts being a glue between components is a similarity all of these share. The game logic sits between different systems of the game and help develop a  fluid design environment. With this, we can also develop a DSL (domain specific language) for our game. 

Domain Specific Languages

A DSL is a language designer to be highly adept at solving a specific class of problems (not general-purpose). While this can be good for solving various different problems, it is excellent for AI. It is good for AI because the program code will be cleanest when implemented in the same terms that domain specialists use when thinking about problems in the domain. It also helps reduce bugs as we are coding exactly what we need, which in return helps maximize productivity by removing details and features that do not pertain to solving the problem. What is also important to note is that AI work typically consists of solving a limited set of problems using a handful of well known techniques. By developing specialized tools and having limited features to keep the code focused, we can avoid a lot of low level issues like:
  • Allows us to break away from just using C++, which gives several advantages.
  • No manual memory management, we don't have to worry about dynamic memory allocation.
  • No complex syntax, no complications like undefined behavior.
  • Less bugs!
  • Accessible for designers and junior coders (which in turn means the project can be more productive).
Conclusion

The GDC Vault presentation covered a lot of material but I learned a lot from it. Currently, Iron Heart makes very little use of scripts, but in the future I will be sure to develop scripting systems to handle key areas of the game that will allow designers to have more input in the games production. It will allow use to develop a glue that will increase production time (and subsequently better the end product), even if it costs us a little bit of efficiency. 

No comments:

Post a Comment