Dynamic Event Pictures by Movement Route

DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
55
Reaction score
17
First Language
English
Primarily Uses
RMMV
Hi,

So I have some NPCs (events) with dynamic pictures based on a variable. I have the picture set to blank in the event itself, but then the movement route sets the picture on each event page with this script:

$gameMap.event(this._eventId).setImage('maids', $gameVariables.value(481));

This works great except that whenever the event loads, or I switch to the next page, the event disappears for a second or two before the picture loads. Any ideas how to fix this or work around it?

I have included screen captures of the event below.

Thanks!

PS In case your wondering this is the second script in the move route:
Screenshot 2020-10-29 204111.png
Screenshot 2020-10-29 204154.png
var intTime = $gameVariables.value(33); if (this.pos(2, 7)) {this.setDirection(8); $gameSwitches.setValue(489, true)}; if (this.pos(10, 5)) {this.setDirection(8); $gameSwitches.setValue(489, true)}; if (this.pos(14, 5)) {this.setDirection(8); $gameSwitches.setValue(489, true)}; if ([0,1,5,9].indexOf(intTime) >= 0) this.moveStraight(this.findDirectionTo(2, 7)); else if ([2,3,6,10].indexOf(intTime) >= 0) this.moveStraight(this.findDirectionTo(10, 5)); else if ([11,7,8,4].indexOf(intTime) >= 0) this.moveStraight(this.findDirectionTo(14, 5));
 

DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
55
Reaction score
17
First Language
English
Primarily Uses
RMMV
So I was able to improve the results by setting all of the event movements to the fastest speeds and frequencies, then in the movement route itself I change the movement to the desired speed/frequency.
 

DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
55
Reaction score
17
First Language
English
Primarily Uses
RMMV
So still wondering if anyone knows how to improve this...
I have an event with a blank image and then in the event's movement route I assign the picture based on a variable. The problem is, that when I first launch the event or switch between's the event pages there is a second or two pause before the movement route uploads the picture.

@caethyril , @Andar and @Hyouryuu-Na you have all been very helpful in the past, do you have any suggestions or wisdom you can share? Details and screen captures in the post above.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,044
Reaction score
1,474
First Language
EN
Primarily Uses
RMMZ
Some notes:
  • By default move routes process a maximum of one move command per frame, depending on move frequency. Highest frequency has no delay before each move command; every step down in frequency adds 30 frames (half a second) of delay. The move command queue also waits until the character has stopped moving before checking the next command.

  • When an event changes page, its move route is reset to the auto-move route of that page. At highest frequency, the first move command of that route should occur without delay. However, RMMV handles file access asynchronously, i.e. the game does not lock up while loading files.

  • When the game loads a new image from file, there will be some delay because disk access (even SSD) is much slower than RAM, plus the image (.png) will have to be decoded into bitmap data. Once the file has loaded, though, it will be in the game's image cache (RAM) and should load "instantly".

    The only real way around this is to increase the image cache size (e.g. Community_Basic plugin) and preload appropriate images. I'm not sure which preloader plugins are good, but SRDude generally makes quality stuff so maybe check his out:
    Increasing the image cache size is important because by default it is set quite low (10 Mpx). If the cache is full and the game loads a new image, the oldest reference(s) will be cleared to make room for the new image, meaning those files will have to be reloaded from disk if they're needed again.
 

DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
55
Reaction score
17
First Language
English
Primarily Uses
RMMV
Thanks so much @caethyril . I used the preloader and that didn't seem to help.

1604504440212.png

I have no idea reference on how much to change the image cache in community basic, would 20 be reasonable?

Ultimately, I think that this is my problem: "The move command queue also waits until the character has stopped moving before checking the next command. "

I have 4 NPCs each with 7 variations (hair color) moving around.

My time system parallel event sets all the switches to change the event pages at once (switches 1-4 = on),
the program sets the 1st NPC event image instantaneously, the event finishes its movement (1 second pause),
the program sets the 2nd NPC event image instantaneously, the event finishes its movement (1 second pause),
the program sets the 3rd NPC event image instantaneously, the event finishes its movement (1 second pause),
the program sets the 4th NPC event image instantaneously, the event finishes its movement (1 second pause).

So it seems like this is why I'm getting such big delays in image loading. I'll try experimenting with one of the clone event plugins. Maybe I can make an NPC template event and then clone it with the required images every time the map loads.

Thanks again for your help!

Also, thank you @Dopan, I am using the Galv pre-loader as it seems Sumrndmdde has stopped supporting his plugins.
 

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
481
Reaction score
204
First Language
German
Primarily Uses
RMMV
just to explain why i mentioned " Galv pre-loader "..
In the SRPG Thread, we once needed a Pre loader Plugin as walkaround for a Bug which was solved with a later update of the SRPG Core Plugin.
(some Imgs were not loaded like they should by default)
And i dont remember the reason but in some case using a pre loader made some Issues ..
(i think it was about performance but i am not sure without reading the Thread again)
However,..so people tried different Pre-loader Plugins, and the one from Galv, was the One that made no problems and with which we could solve the need of getting a Pre-loader Plugin..
(so i assumed the Galv Pre-loader Plugin could be helpfull if other Pre-loader Plugins are making any Issues and cant be used..)

But i cant say if that will help for your Case @DadGuyDrawing,..
(also the "Galv pre-loader" doesnt require any other Core Plugin what i preffer even if i use SRD Plugins anyway)
 
Last edited:

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,044
Reaction score
1,474
First Language
EN
Primarily Uses
RMMZ
My time system parallel event sets all the switches to change the event pages at once (switches 1-4 = on),
the program sets the 1st NPC event image instantaneously, the event finishes its movement (1 second pause),
the program sets the 2nd NPC event image instantaneously, the event finishes its movement (1 second pause),
I think I may have expressed myself in a confusing way. Every frame, each character updates its move route by 1 command, if it is not currently busy (e.g. if the character is currently moving or waiting). My guess is that the problem is related to cache size, not move route processing. :kaoswt:

I have no idea reference on how much to change the image cache in community basic, would 20 be reasonable?
Do not try to do this by editing the plugin code! Instead:
  1. Open the Plugin Manager;
  2. Double-click Community_Basic to view its parameters;
  3. Double-click the cacheLimit parameter to edit its value;
  4. Maybe try 50, depends a bit how many images you have in your project.
  5. Save your project to apply plugin changes before testing~
 

DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
55
Reaction score
17
First Language
English
Primarily Uses
RMMV
So I have set up the community basic plugin with 50 cacheLimit and set up Galv_ImageCache to include the two picture files that I want to use for the event's sprite.

Each event has a new page activated with a switch set to highest speed and Frequency and first line in the movement route is:
"$gameMap.event(this._eventId).setImage('maids', $gameVariables.value(483))"

I have loaded a brand new game with these and flipped the switch manually and there is a 1 - 6 second pause where each of the two events goes blank.

Do I have something wrong with how I set up the plugins?

1604531692653.png1604531329673.png1604531360863.png
1604531433484.png
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,044
Reaction score
1,474
First Language
EN
Primarily Uses
RMMZ
Wait, you're actually seeing up to 6 seconds of delay? :kaoback: That's definitely not normal.
  1. Does the framerate drop a lot when you turn on the switch? You can view the framerate widget by pressing F2 during play. If it does, I'd suggest checking your event setup for anything that might start processing when that switch turns on. Remember both Autorun and Parallel trigger events will trigger each frame they are active and not currently running.

  2. If you open the Task Manager, do you see any spikes in CPU/RAM usage when you turn on that switch? For example, I've seen active script-scanning (anti-virus/-malware app feature) make RMMV games run slowly before; in that case you can mark your project folder (and possibly your RPG Maker install folder) as "trusted" (or equivalent) in the AV app settings.

  3. It may simply be inefficient eventing. From what I've seen it looks like a complex system of events, though, so I'd personally rather not get involved in the details there. That said, maybe consider reworking certain parts to avoid repeating things that were already done, e.g. rather than set each event's image in a repeating auto-move route, set all of a map's event images with Script command(s) in a self-erasing Parallel map event:
    Code:
    ◆Comment:Set this map's NPC event images
    ◆Script:$gameMap.event(5).setImage('maids', $gameVariables.value(483));
    :      :$gameMap.event(6).setImage('maids', $gameVariables.value(484));
    :      :// etc
    ◆Comment:Do once per map visit
    ◆Erase Event
Not sure what else to suggest... :kaoslp:
 

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
481
Reaction score
204
First Language
German
Primarily Uses
RMMV
@DadGuyDrawing

Perhaps your Pre-loader Setup is wrong .. here some IMGs for better understanding
Screenshot_1.png
This above Shows what Images were Pre Loaded
Screenshot_2.png
This is the Setup that we Used in The Tutorial SRPG demo which i mentioned earlier..
(even if this Setup isnt needed thanks of SRPG_Core Plugin Fix, i didnt changed it .. in order to show how the Setup works)
 

DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
55
Reaction score
17
First Language
English
Primarily Uses
RMMV
I'll review this tonight and see how it goes, this is my first RPGMaker MV project (9 months in now) and I made the mistake of going for an epic RPG on my first project.

As you can imagine, it is filled with horrible eventing, inefficient variable/switch uses etc. As I progress through the project I look back at the stuff I made in the beginning and I'm like *cringe/facepalm*. I've toyed with the idea of rebuilding the game from scratch, but there doesn't seem to be an efficient way to copy and paste pieces from the original project into a new project.

In retrospect, I really wish that I had started with a couple of small projects first. I'm afraid that if take too much time away from my project now, I will forget half of my overly complex eventing scheme.

Anyway, I think option 3 might be the way to go here. I'll have to look up self-erasing events.

@caethyril , long story short, you have been very generous with your time and expertise and I'm very grateful. Do you have a ******* or something that I can support?

Wait, you're actually seeing up to 6 seconds of delay? :kaoback: That's definitely not normal.
  1. Does the framerate drop a lot when you turn on the switch? You can view the framerate widget by pressing F2 during play. If it does, I'd suggest checking your event setup for anything that might start processing when that switch turns on. Remember both Autorun and Parallel trigger events will trigger each frame they are active and not currently running.

  2. If you open the Task Manager, do you see any spikes in CPU/RAM usage when you turn on that switch? For example, I've seen active script-scanning (anti-virus/-malware app feature) make RMMV games run slowly before; in that case you can mark your project folder (and possibly your RPG Maker install folder) as "trusted" (or equivalent) in the AV app settings.

  3. It may simply be inefficient eventing. From what I've seen it looks like a complex system of events, though, so I'd personally rather not get involved in the details there. That said, maybe consider reworking certain parts to avoid repeating things that were already done, e.g. rather than set each event's image in a repeating auto-move route, set all of a map's event images with Script command(s) in a self-erasing Parallel map event:
    Code:
    ◆Comment:Set this map's NPC event images
    ◆Script:$gameMap.event(5).setImage('maids', $gameVariables.value(483));
    : :$gameMap.event(6).setImage('maids', $gameVariables.value(484));
    : :// etc
    ◆Comment:Do once per map visit
    ◆Erase Event
Not sure what else to suggest... :kaoslp:
 

DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
55
Reaction score
17
First Language
English
Primarily Uses
RMMV
Thank you @Dopan this helps, I will go through and try to check this tonight!
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,044
Reaction score
1,474
First Language
EN
Primarily Uses
RMMZ
...there doesn't seem to be an efficient way to copy and paste pieces from the original project into a new project.
You should be able to launch multiple instances of the editor via the project file, e.g. open the editor as usual, then find an existing project folder and double-click its Game.rpgproject file. This can make copying over blocks of event commands or individual database entries much easier! :kaothx:

In case you're interested, there's a "database converter" app available for MV. It's just an import/export tool, but might be handy. You can find it on RPG Maker Web's Additional Downloads page, or on Steam.
In retrospect, I really wish that I had started with a couple of small projects first.
It's a common mistake! Maybe consider putting the big project on hold for a bit while you look up some tutorials and/or try out stuff like the One Map Game Challenge? :)
I'll have to look up self-erasing events.
It's a pretty simple concept: the Erase Event command makes an event disappear until the player leaves then revisits the map. This makes it ideal for "do once per visit" events: let the event trigger, then erase itself at the end. Event pages are for a similar thing, except typically on a per-playthrough basis rather than per-map-visit. :kaopride:
Do you have a ******* or something that I can support?
I don't have a means of donation set up at present, no. :kaoslp:
 

DadGuyDrawing

Veteran
Veteran
Joined
Apr 15, 2020
Messages
55
Reaction score
17
First Language
English
Primarily Uses
RMMV
Ugh, figured it out.

So below is the movement route immediately before the new event page. Basically I had the events move somewhere and step in place for a random period while a "sweeping" or "talking" stepping animation was playing.

I guess when the switch flipped to the new event page it would instantly put in the new blank image, but wait for the previous movement route (which included the random wait times) to complete before starting the movement route on the new page that included the new event image.

Thanks to you all for your help!

1604630844926.png
 
Last edited:

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

Latest Threads

Latest Profile Posts

currently listening to Driftwood Gaming streaming some MZ dev time and it's delightful! had no idea they were this entertaining, love it
In quarantine, will be tested soon. This year is really something... special.
I was at another orientation yesterday and I realized I'll be working with an old friend! We met at the local water park a few years back and it was so nice to see her again! We had a chat, and next week when I officially start, I'll see if maybe we can trade our Zoom IDs so we can talk!
I made some sideview closets for MV!
You can find them in my MV resource thread.

Forum statistics

Threads
105,509
Messages
1,014,320
Members
137,194
Latest member
purboy
Top