Skip to content

This script transforms your RPG Maker games by replacing their outdated runtime with modern NW.js versions.

License

Notifications You must be signed in to change notification settings

aeagisdev/rpgm-nwjs-automator

Repository files navigation

RPG Maker MV NW.js Automation Script

A Python script that completely automates the process of replacing RPG Maker MV/MZ game runtime with a modern NW.js installation, providing better performance, space savings, and developer tools access.

๐ŸŽฏ What This Script Does

This script transforms your RPG Maker games by replacing their outdated runtime with modern NW.js versions.

โœจ Key Benefits

  • ๐Ÿ’พ Massive Space Savings: Save 100-120MB per game (one NW.js serves all games)
  • ๐Ÿ› ๏ธ Developer Tools: Press F12 for debugging, modding, and game analysis
  • โšก Better Performance: Modern NW.js with latest bug fixes and optimizations
  • ๐ŸŽฎ Custom Game Names: Create personalized executable names
  • ๐Ÿค– Zero Manual Work: Fully automated with intelligent error handling
  • ๐Ÿ”’ 100% Safe: Creates backups and validates everything before changes
  • ๐ŸŒ Cross-Platform: Works on Windows, macOS, and Linux

Automatic Processing

  • Game Validation: Verifies the directory contains a valid RPG Maker MV/MZ game
  • NW.js Download: Automatically downloads the specified NW.js version if not provided
  • Runtime Cleanup: Intelligently removes NW.js runtime files while preserving game assets
  • Configuration Updates: Modifies package.json with required fields for newer NW.js versions
  • Launch Script Creation: Creates platform-specific launch scripts (.bat for Windows, .sh for Unix)

One-Click Solutions

  • Intelligent Setup: Launch scripts automatically check and install dependencies
  • Cross-Platform: Works seamlessly on Windows, macOS, and Linux
  • Desktop Integration: Optional desktop shortcuts for instant access
  • Zero Configuration: Works out-of-the-box with sensible defaults
  • Visual Feedback: Colored terminal output with clear progress indicators

Safety Features

  • Automatic Backup: Creates a backup of the original game before modifications
  • File Preservation: Carefully preserves game assets, README files, and custom directories
  • Error Handling: Comprehensive error handling with informative messages
  • Validation: Multiple validation steps to ensure safe processing

๐Ÿ’ป Ultra-Quick Setup (30 Seconds!)

๐Ÿ–ฑ๏ธ Method 1: One-Click Launch (Recommended)

  1. Download the latest release from GitHub Releases
  2. Extract anywhere convenient (Desktop, Tools folder, etc.)
  3. Double-click the launcher for your system:
    • Windows: run_nwjs_automator_win.bat
    • Mac/Linux: run_nwjs_automator_unix_mac.sh

That's it! The launcher will:

  • โœ… Check if Python is installed (with install guidance if needed)
  • โœ… Automatically install required dependencies
  • โœ… Offer to create desktop shortcuts
  • โœ… Launch the automation tool
  • โœ… Keep the terminal open to show results

Method 2: Command Line (For Advanced Users)

The script will guide you through everything with a user-friendly interface!

python nwjs_automator.py

๐Ÿ“‹ Requirements

  • Python 3.6+ (script will check and guide you if needed)
  • Internet connection (to download NW.js if not provided)
  • Required packages (automatically installed): requests

๐Ÿ’ป Installation

Step 1: Install Python (if needed)

  • Windows: Download from python.org and check "Add to PATH"
  • Mac: brew install python3 or download from python.org
  • Linux: Usually pre-installed, or sudo apt install python3 python3-pip

Step 2: Install Dependencies

pip install requests

Step 3: Download Script

Download nwjs_automator.py from the releases page

๐ŸŽฎ How to Use

๐ŸŒŸ Interactive Mode (Easiest)

  1. Run the script:

    python nwjs_automator.py
  2. Follow the colorful prompts:

    • ๐Ÿ“ Game Path: Enter your RPG Maker game folder
    • ๐ŸŽฏ Game Name: Choose your custom executable name (e.g., "MyAwesomeGame")
    • ๐Ÿ”ง NW.js Version: Pick from optimized presets or go custom
    • ๐Ÿ› ๏ธ Build Type: SDK (recommended) or Normal
    • ๐Ÿ’พ Backup: Yes (recommended) or No
  3. Sit back and watch: The script handles everything automatically!

๐ŸŽฏ NW.js Version Guide

The script offers smart version presets:

Option Version Best For Windows Support
1 v0.29.4 Maximum compatibility (RPG Maker MV era) Windows 7+
2 v0.49.2 Balanced default - best overall choice Windows 7+
3 v0.72.0 Modern stable (last Win7 support) Windows 7+
4 v0.90.0+ Latest features, best performance Windows 10+
5 Custom Specific version needs Varies

๐Ÿ’ก Recommendation: Use option 2 (v0.49.2) for the best balance of compatibility and performance.

๐Ÿ› ๏ธ Build Types Explained

  • SDK Build (Recommended):

    • โœ… Includes F12 Developer Tools
    • โœ… Perfect for modding and debugging
    • โœ… Only 5-10MB larger
  • Normal Build:

    • โœ… Slightly smaller size
    • โŒ No developer tools
    • โš ๏ธ Use only if you need absolute minimum size

๐Ÿ”ง Advanced Usage

Command Line Options

# Basic usage
python nwjs_automator.py --game-path "C:\Your\Game"

# Custom executable name
python nwjs_automator.py --game-path "C:\Your\Game" --executable-name "MyGame"

# Specific NW.js version
python nwjs_automator.py --game-path "C:\Your\Game" --nwjs-version "v0.72.0"

# Use existing NW.js installation
python nwjs_automator.py --game-path "C:\Your\Game" --nwjs-path "C:\nwjs"

# Skip backup (not recommended)
python nwjs_automator.py --game-path "C:\Your\Game" --no-backup

# Normal build instead of SDK
python nwjs_automator.py --game-path "C:\Your\Game" --no-sdk

# Verbose logging
python nwjs_automator.py --game-path "C:\Your\Game" --verbose

All Command Line Arguments

Argument Description Default
--game-path Path to RPG Maker game directory Required
--executable-name Custom name for game executable "Game"
--nwjs-path Path to existing NW.js installation Auto-download
--nwjs-version NW.js version to use "v0.49.2"
--no-sdk Use normal build instead of SDK SDK build
--no-backup Skip creating backup Create backup
--verbose, -v Enable detailed logging Normal logging
--interactive, -i Force interactive mode Auto-detect

๐Ÿ”„ What the Script Does (Step by Step)

1. ๐Ÿ” Validation Phase

  • โœ… Checks if directory contains valid RPG Maker MV/MZ game
  • โœ… Verifies package.json and www/ folder exist
  • โœ… Validates and fixes package.json for NW.js compatibility
  • โœ… Ensures all critical files are present

2. ๐Ÿ’พ Safety Phase

  • โœ… Creates complete backup as GameName_backup
  • โœ… Backs up critical files (package.json, www/, index.html)
  • โœ… Validates backup integrity before proceeding

3. ๐Ÿ“ฅ NW.js Setup Phase

  • โœ… Downloads specified NW.js version (if not provided)
  • โœ… Extracts and prepares NW.js runtime
  • โœ… Chooses correct architecture (x64, x86, ARM) automatically

4. ๐Ÿงน Cleanup Phase

  • โœ… Removes old NW.js runtime files from game
  • โœ… Preserves all game assets and custom files
  • โœ… Cleans up unnecessary files (chromedriver, docs, etc.)
  • โœ… Keeps only essential locale files (en-US)

5. ๐Ÿ”ง Integration Phase

  • โœ… Copies new NW.js runtime to game directory
  • โœ… Restores game files with proper structure
  • โœ… Creates/fixes index.html if missing
  • โœ… Renames executable to your custom name

6. โœจ Finishing Phase

  • โœ… Removes unnecessary NW.js files
  • โœ… Creates Windows shortcuts (if applicable)
  • โœ… Sets proper file permissions
  • โœ… Validates final game structure

๐Ÿ“ Before & After

Before Processing

YourGame/                          (~120MB)
โ”œโ”€โ”€ Game.exe                       (NW.js runtime)
โ”œโ”€โ”€ nw.dll, ffmpeg.dll, etc.       (Runtime files)
โ”œโ”€โ”€ resources.pak                  (NW.js resources)
โ”œโ”€โ”€ locales/                       (All languages)
โ”œโ”€โ”€ www/                           (Your game!)
โ””โ”€โ”€ package.json                   (Game config)

After Processing

YourGame/                          (~5-15MB)
โ”œโ”€โ”€ YourCustomName.exe             (Your named executable)
โ”œโ”€โ”€ www/                           (Your game - preserved)
โ”œโ”€โ”€ package.json                   (Updated & optimized)
โ”œโ”€โ”€ index.html                     (Validated/created)
โ””โ”€โ”€ YourCustomName.lnk             (Windows shortcut)

YourGame_backup/                   (~120MB)
โ””โ”€โ”€ [Complete original backup]

๐Ÿ› ๏ธ Developer Tools Access

With SDK build (default), press F12 in your game for:

๐Ÿ”ง Debugging Features

  • Console: Execute JavaScript commands directly
  • Elements: Inspect game DOM structure
  • Sources: Debug game scripts with breakpoints
  • Network: Monitor resource loading
  • Performance: Profile game performance

๐ŸŽฎ Game Modification Examples

// In the game console (F12):

// Check NW.js version
process.versions

// Increase save slots
DataManager.maxSavefiles = () => 99

// Modify player stats
$gamePlayer.gainGold(99999)
$gameActors.actor(1).gainExp(999999)

// Skip events or change switches
$gameSwitches.setValue(1, true)
$gameVariables.setValue(1, 100)

// Test battles
$gameParty.addActor(2)
SceneManager.push(Scene_Battle)

๐ŸŒŸ Special Features

๐Ÿ”„ Automatic index.html Handling

  • Smart Detection: Finds and preserves existing index.html
  • Intelligent Creation: Creates optimized index.html if missing
  • Script Auto-Discovery: Automatically includes all game scripts in correct order
  • Library Order: Maintains proper RPG Maker MV library loading sequence

๐Ÿ“ฆ Smart package.json Fixes

  • Name Field: Adds required name field for newer NW.js versions
  • UTF-8 Encoding: Ensures proper character encoding
  • Validation: Checks JSON syntax and structure
  • Backup: Preserves original configuration while adding required fields

๐Ÿ—‚๏ธ Intelligent File Preservation

The script carefully preserves:

  • โœ… All game assets (www/ folder)
  • โœ… Custom README files (.txt, .md, .pdf)
  • โœ… User-created directories
  • โœ… Save files and configuration
  • โœ… Plugin data and custom resources

๐Ÿงน Smart Cleanup

Removes only unnecessary files:

  • โŒ chromedriver.exe (development tool)
  • โŒ Documentation files (AUTHORS, CHANGELOG.md, etc.)
  • โŒ Unused PAK files (nw_100_percent.pak, etc.)
  • โŒ Extra locale files (keeps only en-US)
  • โŒ SDK-specific files (if using normal build)

โš ๏ธ Important Notes

๐ŸŽฎ Game Compatibility

  • RPG Maker MV: Works with all versions (use v0.29.4 for maximum compatibility)
  • RPG Maker MZ: Use v0.49.2 or newer
  • Encrypted Games: May not work with DRM-protected games
  • Custom Plugins: Most work fine, some may need specific NW.js versions

๐Ÿ’พ File Organization Tips

๐Ÿ“ C:\RPG Games\
โ”œโ”€โ”€ ๐Ÿ“ Game1\                    # Processed (5MB)
โ”œโ”€โ”€ ๐Ÿ“ Game1_backup\             # Original backup (120MB)
โ”œโ”€โ”€ ๐Ÿ“ Game2\                    # Processed (8MB)
โ”œโ”€โ”€ ๐Ÿ“ Game2_backup\             # Original backup (135MB)
โ””โ”€โ”€ ...

๐Ÿ“ C:\Tools\
โ””โ”€โ”€ ๐Ÿ“ nwjs_automator\           # Keep script here
    โ”œโ”€โ”€ nwjs_automator.py
    โ””โ”€โ”€ temp_nwjs\               # Auto-created temp folder

๐Ÿ”’ Safety Reminders

  • Always backup: Script creates backups automatically, but keep your own too
  • Test games: Launch processed games once to ensure they work
  • Save early saves: Keep save files from before processing
  • Document versions: Note which NW.js version works best for each game

๐Ÿ› Troubleshooting

Common Issues & Solutions

โŒ "package.json not found"

  • โœ… Make sure you're pointing to the game's root directory
  • โœ… Directory should contain both package.json and www/ folder

โŒ "Python not found"

  • โœ… Install Python 3.6+ from python.org
  • โœ… On Windows, check "Add to PATH" during installation
  • โœ… Restart command prompt after installation

โŒ "Failed to download NW.js"

  • โœ… Check internet connection
  • โœ… Try a different NW.js version
  • โœ… Use --nwjs-path to point to existing NW.js installation

โŒ "Game won't start after processing"

  • โœ… Try older NW.js version (v0.29.4 for maximum compatibility)
  • โœ… Restore from backup and try with --no-sdk flag
  • โœ… Check if game has custom plugins requiring specific versions

โŒ "Permission denied" (Linux/Mac)

  • โœ… Run with sudo if needed
  • โœ… Make sure you have write permissions to game directory
  • โœ… Check file ownership with ls -la

โŒ "Missing dependencies"

  • โœ… Install with: pip install requests
  • โœ… On some systems: pip3 install requests
  • โœ… Try: python -m pip install requests

๐Ÿ”ง Debug Mode

For detailed troubleshooting, use verbose mode:

python nwjs_automator.py --verbose --game-path "C:\Your\Game"

This shows detailed logs of every operation, perfect for diagnosing issues.

๐Ÿ†˜ Getting Help

If you're still having issues:

  1. Check the backup: You can always restore from GameName_backup
  2. Try interactive mode: More user-friendly than command line
  3. Use verbose logging: --verbose shows detailed error information
  4. Test with different versions: Some games work better with specific NW.js versions
  5. Check GitHub Issues: Someone might have had the same problem

๐ŸŽฏ Pro Tips

๐Ÿš€ Performance Optimization

  • Use SDK build unless you absolutely need smaller size
  • Choose v0.49.2 for best balance of features and compatibility
  • Process multiple games - they'll all share the same NW.js runtime
  • Keep backups - you can always try different NW.js versions

๐ŸŽฎ Game Development Tips

  • Use F12 tools to debug and test your games
  • Test save/load functionality after processing
  • Check plugin compatibility with your chosen NW.js version
  • Document your settings - note what works for each game

๐Ÿ’พ Storage Management

  • One NW.js for all: All processed games share the same runtime
  • Clean up temp files: Script does this automatically
  • Organize backups: Keep original backups for safety
  • Monitor space savings: You'll save 100MB+ per game processed

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

What this means:

  • โœ… Free to use for personal and commercial projects
  • โœ… Modify and redistribute as needed
  • โœ… Include in your own tools without restrictions
  • โš ๏ธ Attribution required (keep the copyright notice)

๐Ÿ™ Credits & Acknowledgments

  • Original Guide: Based on the excellent tutorial by Fairy's Voice
  • NW.js Project: https://nwjs.io/ - The amazing runtime that makes this possible
  • RPG Maker Community: For testing, feedback, and compatibility reports
  • Python Community: For the incredible tools and libraries that power this script

๐Ÿ”„ Version History

v2.0.1 - Complete Rewrite (Current)

  • ๐Ÿชณ Fixed: Indentation error on line 460-462 (thanks to T1MM5H for reporting the issue)
  • ๐Ÿชณ Fixed: Os specific scripts and error handling improved

v2.0.0 - Complete Rewrite (Current)

  • โœจ New: Completely redesigned interactive experience
  • โœจ New: Smart NW.js version presets with compatibility guidance
  • โœจ New: Automatic index.html creation and validation
  • โœจ New: Intelligent package.json fixing for newer NW.js versions
  • โœจ New: Custom executable naming with automatic extension handling
  • โœจ New: Cross-platform shortcut creation (Windows .lnk files)
  • โœจ New: Advanced file preservation logic
  • โœจ New: Comprehensive error handling and validation
  • โœจ New: Detailed progress reporting with colored output
  • โœจ New: Support for multiple NW.js architectures (x64, x86, ARM)
  • ๐Ÿ”ง Improved: Much more robust file handling and safety checks
  • ๐Ÿ”ง Improved: Better cleanup of unnecessary NW.js files
  • ๐Ÿ”ง Improved: Enhanced backup and restore system
  • ๐Ÿ”ง Improved: Smarter temporary file management
  • ๐Ÿ”ง Improved: Platform-specific optimizations
  • ๐Ÿ”ง Improved: More informative logging and user feedback

v1.1.0 - One-Click Revolution

  • โœจ New: Intelligent one-click launcher scripts
  • โœจ New: Automatic dependency installation
  • โœจ New: Desktop shortcut creation
  • ๐Ÿ”ง Improved: Cross-platform compatibility

v1.0.0 - Initial Release

  • โœจ New: Full automation of NW.js replacement process
  • โœจ New: Interactive and command-line modes
  • โœจ New: Automatic backup system
  • โœจ New: Cross-platform support

๐Ÿค Contributing

We welcome contributions from the RPG Maker community!

Ways to Help:

  • ๐Ÿ› Report Bugs: Found an issue? Let us know!
  • ๐Ÿ’ก Suggest Features: Have ideas for improvements?
  • ๐Ÿ”ง Submit Code: Pull requests are welcome
  • ๐Ÿ“– Improve Docs: Help make the documentation even clearer
  • ๐ŸŽฎ Test Games: Try the script with different games and report compatibility
  • ๐ŸŒ Translate: Help translate the script for international users

Development Setup:

git clone https://github.com/aeagisdev/rpgm-nwjs-automator.git
cd rpgm-nwjs-automator
pip install -r requirements.txt

๐ŸŒŸ Show Your Support

If this tool helped you, consider:

  • โญ Star the repository on GitHub
  • ๐Ÿฆ Share on social media - help other RPG Maker developers discover this tool
  • ๐Ÿ’ฌ Join discussions - share your experiences and help others
  • ๐ŸŽฎ Report compatibility - let us know which games work great
  • ๐Ÿ“ Write reviews - help spread the word about the benefits

๐Ÿ“ž Support & Community


Made with โค๏ธ by RPG Maker developers, for RPG Maker developers.

Transform your games. Save space. Unlock potential.

About

This script transforms your RPG Maker games by replacing their outdated runtime with modern NW.js versions.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published