public

Rpg Maker Developers Group

Simple enough for a child, powerful enough for a developer

2 Followers

MZ Process Throttling Effort

BMM Archive · July 15, 2026

Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.

Original Source

  • Original title: MZ Process Throttling Effort
  • Original author: Jams
  • Original date: August 4, 2023
  • Source thread: https://forums.rpgmakerweb.com/threads/process-throttling-effort.160026/
  • Source forum path: Game Development Engines > RPG Maker Javascript Plugins > Learning Javascript

Summary

I have been working on the Jams_Mapper plugin and most of the processing is done when you move between maps (I call them sectors since they are a sector of the $dataMap that gets updated). I noticed that most of my processing is triggered when I cross from one sector to another in order to refresh the other sectors and there is a visible stutter in the application when you cross this line. In order to combat this issue I was going to implement throttling in my event bus to...

Archived First Post

I have been working on the Jams_Mapper plugin and most of the processing is done when you move between maps (I call them sectors since they are a sector of the $dataMap that gets updated).

I noticed that most of my processing is triggered when I cross from one sector to another in order to refresh the other sectors and there is a visible stutter in the application when you cross this line. In order to combat this issue I was going to implement throttling in my event bus to spread the load across multiple engine ticks and that has improved the issue significantly, but I wanted to know if there were any other tips to spread processing across game engines frames or other solutions in general.

Jams_EventBus.js

JavaScript:
JamsEventBus.prototype.execute = function () {
    if (this.backlog.length > 0) {
        const { eventType, id, arg } = this.backlog[0];
        this.subscriptions[eventType][id](arg);
        this.backlog.shift();
    }
};

JamsEventBus.prototype.execution = function (eventType, arg) {
    var d = Date.now();
    var len = this.backlog.length;
    var interval = 10;
    var loop = 0;
    if (len > 10) {
        loop = Math.ceil(len / 5);
        interval = 0;
    }

    for (let i = 0; i <= loop; i++) {
        if (d - this.tick > interval) {
            this.execute();
            this.tick = d;
        }
    }
};

the ticks are coming from SceneManager.updateFrameCount.

JavaScript:
let _updateFrameCount = SceneManager.updateFrameCount;
SceneManager.updateFrameCount = function () {  
 
   ...
    Jams.EventBus.execution();
    _updateFrameCount();
};

Downloads / Referenced Files

Log in to download

Log in, then follow the RPG Maker Developers Group to see these download links.

Log in to download
Creator Claims / Removal

If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.

#rpg-maker-archive#js-learning

Replies (0)

No replies yet.

0 replies 1 view

Log in to reply.

User Avatar