[RMMV] SHOW PICTURE PROBLEM

Posts

Pages: 1
Here's the situation:
Bobo is making a mini-game using the Show Picture command.
Bobo has 420 files in his img folder intended for the mini-game, and RMMV supports up to 100 pictures at once, with ascending priority.

Bobo intends to devote Picture ID slots 20-80 for a total of 60 pictures that may or may not be on the screen at once. To control this with eventing alone, Bobo would need to create a Show Picture command for every different file used in the img folder, and nest it in a conditional branch to get the proper Picture ID in the command. Hmmm...
60 x 420 equals a whopping 25,200 commands plus 25,200 condition branches to show the proper picture with the proper priority! This would take Bobo roughly 42 hours assuming he's punching in an event command every 3 seconds, and of course not eating, working, secreting, or sleeping.

There HAS to be a better way.
Please let me know if I completely missed something or are on the wrong track.
Any solutions? Thanks in advance!
Trihan
"It's more like a big ball of wibbly wobbly...timey wimey...stuff."
3359
You should be able to write a plugin that A) lets you use higher picture IDs than 100 and B) lets you determine which picture to show dynamically rather than use conditional branches.

Also Bobo is totally you.
Why do you need 420 completely unique images for a single mini game? It's hard to answer this without knowing more about the minigame, but it sounds to me like there could be some massive efficiency improvements to be found here if the images are in any way similar.
Suppose you wish to make a blackjack or mahjong game.
A winning hand in mahjong can be composed of 13 or more tiles. For this you would
need a different Picture ID for each tile, and more conditional branches to determine what tiles you have in your hand. This makes a TON of branches and show picture commands if you have ever attempted it. Thanks to Trihan and Archeia the lvl 99 Demifiend's help I have been completely devoted to learning javascript and have enlisted my children in the process as well.
Writing a plugin is something I would never think of on my own so I attempted to do so.
The main goal: Dynamically show a picture with a script call and/or plugin command. In other words, the Picture ID will be predetermined with a variable that can be easily accessed and changed to output a different priority everytime, not overwrite it. (i.e. Show picture 22 will erase previous picture 22.)
the sub goal: Increase the cap amount of pictures displayed beyond 100. This way every single picture file in your img folder can be linked to a specific Picture ID.
I have Sublime text now and I'm ready to go! What's the next step?
Ed. the Split source files really help! There are so many of them I don't know where to begin.
I also learned some plugins are really easy, containing a single line of code and others are 10k lines long!.
SunflowerGames
The most beautiful user on RMN!
13323

Eventing this would be the easiest method.
Common events / conditional branches / variables.

Don't script unless you have to.

I don't think it would require the number of events your thinking.
You haven't thought of an event or a method that makes your job easier.

(ie. if you want to show multiple images on the screen at 1 time you can instead gimp the image to make it just 1 file.)

Eventing this would be the easiest method.
Common events / conditional branches / variables.
Do you have a better more efficient way? I really want to hear it.

Let's say you want to recreate the mini-game "WHIS" from Tales of Destiny 2.
The object of the game is to empty your hand of all of your cards first, and to do this you play cards. However the mechanics are not the problem here, the problem is displaying these cards properly using show picture commands.

Your hand may contain 80% or more of the entire WHIS deck when you are doing very poorly during a game, and less than 5% when you are dominating (Your opponents' hands are flooded with cards and you are almost out.)
So let's try to display a 15 card hand when you are getting your taint handed to you.
1) There's a mother common event called "timer" that basically controls the flow of the game (whose turn it is etc.) and nested therein are more common events for playing and/or drawing cards from the WHIS deck.
2) So I have 15 cards, to set the proper priority and not overwrite the same card picture the game needs to know two things: My handsize and what cards they are.
3) The first common event checks what card it is. I have set variables to EVERYTHING. The var 'card type' defines 1 as being a fire card, 2 being a water card, 3 being a wind card etc.
4) The second common event checks the handsize and tells me what picture ID to punch into the show picture command. There's a long list of branches here since there are several different cards. A branch for 'if card type = 1' and so on. Notice how they all contain the same picture ID. I hadn't played ToD2 in 18 years but I'm thinking WHIS has at least 12 different cards, so there's 12 branches all drawn on picture ID 1 (Assuming my handsize was 0).
5) Next, another long list of branches, this time drawing on picture ID 2. (assuming my handsize was 1).
Am I the only one thinking this is an inordinately LARGE amount of commands?
The 15 card hand x 12 possible cards = 180 commands. That's not too bad.
But a 48 card hand x 12 possible cards = 576 commands. That would take me hours.
Here are some comparisons:
FF8 card game
5 card hand x over 100 possible cards = around 500-1000 or more commands.
Poker
7 card hand x 52 possible cards = 364 commands
Fantasy card games (Yugi-oh, MTG, Force of Will, Pokémon, WoW)
up to 100 card hand (or more in some cases) x card pool of 200-1000 = 20,000 to 100k commands. Holy crap, that would take me weeks.

Also, side note: I edited rpg_objects.js and attempted to set the maxPictures to return 999 instead of the default 100, and to my surprise (not) it did nothing. I'm really trying to implement Trihan's idea to write a plugin to surpass the 100 max pictures cap. Then I could set branches to each individual card!

One more thing, how do you gimp an image? I want to learn!
Trihan
"It's more like a big ball of wibbly wobbly...timey wimey...stuff."
3359
The thing with scripting it is that the actual editor limits are still in place. You can't select a picture above 100 in the UI, but you can reference a picture ID above 100 in a script call.
I've tried script commands to show a picture with values under 100 and over 100 for the pictureID, but I'm doing this wrong. I'm trying to draw the image file, 'hud1.png' with pictureId 50:

$gameScreen.showPicture(50, 'Project1/img/pictures/hud1.png', 1, 408, 204, 100, 100, 255, 1)

I didn't get an error, it simply did nothing when I tested it. I'm not sure what to put in for the blendMode and origin parameters.
Finally, if I use a higher number than 100 for the pictureId, will it still work?
Trihan
"It's more like a big ball of wibbly wobbly...timey wimey...stuff."
3359
Okay, so you appear to have looked at how Game_Interpreter handles showing pictures, which is good. Let's see what's going wrong for you:

The first argument is the picture ID, so that's fine. 50 will work.

Your second argument is the name of the picture. You've put 'Project1/img/pictures/hud1.png'. However, if you look down the hierarchy to Game_Screen's showPicture, then Game_Picture's show, then Sprite_Picture's loadBitmap, then ImageManager's loadPicture, you'll see that it's already looking in 'img/pictures/' so all you actually need is 'hud1' (it adds the .png automatically).

Next is origin, which will either be "top left" (0) or "center" (1) so in this case, you've put the origin in the center.

After that is your X and Y position, so you're placing the picture at (408, 204). This is fine.

Then you've got scaleX and scaleY, which are fine at 100 each for 100% scale.

After that is opacity, so 255 is fine for fully opaque.

Finally, you've got blend mode. It'll be 0 for normal, 1 for additive, 2 for multiply, and 3 for screen. You've put 1, which will be additive blending (in other words, the hues for the pixels will be added together, so your picture will appear to "glow" slightly and will be lighter than normal). I suspect you might want 0 to show the picture as-is.

So it looks like your only real problem is the filename. You can absolutely use a higher number than 100 for picture ID, Javascript doesn't really care what number is there as long as it can match up that number with the one for the associated sprite. You will, of course, have to change the return value of Game_Screen's maxPictures function, as you already surmised. (One corollary to this is that Spriteset_Base's createPictures function will add a Sprite_Picture child to the picture container for every possible picture you've defined even if you're not currently showing anything under that ID, so be aware that the higher this number the higher your game's memory consumption will be).

Edit: Oh, you're missing the semicolon at the end of the line as well. Surprised you didn't get an error in the console for that.
Thanks! Yes, got a few syntax errors:

Unexpected Identifier (The filename argument I gather)
Unexpected token ILLEGAL (for using a back slash.. boo back slashes!)

Adding or omitting a semicolon didn't seem to make a difference.
Now if there was a way to punch in variable values for the position x and position y arguments... like the way you can put in \V in a text message to show a variable's value. That would save LOTS of time and branches since the script commands at the moment have constant values punched in for pos x and pos y.
Trihan
"It's more like a big ball of wibbly wobbly...timey wimey...stuff."
3359
You mean like, say, using $gameVariables.value(variable id) for example?
It worked! Thank you all for input and opinions. Much appreciated!
Pages: 1