Recommended way to load note-tags?

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English
I have two ways that I would like to load note-tags


1. When the database has finished loading. I would like to go to a particular database and just load all note-tags.


2. When the data is needed. This is just lazy-loading.


I have the second part figured out for the most part, but what would be the best way to load note-tags after database has finished loading?
 

Yanfly

Veteran
Joined
Mar 15, 2012
Messages
1,742
Reaction score
2,637
I used to do method 2 back in the VX days. As a result, I found it can cause unfortunate amounts of lag at unoportune times if you have a lot of data to sift through, which was why I moved to loading notetag data while the game database is loading. It's also what MV does with its automatic notetag parser. In my opinion, while I'm playing games, I'd rather wait for some load time at the start than to get random spurts of lag spikes throughout gameplay. Even in an RPG, it can get pretty irritating (looking at you, Ar Tonelico 2).

As for how to load it for #1, I just have everything done at the DataManager.isDatabaseLoaded function.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English
I used to do method 2 back in the VX days. As a result, I found it can cause unfortunate amounts of lag at unoportune times if you have a lot of data to sift through, which was why I moved to loading notetag data while the game database is loading. It's also what MV does with its automatic notetag parser. In my opinion, while I'm playing games, I'd rather wait for some load time at the start than to get random spurts of lag spikes throughout gameplay. Even in an RPG, it can get pretty irritating (looking at you, Ar Tonelico 2).

As for how to load it for #1, I just have everything done at the DataManager.isDatabaseLoaded function.
So basically something like

if (my stuff not loaded) <do something>endreturn old_stuffAnd that do_something will set some flag to true.But how do I make sure the data I want is available?

I prefer lazy-loading because it would improve old-save-file compatibility in case someone adds a script afterwards, but old save files don't have it, but I guess they'd use some sort of save-file patcher for that.
 
Last edited by a moderator:

Yanfly

Veteran
Joined
Mar 15, 2012
Messages
1,742
Reaction score
2,637
You can always check to see if the data is available. For example, if $dataWeapons[1].attribute is something that would be added, you can go with 

if ($dataWeapons[1].attribute === undefined) { $dataWeapons[1].attribute = 'defined';}As far as loading save data though, the $dataX information is always made at the start of any game instance, so there shouldn't be any issues collecting data unless the obj in question is independent of the base $data. When that happens, I just do the method I posted above and have the data update itself equal to the base object data to synch it together.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English
Wait, I just realized I posted this in a resource topic lol that's weird. Must've clicked on the wrong sub-forum and thought this was JS support.

You can always check to see if the data is available. For example, if $dataWeapons[1].attribute is something that would be added, you can go with
What do you think of attaching load listeners to the database when certain files are loaded?

so there shouldn't be any issues collecting data unless the obj in question is independent of the base $data
Yes, I was thinking of things like if the data was stored with game actor objects.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
I was trying to figure out why this was here as well, until I read your post. So you're talking about MV? I'll move it over there then.


If it's a simple <tag: value> then it gets loaded automatically and you don't have to do anything at all.


If it's a more complicated structure (like nested), in previous makers you would add a call at the end of load_normal_database and process everything, but as MV loads asynchronously, the data will not be there at that point. You could either alias the method that builds the notetag data and know it will be called at the correct time, or you'd need to find out at what point the data load is complete (ie - what function finally triggers when DataManager says everything is loaded) and add your own processing there. I used the second method in the Lazy Tilesets plugin, but I'm not certain I got the right function. I think the first method might be cleaner, if you can manage it, and it has the added benefit of being run for maps as they are loaded, too.
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
In a recent plugin i'm writing, i extended Scene_Boot.prototype.terminate, since it's guaranteed to only run once, after all data has been loaded, and load all my notetags in there.

If you want to parse notetags for everything (like i do in my Note Files plugin), DataManager.extractMetadata is probably the right place. Since i also needed to async load my own files, i exported the original extractMetadata in a callback, that's executed once my data finishes loading.
 
Last edited by a moderator:

JahwsUF

Veteran
Veteran
Joined
Oct 25, 2015
Messages
65
Reaction score
104
First Language
English
I used to do method 2 back in the VX days. As a result, I found it can cause unfortunate amounts of lag at unoportune times if you have a lot of data to sift through, which was why I moved to loading notetag data while the game database is loading. It's also what MV does with its automatic notetag parser. In my opinion, while I'm playing games, I'd rather wait for some load time at the start than to get random spurts of lag spikes throughout gameplay. Even in an RPG, it can get pretty irritating (looking at you, Ar Tonelico 2).

As for how to load it for #1, I just have everything done at the DataManager.isDatabaseLoaded function.
I've done this as well, partly because of having read Yanfly's code to learn how to write my own plugins.

The majority of game data is loaded when your game boots up.  Not all of it does, though...  should you have note tags on maps or on map-based events, those are only loaded when you transfer into the map.  They simply aren't loaded otherwise by the system.  If you want to process those ahead of time, you have to write custom code to pre-load the data... which is something I've done for a personal side plugin I've been working on off and on.

I noticed above you're especially thinking about the Actor objects - you'll be totally safe loading it like Yanfly mentions.  Just make sure not to throw out any connections other plugins might have made to the same location, 'cause that causes incompatibility.  (If you write a new function, be sure to save the old one somewhere and call the old one within your new one.)
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English
I've done this as well, partly because of having read Yanfly's code to learn how to write my own plugins.


The majority of game data is loaded when your game boots up.  Not all of it does, though...  should you have note tags on maps or on map-based events, those are only loaded when you transfer into the map.  They simply aren't loaded otherwise by the system.  If you want to process those ahead of time, you have to write custom code to pre-load the data... which is something I've done for a personal side plugin I've been working on off and on.


I noticed above you're especially thinking about the Actor objects - you'll be totally safe loading it like Yanfly mentions.  Just make sure not to throw out any connections other plugins might have made to the same location, 'cause that causes incompatibility.  (If you write a new function, be sure to save the old one somewhere and call the old one within your new one.)
One of the biggest issues back in the older RM versions was devs adding new scripts after releasing their game (or adding new scripts after creating some test save points), and the new scripts breaking old save files.


This could be due to any number of reasons, but it was mainly because


1. New script tried to access a value


2. New script did not provide proper checks in place in the case that the value does not actually exist, or is invalid


This of course can be considered an error on the plugin writer's part, because they failed to consider the possibility that someone might be using their plugin AFTER they've released the game, and save files have already been made.


I'll have to do some tests to see if, for example, the actor loading problem is no longer an issue in MV.
 
Last edited by a moderator:

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
I'll have to do some tests to see if, for example, the actor loading problem is no longer an issue in MV.
It is, actors are still stored and loaded with the savefile.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,018
Messages
1,018,357
Members
137,803
Latest member
andrewcole
Top