Tuesday, January 29, 2019

When would I use "scripts" or "scripting" in a game, as opposed to the core language?


The terms scripts and scripting appear to be used interchangeably on the Game Development Stack Exchange, but other than reading questions about a scripting language choice, I don't understand the relationship between scripts and scripting, and the core language. What does a script typically do, when would it be used, and are scripts in some contexts (as defined by game programmers) different than a scripting language?



Answer



Scripts are written for a scripting language. People can use the words in slang sentences to get the muddling that you are referring to but ask anyone for the definitions of Script, Scripting and Scripting Language and you will get something like: Scripting is the act of writing Scripts using a Scripting Language.



When you embed a scripting language into a game engine, or core language as you are referring to, you are exposing not only the objects within the game engine but also allowing logic to be written for the game engine. One other thing of note is that this turns your game into kind of a virtual machine, as scripting languages seldom compile down to machine language and are instead put into a form of byte code and interpreted at run time by your game engine.


This has some huge benefits to the development team, a few of which you can find listed next:



  • Scripting languages are usually memory managed so you do not have to worry about allocations

  • They are usually a loosely typed language that removes the need to make sure you are using the variable type for what you are doing, just make a variable and go with it.

  • The languages themselves are often very simplistic while delivering quite a bit of control to people who are not programmers

  • Altering scripts does not require the core engine to be recompiled.

  • Scripting vs Coding often reduces the time required for very iterative tuning of game logic.

  • Depending on design and language, you can often reload a script while the game is running for even easier tuning/testing.



I am sure the list can keep going on and on I am sure, especially when you get into specialized game types and how scripting can help define group formation rules for moving groups of units in an RTS or how you can create a UI's logic in a scripting language to provide an extensible UI to your end-users and the like.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...