[RELEASE] rpgmaker-plugin-conflict-finder: Automatically find conflicts between plugins

screenshot.png


Hi, this is my new tool that helps find plugin conflicts.
The latest version can be downloaded from Github. After downloading, double-click conflict-finder to use it.

This tool analyzes the execution order and syntax of plugins to detect conflicts. Plugins that are encrypted, uglify, or written in a unique style may not be accurately detected. After finding conflicts between plugins, this tool can suggest the placement order of plugins to resolve some conflicts by rearranging them.
However, not all plugin conflicts can be resolved by rearranging. Common types of plugin conflicts in RPG Maker include:

Overwrite

Plugin A
JavaScript:
const _Game_Player_searchLimit = Game_Player.prototype.searchLimit;
Game_Player.prototype.searchLimit = function() {
    if (this.isDashing()) {
        return 999;
    }
    return _Game_Player_searchLimit.call(this);
};

Plugin B
JavaScript:
Game_Party.prototype.maxItems = function(item) {
    return 999;
};

The function of Plugin A is completely overwritten and becomes ineffective. If the overwrite is unintentional, it can cause errors. When Plugin A uses alias for patching and Plugin B directly overwrites, rearranging their order might allow both plugins to work. However, if both are using overwrite, simply rearranging cannot resolve the issue.

Another type is:

Outdated

Original
JavaScript:
Game_Character.prototype.searchLimit = function() {
    return 12;
};

Plugin A
JavaScript:
const _GamePlayer_searchLimit = Game_Player.prototype.searchLimit;
Game_Player.prototype.searchLimit = function() {
    if (this.isDashing()) {
        return 999;
    }
    return _GamePlayer_searchLimit.call(this);
};

Plugin B
JavaScript:
Game_Character.prototype.searchLimit = function() {
    return 0;
};

Since Game_Player does not have a searchLimit method and inherits it from Game_Character, Plugin A’s searchLimit stores Game_Character’s searchLimit. When Plugin B later modifies searchLimit, Plugin A’s searchLimit remains outdated. Rearranging their order can resolve this issue.

Using a functional alias patching method can prevent this problem:
JavaScript:
/**
 * Automatically choose whether to alias itself or the parent class.
 *
 * @param {Object} aliasClass - Use "Foo.prototype" for instance methods and "Foo" for static methods.
 * @param {string} methodName - The name of the method to alias.
 * @returns {Function} - The aliased method, callable with "call" or "apply".
 */
PluginManager.alias = function(aliasClass, methodName) {
    if (aliasClass.hasOwnProperty(methodName)) {
        return aliasClass[methodName];
    } else {
        const superClass = Object.getPrototypeOf(aliasClass);
        const superMethod = function(…args) {
            return superClass[methodName].apply(this, args);
        };
        return superMethod;
    }
};

Change
JavaScript:
const _GamePlayer_searchLimit = Game_Player.prototype.searchLimit;
to
JavaScript:
const _GamePlayer_searchLimit = PluginManager.alias(Game_Player.prototype, "searchLimit");

This will automatically determine whether the current class has this method, and if not, it will automatically call the parent class method to get the latest status.
I think this is a neat idea, but it seems to me that this tool may not be very useful to the average RPG Maker developer.

The very first screen is already user-unfriendly. I don't know what you coded this in, but to not have a standard Windows folder selection window, and to not even be able to use right-click or Ctrl+V to paste in a folder path - to have to physically type it in, every single time I use it, you almost lost me 😛 (you would have lost me except I wanted to give it a full try)

Then the main screen is unintelligible at first glance. Again, it's in an extremely old-fashioned keyboard-only interface, having to look at the bottom to see the buttons to navigate it. That's just obsolete design on graphical operating systems.

(also, I would suggest that Escape and probably Enter should close the Help window. It took me almost a minute before I thought to try pressing H a second time, that's not standard interface for even this kind of program from back in the day)

I'm really unsure what you mean by the R = Override kind of conflict. It's not described in your initial post, and that doesn't immediately sound like a conflict between plugins to me.

Then, having to memorize those letters and what they stand for and look at the little column of letters to know what it's saying...is not simple. I think at the very least, there should be an option (probably the default setting) to not display any conflicts you have recommended to Ignore. That's the majority of my list, and it's hard to visually filter out all of that garbage to see what's potentially useful.

The complete lack of mouse support to even be able to click and jump to a different item on the list...it's painful, man. I've spent a lot of time working in command line environments, but it is not the norm. Especially since I had to scroll through a dozen Ignored items at a time to get to the next recommended conflict.

All of that being said, once I figured out how to navigate and read it, the tool did point out a list of things that could be actual conflicts...except they were all between plugins from the Yanfly Engine Library, intentionally overwriting each other with new functionality for that specific plugin. It might be worth implementing a check in the tool to default to Ignoring conflicts between plugins made by the same author.

I didn't even try to look at how it deals with suggesting changes. I suspect, again, based on your original post, that it wouldn't be something the average RPG Maker user (who isn't familiar with JavaScript) could do on their own.

Even that could be overlooked if the tool itself were more usable. I hope you might be able to make a new version using a visual programming language - the concept is definitely something I'd like to be able to recommend to people to troubleshoot their plugin list.

But as it is, we already have newbies who have a hard time finding the correct options in visual drop-down menus. Figuring out and making sense of an old-fashioned text interface like this is simply beyond a lot of people's computer skill level.

Edit: I did take a look at the recommended order change and...it was not a good recommendation. It might make sense for you to program in the known order for some popular authors, or at least to default to no change.

The recommendation put my Yanfly plugins all out of order, and for several authors placed their core plugin beneath their feature plugins. I rather expect that if someone didn't know better and just followed the recommendation, it would very likely break their project.
Thank you for your reply. You gave a lot of useful suggestions. I'll add them to my TODO list.
  1. Use esc or enter to close the help window.
  2. Ability to hide default ignored conflicts (e.g., Overwrite => Overwrite).
  3. Mouse support (but note that Windows itself doesn't support mouse usage in the console, only Linux and Mac can work).
  4. Ability to filter out plugins from the same author (same prefix).
Here are some responses to your questions:
  1. Entering the project path theoretically supports ctrl+v, maybe some bug occurred?
  2. Possibly, in the future, we can use a webpage to create an interface.
  3. Override and Overwrite are similar, but I want Override to represent calling a parent method within a function, not completely overwriting it, like this:
    JavaScript:
    Game_Player.prototype.searchLimit = function() {
        return Game_Character.prototype.searchLimit.call(this);
    };
  4. Plugin order suggestion: The original idea is that if there are many conflicting plugins and it's impossible to manually judge the plugin order, a program can automatically calculate a feasible order. However, for example, many conflicts in YEP are intentional and harmless. If not manually ignored, they will be included in the plugin order calculation.

Original thread: https://forums.rpgmakerweb.com/threads/release-rpgmaker-plugin-conflict-finder-automatically-find-conflicts-between-plugins.170277/