Jump to content
DoubleX

DoubleX RMMV Preloaded Resources

Recommended Posts

Posted (edited)

Purpose

Lets you sets some audios/images to be loaded upon game start

This should boost the FPS on phones noticeably if there's enough memory

 

Parameters

Spoiler

 * @param IsPreloadAudio
 * @type boolean
 * @desc Sets whether the specified audios will be preloaded
 * @default true
 *
 * @param preloadAudioMSInterval
 * @parent IsPreloadAudio
 * @type number
 * @desc Sets the number of milliseconds to wait before loading the
 * next audio included by the same parameter(0 means no wait)
 * @default 0
 *
 * @param preloadedBGMs
 * @parent IsPreloadAudio
 * @type file[]
 * @dir audio/bgm/
 * @desc Sets the list of BGMs to be preloaded
 * @default []
 *
 * @param preloadedBGSs
 * @parent IsPreloadAudio
 * @type file[]
 * @dir audio/bgs/
 * @desc Sets the list of BGSs to be preloaded
 * @default []
 *
 * @param preloadedMEs
 * @parent IsPreloadAudio
 * @type file[]
 * @dir audio/me/
 * @desc Sets the list of MEs to be preloaded
 * @default []
 *
 * @param preloadedSEs
 * @parent IsPreloadAudio
 * @type file[]
 * @dir audio/se/
 * @desc Sets the list of SEs to be preloaded
 * @default []
 *
 * @param preloadedStaticSEs
 * @parent IsPreloadAudio
 * @type file[]
 * @dir audio/se/
 * @desc Sets the list of static SEs to be preloaded
 * @default []
 *
 * @param preloadedMiscAudios
 * @parent IsPreloadAudio
 * @type file[]
 * @dir audio/
 * @desc Sets the list of other audio files to be preloaded
 * @default []
 *
 * @param IsPreloadImage
 * @type boolean
 * @desc Sets whether the specified images will be preloaded
 * @default true
 *
 * @param preloadImageMSInterval
 * @parent IsPreloadImage
 * @type number
 * @desc Sets the number of milliseconds to wait before loading the
 * next hue and image under the same parameter(0 means no wait)
 * @default 0
 *
 * @param preloadedAnimations
 * @parent IsPreloadImage
 * @type struct<PreloadedAnimation>[]
 * @desc Sets the list of animations to be preloaded
 * @default []
 *
 * @param preloadedBattleBack1s
 * @parent IsPreloadImage
 * @type struct<PreloadedBattleBack1>[]
 * @desc Sets the list of 1st battle backs to be preloaded
 * @default []
 *
 * @param preloadedBattleBack2s
 * @parent IsPreloadImage
 * @type struct<PreloadedBattleBack2>[]
 * @desc Sets the list of 2nd battle backs to be preloaded
 * @default []
 *
 * @param preloadedCharacters
 * @parent IsPreloadImage
 * @type struct<PreloadedCharacter>[]
 * @desc Sets the list of characters to be preloaded
 * @default []
 *
 * @param preloadedEnemies
 * @parent IsPreloadImage
 * @type struct<PreloadedEnemy>[]
 * @desc Sets the list of enemies to be preloaded
 * @default []
 *
 * @param preloadedFaces
 * @parent IsPreloadImage
 * @type struct<PreloadedFace>[]
 * @desc Sets the list of faces to be preloaded
 * @default []
 *
 * @param preloadedParallaxes
 * @parent IsPreloadImage
 * @type struct<PreloadedParallax>[]
 * @desc Sets the list of parallaxes to be preloaded
 * @default []
 *
 * @param preloadedPictures
 * @parent IsPreloadImage
 * @type struct<PreloadedPicture>[]
 * @desc Sets the list of pictures to be preloaded
 * @default []
 *
 * @param preloadedSVActors
 * @parent IsPreloadImage
 * @type struct<PreloadedSVActor>[]
 * @desc Sets the list of sideview actors to be preloaded
 * @default []
 *
 * @param preloadedSVEnemies
 * @parent IsPreloadImage
 * @type struct<PreloadedSVEnemy>[]
 * @desc Sets the list of sideview enemies to be preloaded
 * @default []
 *
 * @param preloadedSystem
 * @parent IsPreloadImage
 * @type struct<PreloadedSystem>[]
 * @desc Sets the list of system images to be preloaded
 * @default []
 *
 * @param preloadedTilesets
 * @parent IsPreloadImage
 * @type struct<PreloadedTileset>[]
 * @desc Sets the list of tilesets to be preloaded
 * @default []
 *
 * @param preloadedTitles1
 * @parent IsPreloadImage
 * @type struct<PreloadedTitle1>[]
 * @desc Sets the list of 1st titles to be preloaded
 * @default []
 *
 * @param preloadedTitles2
 * @parent IsPreloadImage
 * @type struct<PreloadedTitle2>[]
 * @desc Sets the list of 2nd titles to be preloaded
 * @default []
 *
 * @param preloadedMiscImages
 * @parent IsPreloadImage
 * @type struct<PreloadedMiscImage>[]
 * @desc Sets the list of other image files to be preloaded
 * @default []

 

 

Help

Spoiler

 * 1. You should only preload resources that are actually used or the game can
 *    take an excessively and unnecessarily long time to start
 * 2. You might have to test the values of preloadAudioMSInterval and
 *    preloadImageMSInterval to have the optimal preload time for your project
 * 3. Setting preloadAudioMSInterval/preloadImageMSInterval as 0 might block
 *    the UI thread for too long and thus crashing/freezing the game in phones
 * 4. You should consider not preloading resources that are only rarely used
 *    in case the preloading times are still too long
 * 5. Some plugins might use HTML5Audio instead of WebAudio, and preloading
 *    audios using HTML5Audio is meaningless HTML5Audio is a static class
 *    having nothing to preload
 * 6. You should compress the resources to be preoloaded for phones or the
 *    extra memory consumption from preloading them can quickly crash/free the
 *    game there
 * 7. No identical resource should be duplicated in the same parameter or
 *    across parameters(this plugin won't explicitly skip those duplicates as
 *    simplifying the codes this way can actually reduce preload time)
 * 8. If you want to keep the current parameter values in the plugin manager
 *    upon using a newer version, you can do the following:
 *    - Renames the newer version to be that of the older version
 *    - Edits the value of DoubleX_RMMV.Preloaded_Resources_File to be the
 *      filename of the older version, which must be done via opening this
 *      plugin js file directly
 * 9. (Advanced)By default, the images are cached upon first used, and the
 *    cache is a Least Recently Used(LRU) cache. This plugin reserves all
 *    preloaded images so the LRU will never release them unless they're
 *    explicitly told to be released via a script call

 

 

Script Call Info

Spoiler

 *    # Image manipulations
 *      1. ImageManager.releasePreloadedFolderImg(param, filename, hue)
 *         - Releases the image with the filename filename and hue hue
 *           specified in parameter param
 *         - This can be useful when an image becomes rarely used and/or the
 *           preloaded images are consuming too much memory
 *         - Please note that using this script call doesn't always remove the
 *           image from the LRU cache instantly as it's still up to the LRU
 *           cache to determine when to remove that image now that it can be
 *           removed due to no longer being reserved
 *         - param and filename are supposed to be String
 *         - hue is supposed to be an integer from 0 to 360 inclusive
 *         - The script call's supposed to be Idempotent
 *      2. ImageManager.releasePreloadedMiscImg(path, hue, smooth)
 *         - Releases the image with the path path, hue hue and smooth smooth
 *         - This can be useful when an image becomes rarely used and/or the
 *           preloaded images are consuming too much memory
 *         - Please note that using this script call doesn't always remove the
 *           image from the LRU cache instantly as it's still up to the LRU
 *           cache to determine when to remove that image now that it can be
 *           removed due to no longer being reserved
 *         - path is supposed to be a String
 *         - hue is supposed to be an integer from 0 to 360 inclusive
 *         - smooth is supposed to be a Boolean
 *         - The script call's supposed to be Idempotent
 *    # Audio manipulations
 *      1. AudioManager.invalidateCachedWebAudio(folder, name)
 *         - Releases the audio with folder folder and filename name from the
 *           audio cache
 *         - This only works for non static SE audio loaded as WebAudio
 *         - folder is supposed to be a String
 *         - name is supposed to be a String
 *         - The script call's supposed to be Idempotent

 

 

Prerequisites

Spoiler

Abilities:

1. Nothing special for most ordinary cases

   (No capability on Javascript ES5 experience but can still make reasonable guesses on readable novice codes up to 100 LoC scale)

2. Little RMMV plugin development proficiency to fully utilize this plugin in intended ways

(Elementary Javascript ES5 exposures being able to write beginner codes up to 300LoC scale )

 

Instructions

Spoiler

1. The default plugin parameters file name is doublex rmmv preloaded resources v100a

If you want to change that, you must edit the value of DoubleX_RMMV.Preloaded_Resources_File, which must be done via opening this plugin js file directly

 

Terms Of Use

Spoiler

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.

 

Contributors

Spoiler

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

 

Changelog

Spoiler

v1.00a(GMT 1500 7-Jul-2020):

1. 1st version of this plugin finished

 

Download Link

Pastebin

 

doublex rmmv preloaded resources v100a.js

Edited by DoubleX

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×