gamemaker-gml

A set of rules for writing games in GameMaker Language (GML), the programming language used by GameMaker. It covers game objects, events, rooms, data, and performance-minded code.

In plain words
What is it for?
It guides player and enemy states, collision handling, timers, save data, naming, and the structure of GameMaker projects.
Why use it?
It keeps game code organized by separating setup, simulation, drawing, input, collisions, and reusable behavior.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/patrickjs/awesome-cursorrules/gamemaker-gml
Clone the repo
git clone --depth 1 https://github.com/PatrickJS/awesome-cursorrules
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 473 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00473
Opus 5 $0.00000 $0.00236
Sonnet 5 $0.00000 $0.00095
Haiku 4.5 $0.00000 $0.00047

Measured 2d ago against content hash 8fedbae86477, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

gamemaker-gml scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules/gamemaker-gml.mdc · 54 lines

How it starts

The opening of the file, as written. The whole thing — 54 lines — stays where its author put it; the contents beside it link to each section on GitHub.

GameMaker GML Rules

Code Organization

  • Keep object event code short and move reusable behavior into scripts or functions.
  • Use clear prefixes or naming conventions for scripts, objects, sprites, rooms, and globals.
  • Prefer functions over copy-pasted event blocks.
  • Keep create-step-draw responsibilities separate.
  • Put initialization in Create, simulation in Step, and rendering-only work in Draw.

GML Style

  • Use descriptive variable names and avoid one-letter names outside small loops.
  • Prefer local variables with var or function-scoped declarations over unnecessary instance variables.
  • Use constants, enums, and macros for repeated identifiers, layer names, states, and collision groups.
  • Guard optional instance references with instance_exists.
  • Keep global state minimal and document it.

Gameplay Architecture

  • Use finite state machines for player, enemy, UI, and game-flow states.
  • Keep collision logic explicit and deterministic.
  • Separate input collection from action execution.
  • Use alarms, timelines, or explicit timers consistently; do not mix patterns without reason.
  • Store save data through structured maps/structs and version the save format.

Performance

  • Avoid expensive searches such as broad instance_find or repeated collision scans in every Step event.
  • Cache frequently used asset IDs, layer IDs, and object references when safe.
  • Destroy data structures when no longer needed.
  • Use object pooling for frequent projectiles, particles, or short-lived effects when allocation becomes costly.
  • Profile before optimizing and keep hot-path code simple.

Debugging and Testing

  • Add debug overlays for collision boxes, state, velocity, and AI decisions when useful.
  • Use assertions or explicit guard clauses for impossible states.
  • Test room transitions, pause/resume, save/load, and controller/keyboard input separately.
  • Keep reproducible test rooms for complex mechanics.

Common Mistakes

  • Do not put game logic in Draw events.
  • Do not create data structures without destroying them.
  • Do not rely on room editor instance order for critical behavior.
  • Do not hardcode magic numeric state IDs.

Read the full file on GitHub · 54 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 54 lines · 0 tokens per session scan A 8fedbae86477

Subscribe to this mod's changes

gamemaker-gml is a cursor rule published in the GitHub repository PatrickJS/awesome-cursorrules (40,694 stars, last pushed 3mo ago), licensed CC0-1.0. It costs nothing until one of its globs matches a file; then it loads 473 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.