HT Games

Creating Cheat-Like Features in GameMaker Studio 2: Debug Menus, Console Commands

GameMaker doesn't have a "cheat engine" built-in, but you can implement debug / cheat systems for testing or player unlocks:

1. Global Debug Flags (Best Practice)

// Create Event - Controller Object
global.debug_mode = false;
global.god_mode = false;
global.infinite_ammo = false;

2. Hidden Key Combo to Toggle

// Step Event - Controller
if (keyboard_check_pressed(ord("D")) && keyboard_check(vk_control) && keyboard_check(vk_shift)) {
    global.debug_mode = !global.debug_mode;
    show_debug_message("Debug: " + string(global.debug_mode));
}

3. Cheat Menu (Press ~ / F1)

  • Create object obj_cheat_menu persistent, depth -100.
  • Draw GUI: List options (God Mode, Max Money, Unlock All, Level Warp).
  • Keyboard / Gamepad navigation.
  • Apply effects: player.hp = 9999; global.money = 999999;

4. Save File Editing (Post-Ship)

  • Save as JSON / INI (human readable) → Player edits file.
  • Or use buffer_save / buffer_load with encryption (simple XOR) to deter casual editing.

5. Console Commands (Debug Build)

// Step - if global.debug_mode
if (keyboard_check_pressed(vk_tilde)) {
    get_string_async("Console:", "");
}
/// Async - Dialog
if (ds_map_find_value(async_load, "id") == console_id) {
    var cmd = ds_map_find_value(async_load, "value");
    execute_command(cmd); // parse "give gold 999", "warp 5", "god"
}

Security

  • Strip debug code in Final Release build (#if debug / os_type != os_windows guards).
  • Never trust client in multiplayer — server-authoritative only.

Use for QA, accessibility, or "New Game+" unlocks. Don't ship cheat menus in competitive multiplayer.


https://www.htfbw.com © HT Games