← Back to context

Comment by haecceity

7 years ago

Isn't it common to leave debug code in production software?

I work on AAA games and we definitely don't leave any debug code in production copies of the games. It's all #ifdef'd out in Retail builds.

  • Maybe it's less common now that tooling and frameworks are more standardized but having spent quite a lot of time messing with the PSX and its emulators I can vouch that it's fairly common to find debugging code and strings in production versions. Simply using an emulator to enable the debug UART will spew quite a lot of debug infos for some games. FFVII has a "debug room" that you can't normally access but is present on retail copies. I also seem to recall that the PC version shipped with full debugging symbols which gave reverse engineers a field day.

  • I’m always surprised when I see you here but I’m not sure why.

    Anyway. I can corroborate this. Debug code is /really/ harming performance in AAA games. Also, you want to remove your “cheats” that QC use to skip chunks of the game.

    • Older games are known for still containing various cheats to skip chunks of the game or make them easier. I'd guess a PS1 game might still have debug left in along with cheats simply either due to time pressure or someone forgot.

      2 replies →

    • It really depends on what you mean by "debug code". If you mean special versions of the code built with "-O0 -g" (or the equivalent in whatever compiler/toolchain they're using) then obviously that's going to be a problem. If it's just helper methods like "go directly to section X in the game", "spawn any monster" or "if global variable DEBUG is 1 then log this" then that can easily make it in the final product if they're not optimized away in production builds. Those won't seriously harm performance either, just bloat the binary a little (which will most likely be totally negligible since modern games routinely end up using dozens of GB).

      3 replies →