rpgtkoolmv / corescript

http://www.rpgmakerweb.com/products/programs/rpg-maker-mv
MIT License
311 stars 75 forks source link

Appropriateness on accessing `$gameSystem` from `Scene_Base` #175

Closed rev2nym closed 5 years ago

rev2nym commented 5 years ago

The issue

The present community edition corescript conflict with "MadeWithMv.js" of a plugin bundled by initial project data. The cause is calling $gameSystem.onFrameUpdate() from Scene_Base when$gameSystem isn't generated yet. $gameSystem.onFrameUpdate() is the method to update $gameSystem._frameCount incrementally. $gameSystem is generated by Scene_Boot.start(). Therefore should not access game objects such as $gameSystem before Scene_Boot.start().

There are several issues here.

Resolution of conflict with "MadeWithMv.js"

However, this conflict is also a defect on the plugin side, so the priority is low.

Shouldn't access game objects from Scene_Base.

It isn't ensured that generation of game objects is complete when Scene_Base running. This should be fixed.

Is calling setupNewGame() from Scene_Boot appropriate?

Though a new game has not started yet in Scene_Boot, DataManager.setupNewGame() is called from Scene_Boot. So I think this is the most important in this issue probably.

Shouldn't it be made $gameSystem.update() ?

When the processing is called to 1 frame once certainly, it's appropriate to make it the update().

The use of $gameSystem._framesOnSave is unclear.

$gameSystem._frameCount is included in a save file, so _framesOnSave isn't useful.

After all what was the reason Graphics.frameCount put out?

And what was the reason Graphics.frameCount still exist at other parts?

Ideas of solution

Then, where should be setupNewGame() called from?

I think Plan B is better. It can indicate new game clearly.

How access $gameSystem._frameCount ?

Establishing another Basing Scene class (for example, Scene_GameBase). Making Scene classes of whole game after title extend newly Scene class established.

...And consider that later about $gameSystem._framesOnSave and Graphics.frameCount.

krmbn0576 commented 5 years ago

Thanks! Before entering upon a discussion of this issue, I linked diffs below for convenience. https://github.com/rev2nym/corescript/compare/master...05737849a1adf2650c8f4344f65dae7fd80f5244

See #171. I will see other questions and your proposal later ;-)

rev2nym commented 5 years ago

Thank you. I understand meaning.

Please check what _framesOnSave is doing. _framesOnSave is not _frameCount. _framesOnSave copies Graphics.frameCount befor make savedata and _framesOnSave plugs _frameCount after load savedata. So after all _frameCount and Graphics.frameCount are the same price. I think there is something wrong...

...And If we want measure time, isn't Date.now() more appropriate?

p.s. By the way, should I send Pull Request of this branch?

rev2nym commented 5 years ago

I abandoned large modifications to maintain compatibility. I removed the access to $gameSystem by Scene_Base for the time being.