Debug Mode
Debug mode provides special commands and information displays while playtesting your game.Enabling Debug Mode
Debug mode is typically enabled automatically when running the game from the editor or during development.Debug mode should be disabled in release builds to prevent players from accessing debug features.
Debug Commands
Pokémon Essentials includes numerous debug commands accessible during gameplay:Common Debug Keys
| Key | Function |
|---|---|
| F12 | Soft reset (restart game) |
| F8 | Screenshot |
| F9 | Debug menu (if available) |
| Ctrl | Hold to speed up game (fast-forward) |
Debug Menu Functions
The debug menu provides access to:- Pokémon debugger - Edit party Pokémon stats, moves, abilities
- Item manager - Add/remove items from bag
- Switch/variable editor - Modify game switches and variables
- Warp to map - Instantly teleport to any map
- Battle tester - Start test battles with specific Pokémon
- Animation tester - Preview move animations
- Event trigger - Force common events to run
Access the debug menu during gameplay (specific key depends on your Essentials configuration, often F9 or accessed through in-game menu).
Error Logging
Pokémon Essentials automatically logs errors and debug information to help troubleshoot issues.Debug Log File
Location:Data/debuglog.txt
The debug log records:
- Battle sequences and calculations
- Move damage calculations
- AI decision-making
- Status changes and abilities
- HP modifications
- Round-by-round battle flow
Debug Log Example
The debug log is invaluable for understanding battle mechanics and troubleshooting AI behavior.
Error Handling
Error Messages
When errors occur during development, Pokémon Essentials displays:- Error type - Ruby exception class
- Error message - Description of the error
- Stack trace - Line numbers and script names
- Affected code - Context around the error
Common Error Types
NoMethodError
Calling a method that doesn’t exist:- Variable is nil when it shouldn’t be
- Typo in method name
- Missing object initialization
NameError
Referencing undefined variable or constant:- Typo in class/constant name
- Script not loaded (load order issue)
- Missing require statement
SyntaxError
Invalid Ruby syntax:- Missing
endkeyword - Unclosed string or parenthesis
- Invalid Ruby syntax
ArgumentError
Wrong number of arguments:- Incorrect function call
- Changed function signature
- Missing optional parameters
Testing Techniques
Playtesting from Editor
Console Output
Useprint and p for debug output:
Console output appears in the game window or console if running from terminal.
Debug Statements
Add temporary debug code:Conditional Debugging
Use debug flags to control debug output:Battle Debugging
Battle debugging is particularly detailed in Pokémon Essentials.Battle Log Entries
The debug log tracks:- Ability triggers - When abilities activate
- Stat changes - Stat stage modifications
- AI decisions - What the AI chooses and why
- Priority order - Move order based on priority and speed
- Move execution - Which moves are used
- Damage calculation - Calculated damage values
- HP changes - HP modifications with before/after values
- Status changes - Status condition applications
- Round results - Winner/loser determination
Reading Battle Logs
- Round number
- AI’s available moves with scores
- AI’s selected move
- Calculated damage
- HP change (before => after)
Testing Specific Battles
Use the battle tester to:- Set up specific Pokémon with exact stats
- Test move interactions
- Verify ability triggers
- Check damage calculations
- Test AI behavior
Common Debugging Scenarios
Event Not Triggering
Script Errors
Data Not Loading
Common causes:- PBS files not compiled
- Syntax errors in PBS files
- Missing required fields
- File encoding issues
Performance Issues
Debugging techniques:-
Profile code - Add timing code:
- Check event frequency - Parallel Process events run every frame
- Review scripts - Look for infinite loops or heavy calculations
- Monitor resources - Check memory usage and file I/O
Debugging Tools
In-Game Console
Some Essentials versions include an in-game console for executing Ruby code on the fly.PBS File Compiler
Compile PBS files to detect syntax errors before runtime:- Use debug menu compilation option
- Watch for error messages during compilation
- Fix PBS syntax errors
Script Verification
Before running:Best Practices
During Development
- Test frequently - Test changes immediately
- Use version control - Commit working states
- Keep backups - Backup before major changes
- Document bugs - Keep a list of known issues
- Incremental changes - Make small, testable changes
Debug Code
- Remove debug code - Clean up before release
- Use debug flags - Control debug output with constants
- Meaningful messages - Write clear debug messages
- Context information - Include relevant values in debug output
Error Handling
- Graceful failures - Handle errors without crashing
- User-friendly messages - Display helpful error information
- Log errors - Write errors to log files
- Validation - Validate input and data
Preparing for Release
Related Resources
- Script Extractor - Extract scripts for easier debugging
- RPG Maker XP Editor - Test maps and events
- Scripting Guide - Learn to write error-free scripts
- PBS Files - Understand PBS data format