Post new topic    
Liquid Metal Slime
Send private message
Separating Layers (Like in the editor) 
 PostFri Jul 13, 2018 5:45 am
Send private message Reply with quote
I was wondering if there is an easy way to code the separation of layers in-game?

I noticed the new feature in the editor by which the layers can be separated from eachother at a given depth. To me this looks absolutely beautiful if things are layered nicely. It gives me all sorts of visual ideas about how underlying layers can be concealed and revealed from the top most layers and great visual effects could be pulled off if done in-game. But is there any way to do this? I suppose this would require the NPC/Hero Layer also to be bound to a specified layer so that they align properly while this effect is being carried out. Perhaps this is not possible, I'm just curious because I'd love to play around with it.

With this in mind I also noticed the editor seems to be capable of selective grey-scaling during this process. Is it possible to selectively greyscale or apply colour modifications in-game? I can only think of a few uses for this but it's interesting nonetheless.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
⍠ C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
Liquid Metal Slime
Send private message
 
 PostFri Jul 13, 2018 4:15 pm
Send private message Reply with quote
First of all, there's a command to grayscale the master palette, or a section of it. http://hamsterrepublic.com/ohrrpgce/docs/plotdict.xml#about-greyscalepalette

Call that, and then call "update palette" and it'll work. I'm not sure how to get back to the original palette. Must be reset palette. But you can also use the other commands in that section of the dictionary to change the colors of the master palette while playing the game. People have used this to do things like day/night cycles where the game gets darker/redder/etc.

I'm not sure if you can move the map layers, or if it's safe to do so, but you could go ahead and try. http://hamsterrepublic.com/ohrrpgce/docs/plotdict.xml#about-lookupslice

Look at the slice special codes here. You'll want to do something like set a variable to "lookup slice(sl:map layer 0)" and then move its y value up or down.
I can't write in cursive.
Liquid Metal Slime
Send private message
 
 PostFri Jul 13, 2018 10:57 pm
Send private message Reply with quote
kylekrack wrote:
First of all, there's a command to grayscale the master palette, or a section of it. http://hamsterrepublic.com/ohrrpgce/docs/plotdict.xml#about-greyscalepalette


I'm aware that the palette can be greyscaled with code. I'm wondering how the editor seems to achieve simultaneously using the original master palette in addition to a greyscaled version of it and if it's possible to have both a greyscale palette and a full colour master palette occurring this way in-game.

As for the code you provided for moving an individual layer, I'll try it out thanks!
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
⍠ C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
Liquid Metal Slime
Send private message
 
 PostSat Jul 14, 2018 3:32 am
Send private message Reply with quote
You can only use a maximum of 256 colors in your game. You can't use multiple master palettes simultaneously. You can, however, partition a segment of your master palette to be grayscaled.
I can't write in cursive.
Liquid Metal Slime
Send private message
 
 PostSat Jul 14, 2018 8:45 am
Send private message Reply with quote
kylekrack wrote:
You can only use a maximum of 256 colors in your game. You can't use multiple master palettes simultaneously. You can, however, partition a segment of your master palette to be grayscaled.


Okay yeah that's what I thought, I only brought this up because the Custom seems to be able to do this simultaneously while Game can't. Just seemed weird to me when I saw it. Made me think there was a palette update that I missed.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
⍠ C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
Liquid Metal King Slime
Send private message
 
 PostSat Jul 14, 2018 1:37 pm
Send private message Reply with quote
The editor is indeed doing some extra magic to grey out the layers. I don't remember the details and I can't look at the code today, but; Maybe!

Fetching the handles of the map layers and offsetting them by changing their x and y should work as you desire. You can also offset the heroes and NPCs layer the same way if you want
Liquid Metal Slime
Send private message
 
 PostSat Jul 14, 2018 2:39 pm
Send private message Reply with quote
Bob the Hamster wrote:
The editor is indeed doing some extra magic to grey out the layers. I don't remember the details and I can't look at the code today, but; Maybe!

Fetching the handles of the map layers and offsetting them by changing their x and y should work as you desire. You can also offset the heroes and NPCs layer the same way if you want


Great thanks! And yeah I look forward to seeing how that was carried out.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
⍠ C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
Metal King Slime
Send private message
 
 PostSat Jul 14, 2018 6:45 pm
Send private message Reply with quote
Those new map editor layer visualisations draw the map layers while doing an extra palette remapping. The extra remapping is a 256-color palette mapping into the master palette. (The limit of 16 colors per palette is very close to being removed entirely, so internally the map editor can already make use of this new feature). In other words, it treats the tilesets as being paletted instead of as using the master palette directly. I guess that ability could (and should!) be made available in-game too, adding some commands to tint map layer slices or to draw them with a custom palette.

But actually it wouldn't be straightforward to add script commands which would let you get the same tinting effects as are used in the map editor unless I just copied those specific effects directly instead of giving you more freedom to tint them how you want. The map editor palettes are actually quite complicated to compute, they're a combination of multiple operations (eg blending) on the master palette. I spent a long time playing with it to try to get them to look good. Even the simplest (darkening a layer) is two operations:

Code:

FUNCTION layer_shadow_palette() as Palette16 ptr
 DIM ret as Palette16 ptr = palette16_new_identity(256)  'Direct map to master palette
 palette16_transform_n_match ret, copGreyscale
 DIM black as RGBcolor  'RGB 0,0,0
 palette16_mix_n_match ret, black, 0.60, mixBlend  'Darken by 60%
 RETURN ret
END FUNCTION

(It's still called Palette16 even though it has 256 colors...)

Ideally you could provide your own palette, and get access to all these palette-manipulation operations I wrote, so that you could create any effect. But we don't even yet have any script commands to let you manipulate "16 color" palettes (we need a new name for those!) on the fly. I did want to add some. Then you will be able to do the same tricks of appearing to use multiple master palettes at once.
Also, we're in the process of switching to 24-bit color, so then it would make more sense for you to provide a 24-bit ("master") palette for a map layer instead. I will also change the map editor to do that -currently, if your master palette only has a few colors, tinted map layers will look very bad.
Liquid Metal King Slime
Send private message
 
 PostSat Jul 14, 2018 11:57 pm
Send private message Reply with quote
Re: naming

How about we call them "N color Pallettes"? Or "PaletteN"
Metal King Slime
Send private message
 
 PostSun Jul 15, 2018 5:27 pm
Send private message Reply with quote
As in, "N" is part of the name, not standing for the number of colors?
We do sometimes refer to master palettes as 256-color palettes though, so drawing attention to the number of colours might be confusing.

Another idea: sprite palettes. But that could be confusing if we allow sprites to have their own master palette in 24-bit color mode.

Another idea: subpalettes. That's a pretty natural name already used by plenty of other programs (but, it seems it actually gets used for all sorts of different stuff)

Another idea: indexed palettes (perhaps in contrast to "rgb palettes" such as the master palette - if we allow multiple rgb palettes at once so want to stop referring to those as master palettes?)
Liquid Metal King Slime
Send private message
 
 PostSun Jul 15, 2018 7:49 pm
Send private message Reply with quote
Subpalettes and indexed both sound good. :)
Metal King Slime
Send private message
 
 PostSun Jul 15, 2018 9:43 pm
Send private message Reply with quote
As a programmer, I like "indexed palettes" more, though I think to a layperson it might make little sense. But subpalette is much shorter.
Display posts from previous: