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

Status
Not open for further replies.

Sepheyer

Veteran
Veteran
Joined
Jul 20, 2021
Messages
59
Reaction score
29
First Language
English
Primarily Uses
RMMZ
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.

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.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,291
Reaction score
1,789
First Language
Portuguese - Br
Primarily Uses
RMMZ
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.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,310
Reaction score
8,752
First Language
German
Primarily Uses
RMMV
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.
 
Last edited:

Zeriab

Huggins!
Veteran
Joined
Mar 20, 2012
Messages
1,308
Reaction score
1,512
First Language
English
Primarily Uses
Other
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.
 

Sepheyer

Veteran
Veteran
Joined
Jul 20, 2021
Messages
59
Reaction score
29
First Language
English
Primarily Uses
RMMZ
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.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
9,115
Reaction score
5,968
First Language
Dutch
Primarily Uses
RMXP

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.

 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

Mod name: "[Game name] Gameplay Overhaul"
What they actually mean: "Here is a mod that makes the game harder."
I decided to reinstall one of my most favourite game of all times, Gothic 2. Time to get back to Khorinis!
So much game make... I needs to rest. The foods call.
-Casino with bunnysuit green check.png
1638563168795.png
Monday December 6th 2021 at 7PM Hawkzombie will stream A Thief's Voyage on his Twitch.

Hawkzombie Twitch

Check it out.​

Forum statistics

Threads
117,162
Messages
1,105,061
Members
153,249
Latest member
Jon_Doe
Top