Closed ghost closed 7 years ago
If you do that, you also can remove my CacheMap and CacheEntry, they were made for that particular thing :)
Found format-only changes! :-) Bitmap 317-320, 359, 726 ImageManager 89, 94, 101, 103, 110 (These may not be problematic because they are surrounded by changes) Scene_Base 1 Scene_Boot 1
Thanks a lot!
Limits 1 connection (see RequestQueue.js)
Why? Parallel loading is evil?
Clear queue when Scene changes.
I think ImageManager.clearRequest();
is called only when Scene_Map
terminated.
Is this OK?
Why? Parallel loading is evil?
There may be another connections, so We'd better not consume connection limit for background loading. This loading request is lower priority.
I think ImageManager.clearRequest(); is called only when Scene_Map terminated. Is this OK?
Currently background loading occurs only Scene_Map, and canceling by another scene(such as Status) makes background loading useless.
canceling by another scene(such as Status) makes background loading useless.
Well, canceling occurs no matter which the next scene is. "Useless" situation occurs anyway...
Well, canceling occurs no matter which the next scene is. "Useless" situation occurs anyway...
Oops you are right. I must consider about when to remove requests...
after finish review, I'll re-test them.
BTW, I'm wondering if we should increase private methods any more.
Plugin creators and scriptors may not know "_ is private", so it seems better not to define them except for rpg_core.js.
In fact, the private methods of the rest five files are only Spriteset_Map#_canvasReAddParallax, SceneManager._getTimeInMs(WithoutMobileSafari)
and the currently proposed SceneManager._doesNeedClearingRequest
.
None of these methods are from the beginning.
Initially, the following implementation seems to be simpler.
Scene_Map.prototype.terminate = function() {
// above and below omitted
if (SceneManager.isNextScene(Scene_Map)) {
ImageManager.clearRequest();
}
};
Currently background loading occurs only Scene_Map
Oh, I just now realized that this was wrong.
Game_Interpreter
is also used for BattleEvent!
I want to aggregate responsibility of clearing request.
Clearing request only occurs when scene is changed. and SceneManager is the only class that have responsibility of Scene-to-Scene management
As you say, there are some chance to need clearing request. (Scene_Battle)
Initially, the following implementation seems to be simpler.
after a bit, I also think the implementation is overpowered. I'll follow the suggestion.
I still think that some ImageManager.loadXxx
should be replaced by reserveXxx
, because there are behaviors that expect to wait until it is loaded. (by using ImageManager.isReady
)
Sprite_Picture#loadBitmap (first time only)
Spriteset_Map#loadTileset, _canvasReAddParallax, updateParallax (first time only)
Spriteset_Battle#battleback1,2Bitmap (first time only)
Sprite_Animation#loadBitmaps
Window_Message#updateLoading
Of course, it is rare case that these are purged before ImageManager.isReady
is called, but it should be cared from semantics.
I still think that some ImageManager.loadXxx should be replaced by reserveXxx, because there are behaviors that expect to wait until it is loaded. (by using ImageManager.isReady)
reserveXXX
fires loading and grantees to hold by ImageManager.
Bitmap is still valid if it was purged from ImageManager, so We don't need replace them.
Of course it's valid, but I am talking about the behavior of ImageManager.isReady
.
Previously, because all bitmaps were cached, ImageManager.isReady() === true
indicated that "all bitmaps are ready."
However, now it'll be true even if the purged bitmap is not ready. So the meaning of the method is broken.
Understood.
The problem is, We break isReady
semantics.
I'll change isReady
implementation.
OK, finally I finished the review!
We'll postpone the solution of reserveFace
and request placeholder.
After you re-test it and resolve the conflict, I'll approve it.
LGTM! 🍣 😇 ❤️
Main strategy:
Purging Strategy:
Bitmap is rewritten to state based. Original Bitmap Implementation is managed by flags. (see Bitmap.js)
Background Preload Strategy:
Any question welcome!