Skip to content

katsaii/catspeak-lang

Repository files navigation

Catspeak Logo

The Catspeak Programming Language

A cross-platform scripting language and compiler back-end for GameMaker projects. Use Catspeak to implement, fast and sandboxed modding support by compiling and executing arbitrary user code from files or text prompt.

Developed and maintained by Katsaii.
Logo design by Mashmerlow.

Overview

The spiritual successor to the long dead execute_string function...

// parse Catspeak code
var ir = Catspeak.parseString(@'
  let catspeak = "Catspeak"

  return "hello! from within " + catspeak
');

// compile Catspeak code into a callable GML function
var getMessage = Catspeak.compile(ir);

// call the Catspeak code just like you would any other GML function!
show_message(getMessage());

...without any of the vulnerabilities from unrestricted access to your game code:

var ir = Catspeak.parseString(@'
  game_end(); -- heheheh, my mod will make your game close >:3
');

// calling `badMod` will throw an error instead of calling the `game_end` function
try {
  var badMod = Catspeak.compile(ir);
  badMod();
} catch (e) {
  show_message("a mod did something bad!");
}

Projects Using Catspeak

In no particular order:

(If you have a project you would want to appear here, please get in contact!)

Features

If you run into any issues using this project, please create a GitHub issue or get in contact on Discord through the GameMaker Kitchen server.

📝 Minimal Setup Required

  • Self-contained and ready to use after installation.
  • No need to place a persistent God Object in the first room of your game!

☯ Seamless GML-Catspeak Interoperability

  • Call GML code from Catspeak.
  • Call Catspeak code from GML.
  • Familiar syntax inspired by GML and JavaScript.

🏃‍♀️ Performant Runtime

  • Optimising compiler generates performant code capable of competing with pure GML implementations.
  • At best, Catspeak code will be just as fast as GML.
  • On average, Catspeak code will be 5x slower than GML.

👽 Cross-platform

  • Implemented in pure GML.
  • No external dependencies or platform-specific DLLs.
  • Mods should work on any target platform. (Tested on Windows 10 using: VM, YYC, HTML5, and GMRT)

🔨 Customisable, Sandboxed Runtime Environment

  • Modders cannot gain access to parts of your game you don't want them to.
  • Expose only the functions and resources you feel comfortable with.
  • Impossible for modders to execute malicious code by default.
  • Detects infinite loops and recursion so the sly while true { } doesn't freeze your game, whether intentionally or unintentionally.

💪 Built for Power Users

  • Full compiler back-end documented and available for experimentation.
  • Pre-compile your scripts to JSON, and cache them for later. Skip straight to code generation.
  • Parse your own domain-specific language into Catspeak IR, then let the code generator turn that into a GML compatibile representation:
    • A custom UI language which supports running user-defined functions as button events.
    • A custom data-specification language where certain keywords act as calls to GML functions.
    • A simple shell-script language for a developer console.
    • A custom scripting language for a programming game.

🙀 Cute Name and Mascot

Acknowledgements

Thanks to JujuAdams for giving important feedback on aspects of the implementation, an important step towards making sure Catspeak is battle hardened.

Thanks to TabularElf for donating lots and lots of prototype code for new Catspeak features.

Thanks to anyone spreading the good name of Catspeak.