Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

gamemaker-expert游戏制作专家

Agent Skill

gamemaker-expert 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

372

周安装

16

GitHub Stars

2

下载量

131
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:gamemaker-expert(游戏制作专家)
来源仓库:https://github.com/leihaht/gamemaker-skills
仓库路径:skills/gamemaker-expert
安装命令:
npx skills add https://github.com/leihaht/gamemaker-skills --skill gamemaker-expert
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/leihaht/gamemaker-skills --skill gamemaker-expert

简介

gamemaker-expert 用于查找、检索和筛选相关信息。

  • 专注于 GameMaker 相关开发资源的查询与推荐。
  • 适用于 Codex、Claude、Cursor、Gemini CLI 等宿主环境。
  • 安装前应核实权限、维护状态及是否涉及网络访问或命令执行。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

GameMaker Expert

Overview

This skill provides comprehensive GameMaker Studio 2 and GML (GameMaker Language) expertise for all GameMaker projects. It covers everything from basic object creation to advanced topics like shader programming, networking, and platform-specific development.

When to use this skill:

  • Working with .gml files (GML scripts and events)
  • Creating or modifying .yy files (object definitions, sprite definitions, etc.)
  • Editing .yyp project files
  • Creating GameMaker objects, scripts, or assets
  • Debugging GameMaker compile errors or runtime issues
  • Implementing GameMaker features (drawing, collision, networking, etc.)
  • Optimizing GameMaker performance
  • Any GameMaker Studio 2 development task

Official GameMaker Manual

PRIMARY REFERENCE: Always consult the official GameMaker Manual for comprehensive, up-to-date documentation: https://manual.gamemaker.io/monthly/en/

Key Manual Sections

- Variables, data types, operators, keywords, control flow

- All built-in functions organized by category (drawing, math, strings, instances, etc.)

- Object properties, event system, parent-child relationships

- Sprite editor, collision masks, animations

- ds_list, ds_map, ds_grid, ds_priority, ds_queue, ds_stack

- File I/O, JSON, buffers, directories

When to use the official manual:

  • Looking up function signatures and parameters
  • Understanding platform-specific behavior
  • Checking latest syntax changes for your IDE version
  • Detailed explanations of GameMaker features

Additional References

For advanced architectural guidance:

- GameMaker-specific patterns (Service Locator, Command Pattern, Event-Driven Flow) - SOLID principles adapted for GML - Encapsulation patterns with manager constructors - Performance patterns and anti-patterns

- Step-by-step guide for creating manager constructors - Public API design patterns - Reference exposure pattern for backwards compatibility - Cleanup responsibilities and testing strategies

- Complete list of GameMaker reserved variables - Position, sprites, physics, paths, timelines categories - Deprecated globals (health, score, lives) - Safe alternatives and validation checklist

- Language syntax, operators, data types

- Frequent mistakes and solutions

- Cheat sheet for common patterns

When to use these references:

  • Designing manager constructors for game-wide state
  • Avoiding conflicts with GameMaker built-in variables
  • Implementing encapsulation patterns in GML
  • Understanding __ prefix convention for pseudo-private members
  • Learning SOLID principles in GameMaker context
  • Finding architectural patterns for maintainable code

Core GameMaker Workflows

Object Creation Workflow (CRITICAL)

Creating GameMaker objects requires completing ALL four steps. Missing any step will cause the object to not appear in the IDE or fail to compile.

Step 1: Create Object Directory

objects/objYourObjectName/

Naming Convention:

  • Start with obj prefix
  • Use PascalCase (e.g., objPlayer, objEnemyMelee, objInventoryUI)
  • Descriptive name indicating purpose

Step 2: Create Event Files

Create .gml files for each event your object needs:

Common Events:

Event FileEvent TypeWhen to Use
Create_0.gmlCreate EventInitialize variables (ALWAYS include)
Step_0.gmlStep EventUpdate logic every frame
Draw_0.gmlDraw EventRender in-world graphics
Draw_64.gmlDraw GUI EventRender UI overlays
Destroy_0.gmlDestroy EventCleanup when destroyed
Collision_objX.gmlCollision EventHandle collisions

Event Naming Rules:

  • Create: Create_0.gml
  • Step: Step_0.gml
  • Draw: Draw_0.gml
  • Draw GUI: Draw_64.gml (NOT Draw_GUI_0.gml!)
  • Collision: Collision_objTargetName.gml

Example Create_0.gml:

/// objPlayer Create Event
// Initialize player variables

// Movement
move_speed = 4;
direction = 0;

// Stats
health = 100;
max_health = 100;

// State
is_moving = false;

show_debug_message("objPlayer created");

Step 3: Create.yy File (REQUIRED)

File: objects/objYourObjectName/objYourObjectName.yy

Template:

{
  "$GMObject":"",
  "%Name":"objYourObjectName",
  "eventList":[
    {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
    {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
    {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
  ],
  "managed":true,
  "name":"objYourObjectName",
  "overriddenProperties":[],
  "parent":{
    "name":"Objects",
    "path":"folders/Objects.yy",
  },
  "parentObjectId":null,
  "persistent":false,
  "physicsAngularDamping":0.1,
  "physicsDensity":0.5,
  "physicsFriction":0.2,
  "physicsGroup":1,
  "physicsKinematic":false,
  "physicsLinearDamping":0.1,
  "physicsObject":false,
  "physicsRestitution":0.1,
  "physicsSensor":false,
  "physicsShape":1,
  "physicsShapePoints":[],
  "physicsStartAwake":true,
  "properties":[],
  "resourceType":"GMObject",
  "resourceVersion":"2.0",
  "solid":false,
  "spriteId":null,
  "spriteMaskId":null,
  "visible":true,
}

Event Type Numbers:

EventeventTypeeventNum
Create00
Step30
Draw80
Draw GUI864
Destroy10

Important Fields:

  • %Name and name: Must match object name exactly
  • eventList: Include entry for each.gml file created
  • parentObjectId: Set to parent object resource path if using inheritance (e.g., {"name":"objCreature","path":"objects/objCreature/objCreature.yy"})
  • persistent: Set to true if object should persist across rooms
  • visible: Set to false for controller objects with no sprite

Step 4: Register in Project File (REQUIRED)

File: YourProject.yyp

Location: Find the "resources":[ array

Add Entry (alphabetically sorted):

{"id":{"name":"objYourObjectName","path":"objects/objYourObjectName/objYourObjectName.yy",},},

Example:

"resources":[
  {"id":{"name":"objInventoryUI","path":"objects/objInventoryUI/objInventoryUI.yy",},},
  {"id":{"name":"objPlayer","path":"objects/objPlayer/objPlayer.yy",},},
  {"id":{"name":"objYourObjectName","path":"objects/objYourObjectName/objYourObjectName.yy",},},
]

CRITICAL: Missing this step will cause compile errors like "object not found".

GML Language Essentials

Variable Scope

// Local variable (function/script scope only)
var _local_var = 100;

// Instance variable (attached to object instance)
instance_var = 50;

// Global variable (accessible everywhere)
global.game_state = "playing";

Best Practice: Start local variable names with underscore _ for clarity.

Data Types

  • Real: Numbers var _x = 100; var _pi = 3.14159;
  • String: Text var _name = "Player";
  • Boolean: True/False var _is_alive = true;
  • Array: var _items = [1, 2, 3]; var _nested = [[1,2], [3,4]];
  • Struct: var _player = {x: 0, y: 0, health: 100};
  • Undefined: undefined (check with is_undefined())
  • Pointer/ID: References to instances, data structures, assets

Operators

Arithmetic: + - * / div mod Comparison: ==!= > < >= <= Logical: && ||! ^^ (and, or, not, xor) Bitwise: & | ^ << >> ~ Ternary: condition? true_value: false_value

CRITICAL - Ternary Operator Chaining:

Chained ternary operators MUST wrap nested conditions in double parentheses:

// ✅ CORRECT
var _result = condition_a ? "foo" : ((condition_b ? "bar" : "baz"));

// ❌ WRONG (will cause compile error in some versions)
var _result = condition_a ? "foo" : condition_b ? "bar" : "baz";

Reference: https://manual.gamemaker.io/beta/en/GameMaker_Language/GML_Overview/Expressions_And_Operators.htm

Control Flow

// If statement
if (condition) {
    // code
} else if (other_condition) {
    // code
} else {
    // code
}

// Switch statement
switch (value) {
    case 1:
        // code
        break;
    case 2:
    case 3:
        // code for 2 or 3
        break;
    default:
        // code
        break;
}

// For loop
for (var _i = 0; _i < 10; _i++) {
    show_debug_message(_i);
}

// While loop
while (condition) {
    // code
}

// Repeat loop
repeat (10) {
    // code
}

// With loop (iterate instances)
with (objEnemy) {
    health -= 10;
}

Data Structures & Memory Management

Structs (Lightweight - Recommended)

// Create struct (no manual cleanup needed!)
var _player = {
    name: "Hero",
    health: 100,
    max_health: 100,
    level: 1
};

// Access properties
show_debug_message(_player.name); // "Hero"
_player.health -= 10;

// Check if property exists
if (variable_struct_exists(_player, "mana")) {
    // property exists
}

// Dynamic property access
var _prop_name = "health";
var _value = _player[$ _prop_name]; // Same as _player.health

When to use: Lightweight data containers, configuration data, simple key-value pairs. Benefits: No manual cleanup required, garbage collected automatically.

ds_list (Dynamic Array)

// Create
var _list = ds_list_create();

// Add items
ds_list_add(_list, "apple", "banana", "cherry");
ds_list_insert(_list, 1, "orange"); // Insert at index

// Access
var _item = _list[| 0]; // "apple"
var _size = ds_list_size(_list);

// Iterate
for (var _i = 0; _i < ds_list_size(_list); _i++) {
    show_debug_message(_list[| _i]);
}

// CRITICAL: Always destroy when done!
ds_list_destroy(_list);

When to use: Large collections, need specific list operations, performance-critical code. CRITICAL: Must manually destroy with ds_list_destroy() or memory leak will occur!

ds_map (Key-Value Pairs)

// Create
var _map = ds_map_create();

// Add items
_map[? "name"] = "Player";
_map[? "health"] = 100;

// Access
var _hp = _map[? "health"]; // 100

// Check if key exists
if (ds_map_exists(_map, "mana")) {
    // key exists
}

// Iterate
var _key = ds_map_find_first(_map);
while (!is_undefined(_key)) {
    show_debug_message(_key + ": " + string(_map[? _key]));
    _key = ds_map_find_next(_map, _key);
}

// CRITICAL: Always destroy when done!
ds_map_destroy(_map);

When to use: Legacy code, need specific map operations, integration with existing ds_map code. CRITICAL: Must manually destroy with ds_map_destroy() or memory leak will occur!

Recommendation: Use structs instead of ds_map when possible - they're simpler and don't require manual cleanup.

Memory Leak Prevention

Data structures that MUST be destroyed:

  • ds_list_destroy(_list)
  • ds_map_destroy(_map)
  • ds_grid_destroy(_grid)
  • ds_priority_destroy(_priority)
  • ds_queue_destroy(_queue)
  • ds_stack_destroy(_stack)
  • surface_free(_surface)
  • buffer_delete(_buffer)

Pattern for cleanup in Destroy event:

/// objPlayer Destroy Event
// Clean up data structures

if (ds_exists(inventory_list, ds_type_list)) {
    ds_list_destroy(inventory_list);
}

if (surface_exists(shadow_surface)) {
    surface_free(shadow_surface);
}

File System & Persistence

datafiles/ Folder (Included Files)

CRITICAL LIMITATION: Some GameMaker versions only support root-level files in datafiles/ - NO subdirectories!

✅ CORRECT:
datafiles/config.json
datafiles/items.json
datafiles/level_data.json

❌ WRONG (may not work in all versions):
datafiles/configs/game_config.json
datafiles/data/items/weapons.json

Registration Required: Every file in datafiles/ must be registered in the .yyp project file:

{"$GMIncludedFile":"","%Name":"config.json","CopyToMask":-1,"filePath":"datafiles","name":"config.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},

JSON Files

// Load JSON from datafiles/
function load_json_file(_filename) {
    if (!file_exists(_filename)) {
        show_debug_message("ERROR: File not found: " + _filename);
        return noone;
    }

    var _file = file_text_open_read(_filename);
    var _json_string = "";
    while (!file_text_eof(_file)) {
        _json_string += file_text_read_string(_file);
        file_text_readln(_file);
    }
    file_text_close(_file);

    return json_parse(_json_string);
}

// Save JSON to working directory
function save_json_file(_filename, _data) {
    var _json_string = json_stringify(_data);
    var _file = file_text_open_write(_filename);
    file_text_write_string(_file, _json_string);
    file_text_close(_file);
}

Save File Locations

// Working directory (platform-dependent save location)
var _save_path = working_directory + "savegame.json";

// Game save ID (unique folder for your game)
// On Windows: %LOCALAPPDATA%/[game_save_id]/
var _save_id = game_save_id;

Event System & Execution Order

Event Execution Order (Per Frame)

  1. Begin Step - Before main logic
  2. Alarm Events - Countdown timers
  3. Keyboard/Mouse Events - Input detection
  4. Step - Main update logic
  5. Collision Events - After movement
  6. End Step - After all logic
  7. Draw - Render in-world graphics
  8. Draw GUI - Render UI overlays
  9. Draw End - Post-processing

Persistent Objects

Set persistent: true in .yy file to survive room transitions.

CRITICAL: When using persistent objects with event handlers, clear handlers when re-entering rooms to avoid duplicate registrations!

// rmGameplay Room Creation Code
// Clear handlers to prevent duplicates
global.input_controller.clear_all_handlers();

// Register handlers fresh
global.input_controller.register_handler("ACTION", function(_cmd) {
    // handle action
});

Drawing & Graphics

Basic Drawing

// Draw sprite
draw_sprite(spr_player, image_index, x, y);
draw_sprite_ext(spr_player, image_index, x, y, scale_x, scale_y, rotation, color, alpha);

// Draw text
draw_text(x, y, "Hello World");
draw_set_font(fnt_arial);
draw_set_color(c_white);
draw_set_halign(fa_center);
draw_set_valign(fa_middle);

// Draw shapes
draw_rectangle(x1, y1, x2, y2, outline);
draw_circle(x, y, radius, outline);
draw_line(x1, y1, x2, y2);

Surfaces (Render Targets)

// Create surface
if (!surface_exists(shadow_surface)) {
    shadow_surface = surface_create(room_width, room_height);
}

// Draw to surface
surface_set_target(shadow_surface);
draw_clear_alpha(c_black, 0);
// ... draw operations ...
surface_reset_target();

// Draw surface to screen
draw_surface(shadow_surface, 0, 0);

// CRITICAL: Free surface when done
if (surface_exists(shadow_surface)) {
    surface_free(shadow_surface);
}

Performance Optimization

Draw Call Optimization

  • Minimize draw calls by batching sprites onto texture pages
  • Use layers for static content (backgrounds, tiles)
  • Cache expensive calculations (don't recalculate in Draw event)
  • Avoid creating/destroying instances in Draw events

Collision Optimization

  • Use broad-phase distance checks before precise collision
  • Set appropriate collision masks (precise vs bounding box)
  • Use collision layers and groups
  • Consider using instance_position() instead of place_meeting() when you need the instance

Memory Management

  • Always destroy data structures when done
  • Free surfaces when no longer needed
  • Delete buffers after use
  • Clean up in Destroy events

Common Pitfalls & Solutions

See COMMON_PITFALLS.md for comprehensive troubleshooting guide.

Quick Reference

Object Creation Issues:

  • Missing.yy file → Object doesn't appear in IDE → Create.yy file using template above
  • Missing.yyp registration → Compile error "object not found" → Add entry to.yyp resources array
  • Wrong event name → Event doesn't trigger → Use exact names (Draw_64.gml, NOT Draw_GUI_0.gml)

Memory Issues:

  • Data structure leaks → Memory usage grows → Always call ds_destroy functions
  • Surface leaks → Memory usage grows → Always call surface_free()
  • Forgotten Destroy event → Resources not cleaned up → Add Destroy event with cleanup code

File System Issues:

  • datafiles/ subdirectory → File not found error → Move files to datafiles/ root level
  • Missing.yyp registration → Included file not found → Register file in.yyp

GML Syntax Issues:

  • Ternary chaining → Compile error → Wrap nested conditions in double parentheses
  • Variable scope → Undefined variable → Check local vs instance vs global scope
  • Array bounds → Index out of range → Check array size before accessing

Advanced Topics

For in-depth coverage of advanced features, see:

Shader Programming (GLSL ES)

When to use shaders:

  • Advanced visual effects (lighting, blur, outline, color grading)
  • Per-pixel operations (custom rendering effects)
  • Performance optimization (GPU-based calculations)

Basic shader workflow:

  1. Create shader asset in IDE
  2. Write vertex shader (.vsh) and fragment shader (.fsh)
  3. Set shader: shader_set(shd_outline);
  4. Pass uniforms: shader_set_uniform_f(u_time, current_time);
  5. Draw sprites/surfaces
  6. Reset shader: shader_reset();

See ADVANCED_TOPICS.md for GLSL ES syntax, examples, and common shader patterns.

Networking & Multiplayer

When to use networking:

  • Multiplayer games (client-server, peer-to-peer)
  • Online leaderboards
  • HTTP API integration
  • Cloud save systems

Async HTTP example:

// Send GET request
var _request_id = http_get("https://api.example.com/data");

// In Async HTTP event
var _id = async_load[? "id"];
if (_id == _request_id) {
    var _status = async_load[? "status"];
    if (_status == 0) {
        var _result = async_load[? "result"];
        var _data = json_parse(_result);
        // Process data
    }
}

See ADVANCED_TOPICS.md for network sockets, buffers, multiplayer architecture, and synchronization patterns.

Platform-Specific Development

Mobile (iOS/Android):

  • Touch input: device_mouse_x_to_gui(), device_mouse_y_to_gui()
  • Virtual buttons: virtual_key_add()
  • Sensors: device_get_tilt_x(), device_get_tilt_y()

Console (PlayStation, Xbox, Nintendo Switch):

  • Gamepad support: gamepad_button_check(), gamepad_axis_value()
  • Platform detection: os_type, os_get_config()

HTML5:

  • Browser integration: clickable_add(), clickable_set_style()
  • JavaScript execution: js_runner_eval()

Desktop (Windows, macOS, Linux):

  • File dialogs: get_open_filename(), get_save_filename()
  • Window control: window_set_fullscreen(), window_set_size()

See ADVANCED_TOPICS.md for detailed platform-specific development guides.

Resources

This skill includes comprehensive reference documentation:

references/

GML_REFERENCE.md (~1500 lines)

  • Complete GML function reference organized by category
  • Drawing, math, strings, instances, rooms, data structures, files, networking, shaders, surfaces, particles, audio
  • Code patterns for common tasks (inventory, state machines, dialogue, save/load, camera systems)
  • Struct vs Object decision guidance
  • Constructor patterns and method variables

ARCHITECTURE_PATTERNS.md (~500 lines)

  • GameMaker-specific architectural patterns (Service Locator, Command Pattern, Event-Driven Flow, Procedural Logic, Data-Driven Design)
  • Why NOT MVC/MVP for game engines (event-driven vs request/response architecture)
  • SOLID principles in GML context (SRP, OCP, LSP, ISP, DIP with code examples)
  • Design principles (DRY, KISS, YAGNI)
  • Performance patterns (hot path optimization, struct vs ds_map, lookup maps)
  • Anti-patterns to avoid (global abuse, deep hierarchies, function redefinition)

COMMON_PITFALLS.md (~800 lines)

  • Object creation issues (missing.yy, missing.yyp registration, wrong event names)
  • File system issues (datafiles/ subdirectories,.yyp registration, paths)
  • GML syntax traps (ternary operators, variable scope, array bounds, undefined access)
  • Memory management (ds_* leaks, surface leaks, buffer leaks, cleanup patterns)
  • Performance issues (draw optimization, collision optimization, instance management)
  • Networking issues (async events, buffer types, timeouts, platform differences)
  • Shader issues (GLSL ES compatibility, uniform naming, texture sampling)

QUICK_REFERENCE.md (~600 lines)

  • Event type/number complete table with execution order
  • Keyboard constants (vk_* constants, ord() usage, key press vs check)
  • Mouse constants (mb_* constants, mouse event types, device_mouse_* functions)
  • Common GML patterns (distance checks, direction calculation, collision checks, random ranges)
  • Color functions (constants, make_color_*, color_get_*, merge_color)
  • IDE version reference (common versions, features, compatibility notes)

ADVANCED_TOPICS.md (~1000 lines)

  • Shader Programming (GLSL ES syntax, vertex/fragment shader examples, uniforms, multi-pass techniques, debugging)
  • Networking Patterns (client-server architecture, lobby systems, packet structure, latency compensation, buffers)
  • Platform-Specific Development (mobile touch/sensors, console gamepad/achievements, HTML5 browser API, desktop OS interactions)
  • Advanced Graphics (surfaces, lighting systems, normal maps, particles, tilemaps, cameras)
  • Performance Profiling (debug overlay, bottleneck identification, memory profiling, draw call reduction, code profiling)

Remember: This skill provides guidance and reference. Always consult the official GameMaker Manual for the most up-to-date and comprehensive documentation!

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.33%
按下载量换算48

Claude

28.29%
按下载量换算37

Cursor

21.53%
按下载量换算28

Gemini CLI

9.19%
按下载量换算12

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills