MV Event Jitter Fix Looping Map Bug

Hi All,

I think I discovered a bug with this jitter fixing plugin. It works great unless it is used on a looping map. If you journey right or down it works as expected. But if you move up or left, and cross the eldge where the loop would start, the character sprite disappears. If you continue moving in one of those directions, you eventually reappear. But if you move in the opposite direction while this sprite disappearance is happening the map scrolling stops. However your character is still moving and if you keep heading in that direction you will eventually appear on the opposite side of the screen. Once you realign on the center of the screen, it proceeds as normal.

Looking on the forums I found that someone noticed this as well here:

I would imagine this is just a formula error. But if anyone knows of a fix or can help me make one, me and my over world map would greatly appreciate it.

I included the code for convenience. Let me now if you need any additional information.


JavaScript:
/*:
 * NOTE: This code is a direct conversion from the VXA ruby fix found here: https://pastebin.com/XDd0tVWJ
 *
 * @plugindesc Fixes Event Jitter / Display Rounding Error.
 * @author Dan "Liquidize" Deptula
 *
 * @help This plugin does not provide plugin commands.
 * When certain slow display panning speeds are used, events will improperly
 * round floating values to determine their position on screen. This causes
 * them to appear off from the tilemap by a single pixel. Though minor this is
 * noticable. This snippet fixes this behaviour.
 *
 * @param Tile Size
 * @desc The size of map tiles.
 * Default: 48
 * @default 48
 *
 */

var Liquidize = Liquidize || {};
Liquidize.JitterFix = {};
Liquidize.JitterFix.Parameters = PluginManager.parameters('JitterFix');
Liquidize.JitterFix.TileSize = Number(Liquidize.JitterFix.Parameters["Tile Size"]) || 48;

Game_Map.prototype.displayX = function() {
    return Math.floor(this._displayX * Liquidize.JitterFix.TileSize) / Liquidize.JitterFix.TileSize;
};

Game_Map.prototype.displayY = function() {
    return Math.floor(this._displayY * Liquidize.JitterFix.TileSize) / Liquidize.JitterFix.TileSize;
};

Game_Map.prototype.adjustX = function(x) {
    if (this.isLoopHorizontal() &&  x < (this.displayX() - (this.width() -  Liquidize.JitterFix.TileSize) / 2)) {
        x -= this.displayX() + this.width();
    } else {
        x -= this.displayX();
    }
    return x;
};

Game_Map.prototype.adjustY = function(y) {
    if (this.isLoopVertical() && y < (this.displayY() - (this.height() - Liquidize.JitterFix.TileSize) / 2)) {
        y -= this.displayY() + this.height();
    } else {
        y -= this.displayY();
    }
    return y;
};
I can't help you with the plugin directly, but have you considered preventing the rounding error instead of overwriting the original code?

There are (if I remember correctly) two or three different causes for the jitter, and the fix should work independently for all of them - but it is not the only solution.

Most of the rounding errors come from using a screen size with partial tiles - that cannot happen if your screen size is a full multiple of the tile size 48x48. So try to use 1056 instead of 1080 if you're using that screen size, or other equivalents of the next full multiple down from whatever windows screen size you set.
I can't help you with the plugin directly, but have you considered preventing the rounding error instead of overwriting the original code?

There are (if I remember correctly) two or three different causes for the jitter, and the fix should work independently for all of them - but it is not the only solution.

Most of the rounding errors come from using a screen size with partial tiles - that cannot happen if your screen size is a full multiple of the tile size 48x48. So try to use 1056 instead of 1080 if you're using that screen size, or other equivalents of the next full multiple down from whatever windows screen size you set.
Thanks for the response, sadly that doesn't work for diagonal movement and what not. But I appreciate the response.
As I said, there are several causes for the jitter - and that came before adding diagonal movement.
So the tile shifting for partial tiles was not the cause for your jitter - too bad, but I think it was still worth a try.
As I said, there are several causes for the jitter - and that came before adding diagonal movement.
So the tile shifting for partial tiles was not the cause for your jitter - too bad, but I think it was still worth a try.
Oh, it was absolutely worth a try! If it ended up being that easy I would be over the moon, haha. If I can’t figure out a fix , maybe, I can try commissioning a fix for the looping when I get some money together.

Original thread: https://forums.rpgmakerweb.com/threads/event-jitter-fix-looping-map-bug.172502/