- Joined
- Jan 2, 2014
- Messages
- 1,876
- Reaction score
- 1,029
- First Language
- Chinese
- Primarily Uses
- N/A
Purpose
Fixes bugs, improves codebase quality, boosts performance and gives new APIs
Introduction
Games using this plugin
None so far
Download Link
Demo Link
Fixes bugs, improves codebase quality, boosts performance and gives new APIs
Introduction
Code:
* 1. This plugin's supposed to be fully compatible with those not written
* with this plugin in mind, so plugin developers don't have to write
* compatibility fixes involving this plugin
* 2. This plugin added some new APIs and refactored some codes to further
* facilitate more effective and efficient plugin development by making
* the default RMMZ codebase quality improvements even more drastic
* Note that such refactoring will only be done incrementally, meaning
* that these codebase quality improvements won't be all present in the
* 1st version of this plugin, but only when they cause real issues in
* plugin development, in which those improvements will be added to be
* newer versions of this plugin
* 3. This plugin also fixed some bugs and further improved performance in
* the default RMMZ codebase
* 4. THIS PLUGIN'S INTENDED TO GIVES AN EXTRA OPTION TO PLUGIN DEVELOPERS
* RATHER THAN REPLACING THE DEFAULT RMMZ CODEBASE
Games using this plugin
None so far
Code:
* @param rngPartNum
* @desc Sets the number of parts altering Math.random randomness
* It makes Math.random gives more evenly distributed numbers
* @default 10
Code:
* # Additional plugin parameter explanations
* 1. rngPartNum
* Math.random will be run under each of equal-sized partitions
* The number of those partitions is rngPartNum
* No partition will be run under twice before they've all been run
* under
* rngPartNum shouldn't be too large nor too small to maximize the
* chance for the RNG generated by Math.random() to be more evenly
* distributed(For instance, 10 is a good value for rngPartNum)
* Larger rngPartNum means more time and memory needed to run it
* E.g.:
* - With rngPartNum being 10, the random numbers will be divided into
* the below 10 partitions:
* i. - [0, 0.1)
* ii. - [0.1, 0.2)
* iii. - [0.2, 0.3)
* iv. - [0.3, 0.4)
* v. - [0.4, 0.5)
* vi. - [0.5, 0.6)
* vii. - [0.6, 0.7)
* viii. - [0.7, 0.8)
* ix. - [0.8, 0.9)
* x. - [0.9, 1)
* Then every 10 consecutive Math.random() call will always results
* in random numbers in different partitions, until all partitions
* are used, then all those partitions will be reset and can be used
* again
* For instance, the consecutive call results of Math.random with
* rngPartNum being 10, can be something like this:
* i. - 0.5583369022811258 // 6 - [0.5, 0.6)
* ii. - 0.8856774551202906 // 9 - [0.8, 0.9)
* iii. - 0.7053351634934172 // 8 - [0.7, 0.8)
* iv. - 0.2910141721648054 // 3 - [0.2, 0.3)
* v. - 0.46443921703774416 // 5 - [0.4, 0.5)
* vi. - 0.34247765359444715 // 4 - [0.3, 0.4)
* vii. - 0.9611230852360236 // 10 - [0.9, 1)
* viii. 0.170055669517572 // 2 - [0.1, 0.2)
* ix. - 0.6280946076323228 // 7 - [0.6, 0.7)
* x. - 0.09900382018076581 // 1 - [0, 0.1)
* (Now all the 10 partitions are used after the 1st 10 consecutive
* Math.random() call and thus reset to be able to be "used" again)
* xi. - 0.49970969353564276 // 5 - [0.4, 0.5)
* xii. - 0.19670031315146652 // 2 - [0.1, 0.2)
* xiii. - 0.6183234115814623 // 7 - [0.6, 0.7)
* xiv. - 0.9592661473226407 // 10 - [0.9, 1)
* xv. - 0.837747307203645 // 9 - [0.8, 0.9)
* xvi. - 0.06670947818157003 // 1 - [0, 0.1)
* xvii. - 0.20614586616388186 // 3 - [0.2, 0.3)
* xviii. - 0.38808043042462215 // 4 - [0.3, 0.4)
* xix. - 0.7973840400497697 // 8 - [0.7, 0.8)
* xx. - 0.5467456358572309 // 6 - [0.5, 0.6)
* # Fixed bugs
* 1. The RMMZ hardcodes the rendering loop fps to be the monitor refresh
* rate, and can be problematic when targeting players with low end
* mobiles
* - This plugin lets you force the rendering loop fps by this script
* call:
* Graphics.renderFps = newRenderFps
* Where newRenderFps is the new clamped rendering loop fps
* - This can be useful when targeting low end mobiles by clamping the
* rendering loop fps to 30
* - Setting this as 0 will remove the clamping
* - Do note that the rendering loop fps can never go beyond the
* monitor refresh rate
* Search tag: Graphics_Render_FPS
* 2. The RMMZ hardcodes the game loop fps to be 60, and can be
* problematic when targeting players with low end mobiles
* - This plugin lets you change the game loop fps by this script
* call:
* Graphics.gameFps = newGameFps
* Where newGameFps is the game loop fps
* - This can be useful as a performance stress test by raising the
* game loop fps to be 120, or when targeting low end mobiles by
* capping the game loop fps to 30
* - Do note that the game loop fps has an upper bound, which depends
* on the hardware capability of the running machine(so you'll have
* to test it out yourselves), so don't be too insane with it(like
* setting it to 2400, and you'll most likely have troubles)
* Search tag: Graphics_Game_FPS
* 3. The faulty damage formula will just silently return 0 damage
* instead of informing you what faults are in which damage formula
* - This plugin lets you know them by this script call:
* Game_Action.IS_SHOW_DAMAGE_FORMULA_ERRS = true
* Which is useful when testing the damage formulae
* - Alternatively, if you don't want your players to know anything
* about the damage formula, you can use this script call:
* Game_Action.IS_SHOW_DAMAGE_FORMULA_ERRS = false
* Which is useful when the game's about to be published
* 4. Any damage formula having side effects will have those side effects
* leaked out in the battle when some autobattle actors having those
* skills/items input actions
* - This plugin temporarily removes the side effect parts of all
* damage formulae of skills/items of autobattle actors when they
* input actions, but those side effects will still be there when
* the inputted actions are actually executed
* - It's done by replacing the damage formula string with the regular
* expression stored in
* Game_Action.NO_SIDE_EFFECT_DAMAGE_FORMULA_REGEX, and its default
* value is new RegExp(".*[};] *", "gim"), meaning that anything
* before the last } or ; will be temporarily removed from the
* damage formula
* - If that default regular expression doesn't suit your needs, you
* can change Game_Action.NO_SIDE_EFFECT_DAMAGE_FORMULA_REGEX to be
* a suitable counterpart
* - Regardless of how the regular expression's written, you should
* standardize your damage formula so the side effect parts can
* always be reliably removed with an easy, simple and small regular
* expression
* - (Advanced)Alternatively, you can edit
* Game_Action.prototype.damageFormulaWithoutSideEffects to use
* different regular expressions to santizie different damage
* formulae, or even just return a separate side-effect free
* counterpart as string literals or notetag values for some
* skills/items yourselves, like:
* Game_Action.prototype.damageFormulaWithoutSideEffects = function() {
* const { id, meta, damage: { formula } } = this.item();
* switch (id) {
* case 1: return meta.damageFormulaWithoutSideEffectsNotetag;
* case 2: return "damageFormulaWithoutSideEffects";
* case 3: return formula.replace(regex1, "");
* case 4: return formula.replace(regex2, "");
* default 1: return formula.replace(Game_Action.NO_SIDE_EFFECT_DAMAGE_FORMULA_REGEX, "");
* }
* };
* Do note that this plugin doesn't provide such notetags for you,
* so you'll have to use the default RMMZ notetags, which is of this
* format: <notetagName:notetagValue>
* 5. The active TPBS will have an extremely rare chance to crash the
* game when trying to select the inputting actor, the inputting
* actions, or its targets
* - Please refer to this link for details:
* https://forums.rpgmakerweb.com/index.php?threads/bug-extremely-rare-but-fatal-active-tpbs-bug-crashing-the-game.126144/
Code:
* # New public APIs
* Array
* - Instance methods
* 1. fastMap(mapCallback, mapThis_)
* The same as map but is tested to be noticeably faster
* 2. fastMerge(arr)
* The same as concat except that fastMerge alters the original array
* instead of returning a new one
* 3. filterMap(filterCallback, mapCallback, filterThis_, mapThis_)
* The same as chaining filter with map except that the new array
* returned by filter will be mapped in place(.filter().map())
* 4. mapFilter(mapCallback, filterCallback, mapThis_, filterThis_)
* The same as chaining map with filter except that the new array
* returned by map will be filtered in place(.map().filter())
* 5. mapReduce(mapCallback, reduceCallback, initVal_, mapThis_, reduceThis_)
* The same as chaining map with reduce but is tested to be
* noticeably faster(.map().reduce())
* 6. eraseElem(elem)
* Erases the passed element(if any) from this original array
* 7. split(splitCallback, splitThis)
* Returns an array of array splited by the removed elements
* returning truthy results in splitCallback
* 8. splitInPlace(splitCallback, splitThis)
* Returns an array of array splited by the removed elements
* returning truthy results in splitCallback
* This method changes the original array
* 9. isProperSubsetOf(arr)
* Returns if this array's a proper subset of the specified array
* 10. isProperSupersetOf(arr)
* Returns if this array's a proper superset of the specified array
* 11. isSupersetOf(arr)
* Returns if this array's a superset of the specified array
* 12. isSubsetOf(arr)
* Returns if this array's a subset of the specified array
* 13. isEmpty()
* Returns if this array's empty
* 14. symmetricDifference(arr)
* Returns the symmetric difference of this and the specified array
* 15. symmetricDifferenceInplace(arr)
* Returns the symmetric difference of this and the specified array
* This method changes the original array
* 16. union(arr)
* Returns the union of this and the specified array
* 17. unionInPlace(arr)
* Returns the union of this and the specified array
* This method changes the original array
* 18. difference(arr)
* Returns the difference of this and the specified array
* 19. differenceInPlace(arr)
* Returns the difference of this and the specified array
* This method changes the original array
* 20. intersection(arr)
* Returns the intersection of this and the specified array
* 21. intersectionInPlace(arr)
* Returns the intersection of this and the specified array
* This method changes the original array
* 22. excludes(elem, fromI)
* Returns if this array doesn't include the specified element
* 23. clear()
* Empties the whole array
* Graphics
* - Static Accessor
* 1. renderFps
* Returns the current render fps
* 2. renderFps = newRenderFps
* Sets the current render fps to be newRenderFps
* 3. gameFps
* Returns the current game fps
* 4. gameFps = newGameFps
* Sets the current game fps to be newGameFps
* Input
* - Static Function
* 1. isJustReleased(keyName)
* Returns if the specified key's just released right on this frame
* Game_Action
* - Static Variable
* 1. IS_SHOW_DAMAGE_FORMULA_ERRS
* Controls whether the damage formula error will be reported on the
* console to let users know whether they've some faulty damage
* formulae
* 2. NO_SIDE_EFFECT_DAMAGE_FORMULA_REGEX
* Stores the regular expressions to temporarily remove the parts of
* the damage formula leaking side effects when evaluating the damage
* among all actions of autobattle actors to fix the side effect
* leaking bug when those actor input actions
* Game_BattlerBase
* - Instance Method
* 1. onUnrestrict
* Triggers events to happen when a battler becomes no longer
* restricted
* Game_Battler
* - Instance Method
* 1. isTpbActing
* Returns whether the battler's executing tpb actions
* 2. isTpbCharging
* Returns whether the battler's charging the tpb bar
* 3. isTpbCasting
* Returns whether the battler's casting tpb actions
* 4. onTpbReady
* Triggers events to happen when the battler just finished casting
* tpb actions
* 5. isEndTpbCharging
* Returns whether the tpb battler's just ended charging the tpb bar
* 6. isEndTpbCasting
* Returns whether the tpb battler's just ended casting actions
* 7. isTpbIdle
* Returns whether the battler tpb bar's idle(not doing anything)
* Abilities(Plugin Users):
* 1. Nothing special
* Abilities(Plugin Developers):
* 1. Basic knowledge on what the default RMMZ codebase does in general
* 2. Some RMMZ plugin development proficiency to fully utilize this
* plugin in intended ways
* (Basic knowledge on what RMMZ plugin development does in general
* with several easy, simple and small plugins written without
* nontrivial bugs up to 1000 LoC scale but still being inexperienced)
* 1. Nothing special
* Abilities(Plugin Developers):
* 1. Basic knowledge on what the default RMMZ codebase does in general
* 2. Some RMMZ plugin development proficiency to fully utilize this
* plugin in intended ways
* (Basic knowledge on what RMMZ plugin development does in general
* with several easy, simple and small plugins written without
* nontrivial bugs up to 1000 LoC scale but still being inexperienced)
Code:
* 1. Commercial use's always allowed and crediting me's always optional.
* 2. You shall keep this plugin's Plugin Info part's contents intact.
* 3. You shalln't claim that this plugin's written by anyone other than
* DoubleX or my aliases. I always reserve the right to deny you from
* using any of my plugins anymore if you've violated this.
* 4. If you repost this plugin directly(rather than just linking back),
* you shall inform me of these direct repostings. I always reserve
* the right to request you to edit those direct repostings.
* 5. CC BY 4.0, except those conflicting with any of the above, applies
* to this plugin, unless you've my permissions not needing follow so.
* 6. I always reserve the right to deny you from using this plugin
* anymore if you've violated any of the above.
Code:
* 1. THIS PLUGIN MUST BE PLACED ABOVE ALL THE OTHER PLUGINS
* 2. The version number of this plugin's consists of 2 parts, with 1
* being the targeted default RMMZ codebase versions, so this plugin
* must be outdated if those version numbers are indeed different
* 3. (Plugin developers only)The version numbers of this plugin are
* stored in DoubleX_RMMZ.Enhanced_Codebase.VERSIONS, which should be
* { codebase: "1.0.0", plugin: "v0.00a" }
* If it's falsy, it means this plugin's not loaded at the moment of
* querying its version numbers
* 4. (Plugin developers only)Please use the following search tag to
* check how this plugin extends and rewrites functions:
* - Enhanced_Codebase_Extend_Rewrite_Funcs
* Note that the original function will still be stored in the plugin
* container even if it's supposed to be rewritten rather than
* extended
* Please use the following search tag to check how this plugin adds
* accessors, getters and setters:
* - Enhanced_Codebase_Add_Accessors
Code:
* Authors:
* 1. DoubleX
* Plugin Development Collaborators:
* - None So Far
* Bug Reporters:
* - None So Far
* Compatibility Issue Raisers:
* - None So Far
* Feature Requesters:
* - None So Far
Code:
* { codebase: "1.5.0", plugin: "v0.04b" }(2022 Oct 25 GMT 1400):
* 1. Fixes some visual effect duration not in sync with game loop FPS
* changes bug
* 2. Fixes default sprite gauge value color crash bug
* { codebase: "1.4.3", plugin: "v0.04a" }(2022 Feb 5 GMT 1400):
* 1. Added traceObjProp
* 2. Added objPropLog
* { codebase: "1.1.1", plugin: "v0.03c" }(2020 Dec 26 GMT 1400):
* 1. Fixed the event suffix not working for all plugins with such
* notetags bug
* { codebase: "1.1.1", plugin: "v0.03b" }(2020 Dec 25 GMT 1400):
* 1. Makes Sprite_Gauge better at adding bar types/editing their
* behaviors
* { codebase: "1.1.0", plugin: "v0.03a" }(2020 Dec 13 GMT 1400):
* 1. Fixed some manifestations of the bug where the active TPBS will
* have an extremely rare chance to crash the game when trying to
* select the inputting actor, the inputting actions, or its targets
* { codebase: "1.1.0", plugin: "v0.02c" }(2020 Dec 3 GMT 1400):
* 1. You no longer have to edit the value of
* DoubleX_RMMZ.Enhanced_Codebase.PLUGIN_NAME when changing this
* plugin file name
* { codebase: "1.1.0", plugin: "v0.02b" }(2020 Oct 30 GMT 1400):
* 1. Fixed a game crashing bug when using the Control Variables event
* command
* { codebase: "1.0.2", plugin: "v0.02a" }(2020 Oct 11 GMT 1400):
* 1. Added rngPartNum
* { codebase: "1.0.2", plugin: "v0.01c" }(2020 Sep 19 GMT 1400):
* 1. Fixed the game crashing bug when defeated enemies drop items
* 2. Fixed the character being stuck inside events bug when moving
* straight
* 3. Fixed the game crashing bug when moving diagonally
* { codebase: "1.0.2", plugin: "v0.01b" }(2020 Sep 14 GMT 1400):
* 1. Fixed the bug where the text alpha is wrong when drawing texts
* { codebase: "1.0.0", plugin: "v0.01a" }(2020 Sep 4 GMT 1400):
* 1. Added IS_CACHE_DAMAGE_FORMULA
* 2. Added tpbCastTime
* 3. Added IS_CACHE_SCRIPT
* { codebase: "1.0.0", plugin: "v0.00a" }(2020 Aug 31 GMT 1400):
* 1. 1st testing version of this plugin finished
Download Link
Demo Link
Last edited: