Skip to content

Enhancement: Implement debug control mechanism with granular switches #718

@coderabbitai

Description

@coderabbitai

Problem

Currently, debug messages are individually commented out in the code (as seen in PR #717), which creates several issues:

  • Inconsistent debugging capabilities across the codebase
  • Difficult to enable/disable debugging for specific components
  • Makes code less readable with commented debug statements

Proposed Solution

Implement a unified debug control mechanism with granular switches for different parts of the game:

// Debug control macros
#macro DEBUG_MODE false          // Master switch
#macro DEBUG_UNIT_DRAW false     // Debug unit drawing
#macro DEBUG_UNIT_SURFACES false // Debug surface operations 
#macro DEBUG_COMBAT_TARGETING false // Debug combat targeting
// Add more as needed

Then use these switches in the code:

if (DEBUG_UNIT_SURFACES) {
    show_debug_message($"{_choice}");
    show_debug_message(data_set);
}

Benefits

  • Enables selective debugging without code modifications
  • Improves code readability by removing commented debug code
  • Allows easier troubleshooting of specific game components
  • Centralizes debug control in one location
  • Can be extended with debug logging to file when needed

Implementation Notes

  • Could be implemented in a central script/object
  • Debug switches should default to false in release builds
  • Consider adding a debug menu in development builds

This issue addresses the suggestion made in PR #717.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions