Creating a Programming Language for your Game Engine

Something I've recently been considering is writing my own programming language for my own video game engine in the future. Now, I know creating a programming language is hard. And some people will probably say "why in the heck would you ever want to create your own programming language?", especially when many others exist. However, it is actually fairly common for many game companies to create their own game engine and their own programming language, especially companies that make Massively Multiplayer Online Role Playing Games (MMO for short). For example, the MMO Runescape has its own scripting language called RuneScript, which was written specifically for AI interaction among your character and non-player characters (NPCs) and for quest logic (such as having the required items before the next quest task).

When discussing programming languages, it is important to know the difference between a scripting language vs. a compiled language. A scripting language is one that is usually interpreted. Interpreted languages aren't translated from a programming language to a target program. An interpreted language takes the source code directly and any user input and runs it through an interpreter, which reads the code statement-by-statement and processes the input. If there are no errors, the interpreter produces corresponding output from the code and input provided. Scripting languages are also used for "gluing together" functionality of an already created piece of software. A compiled language is one that takes the source code of a program and runs it through a compiler, which is the "translator" of the following code into a target program as output. Usually the target program is an executable machine-language program, but the target program could be practically any language you specify. Another one of the compiler's jobs is to detect any errors and report them while translating. Compilers are typically considered to be way faster than interpreters because machine-language programs are faster at mapping inputs to outputs. However, interpreters are better for debugging purposes and error diagnostics since they run statement-by-statement.

This is just a brief introduction to the idea of compilers and isn't extremely specific in any way! If you are interested in this subject, pick up the Dragon Book, which is "Compilers: Principles, Techniques, and Tools" by Alfred v. Aho. I have yet to read the entire book, but I have read through chapter one.

As I was digging around about two months back for information on how to create my own programming language, I found this link to gamasutra.com, which has a TON of really interesting video gaming articles! The link below was written on October 3rd, 1997 by Robert Huebner, a programmer who worked on creating a compiled programming language called COG for the game Jedi Knight: Dark Forces II. Many of these articles are from the 1990's and early 2000's, and they're usually multiple pages filled with video game knowledge, old or new! I've learned a lot of really cool computer programming techniques from this website, and I highly recommend reading them if you're an avid gamer!

To prevent this post from getting super long, I will save information about the COG language in the article for tomorrow

Anyway, enough of my blabble! Here is the link!

https://www.gamasutra.com/view/feature/131641/adding_languages_to_game_engines.php

 

Jedi Knight: Dark Forces II gameplay screenshot.All rights belong to LucasArts.

Jedi Knight: Dark Forces II gameplay screenshot.

All rights belong to LucasArts.