@Katsaii presents:
Catspeak
A Domain-specific Language for Adding Mod Support to GameMaker Studio 2.3+ Games
Homepage | Wiki | Installation
License
View the full license here. If you use this tool, please make sure to credit me as "Katsaii" somewhere, e.g. under Special Thanks. Feel free to link to my homepage or Twitter.
Sorry, what was is it again?
Catspeak is an entire programming language, compiler, and virtual machine designed for, and written in, GameMaker Studio 2.3!
If you find any bugs, or want to suggest a feature, please open an issue on the GitHub page: https://github.com/NuxiiGit/catspeak-lang/issues.
Features
- Support for strings (
"hello world"
) and numerical values (12.5
) - Support for array (
[1, 2, 3]
) and object ({ .a : "this is a", .b : "this is b" }
) literals - Groupings of expressions using parenthesis, or the use of the unary grouping operator
:
- Variable assignment using the
=
operator - Control-flow statements such as
if
,while
,for
,break
, andcontinue
- Return values using the
return
keyword - Call GameMaker functions using the
run
keyword or by passing parameters in a Lisp-stylef arg1 arg2 arg3
... - Access elements of collections using ordered (
a.[i]
) and unordered (a.{"key"}
ora.key
) index operators - Create new functions using the
fun
keyword and export them to GML usingextern
- Entirely sandboxed runtime environment, only expose functions to modders that you want to expose
- Execute large and complex programs asynchronously over multiple steps
Why did you make this?
I wanted to.
Why should I use this?
Catspeak is able to load large JSON files over multiple frames. Typically the built-in
json_parse
function will freeze the game until the entire contents of the file are parsed, CatSpeak instead parses, compiles, and evaluates programs over multiple steps, avoiding the frustrating game freezing.Is that the only reason?
No. Catspeak is a Turing-complete, imperative programming language that can be customised with additional operators and functions. For instance, a set of functions could be exposed to modders that they can call from within the Catspeak runtime environment. These functions may add additional items to the game, or set the position of existing objects in the room.
Is it safe to use?
Yes! Script IDs and Instance IDs cannot be accessed by Catspeak programs unless a developer wills it. So, trying to access a global variable using
(-4).sneakyGlobal
is not possible unless the developers of the game enable that feature. All exposed scripts are bound as methods, so it is impossible to call an arbitrary script from within Catspeak without the developer intentionally (or unintentionally) exposing those tools to modders.Examples
A sweet couple of example programs written in Catspeak:
Code:
-- arrays and loops
planets = [
"Venus"
"Earth"
"Mars"
]
n = 3
i = 0
while (i < n) {
planet = planets.[i]
print planet -- Venus
i = i + 1 -- Earth
} -- Mars
Code:
-- structs
position = {
.x : 12
.y : -3
}
return : -position.x * position.{"y"} -- 36
Last edited: