DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,828
Reaction score
974
First Language
Chinese
Primarily Uses
N/A
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

JavaScript:
* @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 []

JavaScript:
* 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

JavaScript:
*    # 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

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 )

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.

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

* v1.00b(GMT 0300 27-Mar-2020):
* 1. You no longer have to edit the value of
* DoubleX_RMMZ.Preloaded_Resources_File when changing the plugin file
* name
* 2. Fixed the crashes when preloading animations, images, etc, wthout
* hues(such cases will be understood as having the default hue 0 only)
v1.00a(GMT 1500 7-Jul-2020):
1. 1st version of this plugin finished

Download Link
Pastebin
 

Attachments

  • doublex rmmv preloaded resources v100b.js
    53.3 KB · Views: 7
Last edited:

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,828
Reaction score
974
First Language
Chinese
Primarily Uses
N/A
Updates
Code:
 *      v1.00b(GMT 0300 27-Mar-2020):
 *      1. You no longer have to edit the value of
 *         DoubleX_RMMZ.Preloaded_Resources_File when changing the plugin file
 *         name
 *      2. Fixed the crashes when preloading animations, images, etc, wthout
 *         hues(such cases will be understood as having the default hue 0 only)
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
797
Reaction score
641
First Language
English
Primarily Uses
RMMV
Thanks for the update! This plugin is really helpful in my project.
 

Latest Threads

Latest Posts

Latest Profile Posts

Make a Game in RMMZ Streams are going to remain in hiatus this week. Too much to do! 4 things will be announced on Monday though! Look forward to that.
Typed a long-ish reply to a post... forgot to actually HIT the post button, and moved to a different page.... finally noticed, don't remember what all I had typed and don't feel like trying to re-type it all.... smh....
Their tactics are evolving. They've learned to call for help when cornered. Never trust a mammal!
Good morning all. I still have a post up on video editing for cinematic trailers. Please make sure to check that out and give me a message as its still active in offers.
Hey everyone! I'm back :D

Snow White? More like Snowhere to be seen amiright? Hahaha I'm so sorry!! :kaocry:

Forum statistics

Threads
112,371
Messages
1,067,842
Members
146,017
Latest member
Anselmo00
Top