top of page

Scripting Language

"A Scripting Language for Game Engines" is my BSc in Computer Science for Games final year project, as a student of the Sheffield Hallam University.

 

This project is about the creation of a custom scripting language from scratch, oriented to be easy to integrate as part of other existing C++ software.

 

To make a demonstration of the language, an OpenGL game engine has been created with the name "Wolfy2D". The game engine uses an editor made with ImGui library. https://github.com/ocornut/imgui

 

Language features

It contains the following main features:

  • Local and global variables.

  • Variable packs.

  • Functions with multiple parameters.

  • Mathematical operators.

  • Trigonometric functions.

  • Conditionals and loops.

  • Output messages.

 

A bidirectional communication between C++ and Scripting is possible:

  • Register functions from C++ that can be called from a script.

  • Register variables from C++ to be accessed from a script.

  • C++ getters to obtain a script global variable values.

  • Execute scripts functions from C++.

Links to the source code:

# SCRIPT CODE EXAMPLE

VARPACK camera {
   VAR x = "CamX"
   VAR y = 30
}

FUNC Example() {
   VAR iterator = 0
   WHILE (iterator < 5) {
      ExternalFunction(camera.x, camera.y, variable)
      iterator = iterator + 1
   }
   VAR cos = COS(0.0)
   IF (cos <= 100) {
      PRINT("Cos")
   }
}

Language Features

Project Dissertation

Abstract

In the ever-changing video games industry, the matter between failure and success of a project is creating a product to the highest quality by using time most efficiently. To stay ahead of the competition, optimising technology is a must and helps us enhance production pipelines. This saves time and therefore money.


Nowadays, all AAA videogames studios are including scripting languages into their game engines to avoid compilation times and to improve their productivity. This is enabled by features such as testing, level editing and gameplay programming in real-time.


To be a competent developer, it is essential to not only know how to use the tools that were given to you, but it is crucial for one’s personal improvement to be able to create them on your own to fully comprehend the logic behind game development and to contribute efficiently to it.


The following research evolved around the creation of a scripting language, which has been created from scratch and integrated as part of a 2D graphic engine. At its core, an editor was designed to generate a scene by modifying and compiling the code of a script in real-time.

Project Dissertation
bottom of page