MZ [Solved] Can I combine multiple PNGs into one "showPicture" call?

I assemble a character's image using individual images for clothes. Here is an example of the clothes and how the character actually looks with all of them on.

Spoiler: Illustration
Assembled:
Assembled.png


Pieces:
_D001_HAIR0001.png

_D001_TOP0001.png

_D001_BOTM0001.png

_D001_SHOE0001.png

Plus the body sprites.

The assembly is accomplished via multiple "$gameScreen.showPicture(...)" - about 30 such calls to dress a character, starting with tattoo, piercing, and up to gloves and glasses.

The problem is, there are shudders where some images are rendered with a delay, making the rendering anything but smooth.
Question:
- is it possible to "bake" al pictures into one and then display one picture? Or...

- is there a way to cache the images making sure all of them are rendered within the same frame?

Thank you.
Hi there!

With events in mind(mean, doing that with events), I can think of two things:

1 - Make all picture files the same size. So you will not have trouble with the positions.
2 - Show all pictures with opacity 0. Then you only need to change the opacity for them to appear.
the problem with this idea is that the show picture also assigns the ID to each picture, and that ID is absolutely needed for every single picture.

so the only way to combine those commands is to combine the picture into a single file.

you have only three options here, each with its own set of problems:
1) program/use a plugin that handles the files WITHOUT using show picture and its requirements
2) use a plugin to combine the partial pictures into a single picture, and then use that picture for show picture. This can be done (similar to a mapshot plugin creating a picture from map data), but might cause problems with deployment depending on access rights
3) combine the pictures outside the game - which means you can't have the player select clothing etc.
It's totally possible to manually bake pictures for each combination.
This can easily lead to wayyyy to many pictures. For example, say that you have:
  • 3 hair pieces
  • 5 tops
  • 4 bottoms
  • 3 shoes
This would mean you need to create 3 * 5 * 4 * 3 = 180 pngs.
This also means you will have to create loads and loads of conditional branches.
Considering you have 30 different elements I can't imagine it is feasible in your case given the combinatorial explosion. This includes doing the baking via scripting.


I recommend looking at how preloader scripts work and see if they can't help with your issue.
So, turned out my "rendering engine" had some massive slack in it; cutting this slack made it possible to instantaneously render multiple PNG files.

Here is what the issue was, using pseudocode:

Code:
- Loop until rendered all images:
   - Determine what the picture's name (and other parameters) should be.
   - Render the picture.

Became:

Code:
- Loop until determined all picture parameters:
   - Determine what the picture's name (and other parameters) should be.
   - Store these parameters in "render_queue", but do not render.

- Loop through the render queue:
   - Render the picture.

In my case this completely eliminated all the delays between image renders.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-can-i-combine-multiple-pngs-into-one-showpicture-call.140283/