Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

DayZ Script Patcher

DayZ 1.29 prioritises the global variable g_Game over the GetGame() function call. Mods using GetGame() will still compile and work, but they won't benefit from the server performance improvements that come with using g_Game directly.

This tool scans your mod source code and replaces all GetGame() calls with g_Game so your mods are fully optimised for 1.29+.

Download

Grab the latest .exe from Releases. No install needed, just run it.

How it works

  1. Run the exe and point it at your mod folder (or pass the path as an argument)
  2. It scans all .c files recursively and shows you a summary of what it found
  3. If it finds non-.c files with GetGame() calls (some modders use odd extensions), it'll ask if you want to include those too
  4. Pick [V] to view the exact changes for any file before committing to anything
  5. Pick [A] to apply — it backs up every file it's about to modify, then applies the changes
  6. After applying, it rescans to verify everything was replaced

It won't touch GetGame() inside string literals or block comments (/* */). It will replace calls inside inline comments (//) but flags them so you can check.

What it replaces

GetGame().IsServer()        ->  g_Game.IsServer()
GetGame().GetPlayer()       ->  g_Game.GetPlayer()
CGame game = GetGame();     ->  CGame game = g_Game;
if (GetGame() != null)      ->  if (g_Game != null)

Literally just swaps GetGame() for g_Game everywhere it appears in code. The methods, parameters, and return types are all unchanged — it's the same CGame object, just accessed differently.

Usage

Double-click the exe or run from a terminal:

dayz-script-patcher.exe "C:\Path\To\Your\Mod"

Works in PowerShell, CMD, Windows Terminal, and VS Code terminal. Colors are disabled automatically when piped to a file.

Backups

The tool automatically backs up every file it modifies before making changes. Backups are saved in a timestamped folder (e.g. _getgame_backup_20260408_153000/) inside your target directory, preserving the original folder structure. If any file fails to back up, the tool aborts without modifying anything.

You should still consider using git or making a manual copy for extra safety.

Building from source

Requires Bun.

bun install
bun run build

Output goes to dist/dayz-script-patcher.exe.

Why this exists

Bohemia prioritised g_Game over GetGame() in 1.29 as a performance optimisation — direct variable access is faster than a function call, and GetGame() gets called thousands of times per frame across all scripts. According to the DayZ developers, these optimisations contributed to up to a 400% server performance improvement. GetGame() still works, but any mod still using it misses out on those gains.

The fix is a straightforward find-and-replace, but doing it by hand across a large mod is tedious and error-prone. This tool does it safely with previews, edge case handling, and verification.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages