AngelScript 101

I decided to look into game scripting a little bit and what came out of it were these short tutorials. I looked at Lua and don't get me wrong, its a great scripting language to use. But I decided on AngelScript for a few reasons and one of the big ones was the syntax was very C++-ish. All projects that include source code were created using Microsoft Visual Studio. Some downloads include Visual Studio .NET 2003 and 2005 projects.

The zip files all contain a pdf document which leads you step by step in adding Angelscript into your project and using AngelScript. I also put together a small document on game scripting. It's by no means exhaustive but is meant for the beginner.

Game Scripting 101 article

Read more...

AngelScript logo

Tutorial #1 - Integrating AngelScript Into Your Application

In this tutorial we will be learning some basic concepts in AngelScript for executing functions. This is where the extending nature of scripting really comes to action. You can extend existing code through the use of creating new functions and properties defined in script.

  • Initialize the script engine
  • Load and read a script file into the script engine
  • Compile or Build the script
  • Read a global variable from the compiled script
  • Set a global (C++) variable with the script value
  • Release the script engine

AngelScript Functions Used in This Tutorial

asCreateScriptEngine, Release, Build, GetGlobalVarIDByName, GetGlobalVarPointer, AddScriptSection

angelscript1 image

Download (Binaries, source code and document file - C++ Console app.)


Tutorial #2 - Working with functions

This tutorial is the second tutorial which can be taking alone. In other words it doesn't build from tutorial #1.

  • Learn what a context is
  • Calling conventions
  • Executing script function(s) from C++
  • Executing C++ functions from scripts
  • Executing script functions with parameters

angelscript1 image

Download (Binaries, source code and document file - C++ Console app.)


Tutorial #3 - Using Scripts in a Simple Game

This tutorial is the third in the series. We develop a very very simple console "game". What you will see is how to hook up some common low level techniques used to query scripts in a main game loop.

  • Synchronizing scripts with a game loop
  • Scripting Events
  • Using AS conditional statements
  • Using multiple script files
  • Using AngelScript script line callback function
  • asIScriptEngine::ExecuteString() convenience function
  • Script function overloading

angelscript1 image

Download (Binaries, source code and document file - C++ Console app.)