Introduction to GameMonkey Script Part 1
Language Introduction
IntroductionThis article will introduce you to the GameMonkey Script (abbreviated to GM Script or simply GM) language and API and how it can be used in your own games. It begins with a short introduction to the language and how it compares to Lua, the most similar language to GM Script and also a popular choice in game development. The article will then show you the basic features of the script language itself and, in the second part, teach you how to bind the virtual machine with your game applications. This article does not intend to be a comprehensive tutorial on using GameMonkey Script, nor will it cover the advanced topics and techniques that can be employed when scripting, however it will be enough to whet your appetite for GM Script and provide you with enough information to explore the language on your own. You can follow along with the examples in the code by experimenting with the gme.exe program that ships with standard GameMonkey distributions and running the example scripts that are supplied with this article. PrerequisitesIn order to get the most of this article and indeed GameMonkey script, it is assumed that:
What Is GameMonkey Script?Scripting in games has long been an important technique for developers to employ. Scripting allows you to separate your game logic from your engine code and gives you the ability to tweak your content without time-consuming rebuilds of the entire engine. Some games, for example Unreal, have vastly complicated scripting environments in place which allow you to create graphical effects and perform almost every action imaginable in your game. In the past it was popular for game developers to 'roll their own' scripting language that was tied directly into their game systems, however language parsing and virtual machine design is a complex subject, meaning that many developers are now choosing to use a third party scripting language. Influenced by the popular embedded scripting language Lua, Matthew Riek and Greg Douglas set about creating their very own language for a game project whilst employment at Auran Software; and thus GameMonkey Script was born. Created specifically for game scripting, GM Script is written with speed and simplicity in mind. The original version of GM Script has been used in several commercial ventures, from PC games to console games, and is growing in popularity amongst hobby game developers. GameMonkey Script can be downloaded from http://www.somedude.net/gamemonkey. At the time of writing, the most recent version is 1.24a. Comparison to LuaAs GameMonkey script was originally inspired by Lua, it is useful to highlight the differences between the two environments.
Lua has been used successfully in many commercial and amateur game projects, however it can be difficult to use without a third party binding library as its stack-access method can be confusing for people new to scripting. GameMonkey Script aims to address the complexities of Lua whilst still maintaining its inherent power through flexibility. |