2k/3 Question about lag with pictures

Hello everyone, happy holidays.

I was testing to make a picture—set as a spritesheet—follow the player. It works fine, but on large maps it causes a lot of lag, which I kind of expected, but I was wondering what the best way to do this is without running into this issue.

For now, I'm getting this effect by using a parallel process common event that stores the player's screen X and Y position into variables. Then I use the "Show Picture" command to display the image at those coordinates, and inside a loop I continuously update the variables and use "Move Picture" to make the picture "follow" the player. I also tried adding a “Wait” command, but nothing changed.

Do you have any suggestions for a better approach? Thanks a lot for the help.
The Parallel is a loop itself, so you don't need a loop in there.

And what is Variable 15 (Z) = Screen (X) doing?

I'd suggest to initialize the "Show Picture" only once and do the move with a wait behind it.
I'm not sure what exactly the outcome is supposed to be, but I'd do a first try like this.

<> varbl 13 = Players Screen X
<> varbl 14 = Players Screen Y
<> varbl 13 + 6
<> varbl 14 - 31
IF Switch (Picture on) = OFF
<> Show Picture 1
<> Switch (Picture on) = ON
ELSE
<> Move Picture 1
END
wait 1

Whenever the Picture is going away, you want to turn the switch back off.
Thank you so much! This does fix the lag. However, now the picture moves with delay when the screen is not scrolling (like on small maps or when moving the player close to the end of a map)—I hope that makes sense. Do you happen to know how I could fix it?

And sorry about variable 15; it’s not used here and it appeared in the screenshot accidentally, but I’ve already fixed it, thank you for pointing that out.
Disable the Scroll Picture with Map option in Show Picture command
Disable the Scroll Picture with Map option in Show Picture command
Thank you, but the option is already disabled. Do you know what else could be causing it?
If the Picture is showing a 0.0s delay, it should be instantaneous. I tested it on a computer with an older processor and it worked normally.
Do you mean the setting in the Wait command? If so, I also tried a wait time of 0.0, but the position of the picture is still delayed by a few pixels.
please show a screenshot of the current event including past corrections for further bughunting
Sure! Here's a screenshot of the current event.
That Wait at the end of the event isn't necessary, the Move Picture event already has that as a parameter.

Otherwise, I don't see anything wrong with the event.
Understood. Here's a comparison about my issue, I hope it makes sense:

* Screenshot A: When the player is moving and the screen is also scrolling, the picture (the red circle) follows the player’s position perfectly.
* Screenshot B: When the player is moving along small maps or the end of a map (where the screen stops scrolling), the picture starts to move with a few pixels of delay, even with a 0.0 wait time.

Ideally, the picture should follow the player with zero delay. Thank you all again for your help.
That's very strange. Create a new project, copy the picture and the common event to this new project, compress it into a ZIP file, and send it here via MediaFire so we can analyze it.

Spoiler
I thought it might be because the Picture has odd width and height values, which could affect the image's centering in certain situations, but I've never actually seen it happen in RPG Maker.
OK, thank you, here's the MediaFire link.
I tested it on RM2K3 and noticed only one lagging pixel that aligns itself when the player stops, it's almost imperceptible.

I copied the event to RM2K, cropped the image with an editor, imported it, ran the test, and it still doesn't happen.

So that made me wonder if it might be something related to the RM2K3 renderer, which uses GDI, while RM2K only uses DirectDraw.

I switched from GDI to DirectDraw in RM2K3, ran the test, and the problem didn't occur again, or at least it's no longer noticeable.
1766880139532.png


But at times I can notice a slight delay, if I enable Wait for Completion in Move Picture, It's understandable why this doesn't happen in the middle of large maps. it's because the player is actually stationary on the screen, while the map is not moving, so the two variables are not changing values.
Thank you for testing the event!

I tried switching to DirectDraw in RM2k3, but there are still exactly 2 pixels of delay when the screen is not scrolling. I also tested the event in an RM2k project, and I noticed the same delay there as well—on two different computers.

It's almost imperceptible, but for something like, for example, complementing characters with pictures, I'd love pixel-perfect synchronization. Do you happen to know anything else I could try?
I really don't know how to solve this for now, maybe only with battle animation.
This reminded me that I made a system where the map is a Picture and the player is always in the center of the screen, being another Picture. The hardest part was making the player pass behind and in front of the NPCs' pictures.
Depending on what you're planning, it could be a solution, but it's very time-consuming.
Well, if it works on large maps except at the edges(where the map no longer scrolls), maybe, at least for now, the solution is to make all maps big enough that you don't go to the edge of the map(make it so the in game boundaries with collision prevent you from getting to the point where the map stops scrolling and the sprite/picture begins moving).

Also last thing to add, for me, a good rule of thumb is to avoid endless loops/parallel events etc as much as you can(ideally, you would have none that go on forever). If your experiencing lag or lock ups, this is the most common cause and therefore any alternative method you can do to avoid this is preferable.

At the very least there should be a condition for when it needs to stop, like a switch or a counter etc, and if you absolutely need to constantly check for something, put a wait command of something small like 0.1s.
Great. Thanks everyone for the help and suggestions! I'll keep experimenting with other approaches, and I'll stay tuned in case anyone has more ideas. Thanks again and Happy New Year!

Original thread: https://forums.rpgmakerweb.com/threads/question-about-lag-with-pictures.181615/