Levels with 24bit PNG assets

dblstk

New member
I've read that it's possible to use 24bit PNG files in level design, but whenever I save in PNG-24 (in Photoshop) the game shuts down upon loading the level. "Error loading file 'data/bgs/gym/gym.png'" Is there something I'm doing wrong? Level loads fine if the image is in PNG-8 but looks awful...
 
Panels? No, but you can do the exact same thing already with fglayer.

DC
Sounds interesting. Does this need some additional parameter or command to work as fglayers? Tested but currently only works as background.
But I can confirm that the shadows work normally.

 
Yeah works as background but that means i lose background functionality, it isnt really a solution.
A bit strange that works for backgrounds but not for panel , like if someone didnt finished the code.
 
MAkes me think if it would be plausible to use actual entity for background so i can use its alpha mask to create transparency but that also means i lose shadows...
maybe if i would combine it, use entity alpha mask for stuff like grass or trees to give it semitransparency that gradually goes into solid color, and the rest would be just background 24bit...
Im building assets for 1080p, i know im probably just one dood with this issue but still, i was wondering if adding 24bit png functionality to source code would be doable with bing chat's coding knowledge, i used it succesfully to build simple guis that i wouldnt be able to.Maybe if id get it to read some parts of the code, but which ones i have no idea....
 
MAkes me think if it would be plausible to use actual entity for background so i can use its alpha mask to create transparency but that also means i lose shadows...
maybe if i would combine it, use entity alpha mask for stuff like grass or trees to give it semitransparency that gradually goes into solid color, and the rest would be just background 24bit...
Im building assets for 1080p, i know im probably just one dood with this issue but still, i was wondering if adding 24bit png functionality to source code would be doable with bing chat's coding knowledge, i used it succesfully to build simple guis that i wouldnt be able to.Maybe if id get it to read some parts of the code, but which ones i have no idea....

I think you are mistaking knowhow with priority. It's not that we (I) can't add .png support to models, it's just something that's not a priority at all with all the other stuff that's piled up. I mean, it's been five years going without a release, and I just can't tack on yet another thing that will add more time.

I set a hard deadline for release no matter what (not going to give it out, but it's soon). Once that happens, I'll consider more add-ons.

DC
 
  • Like
Reactions: ABK
what you would lose, exactly?

But yeah, it would be good if it work with any piece of the stage
Well the background is the last one , behind bglayers and it can move with different speeds from everything else, if i use it for panels, then i cant have transparency to put stuff behind background , stuff like mountains in distance or some parallax effects
 
Well the background is the last one
@DCurrent Correct me if I am wrong, but as far as I remember from the source code fglayers CAN be placed behind the background. The thing is that the BACKGROUND has a very high value.

Internally, everything is a fglayer - the engine just set a specific z value (and speed) for when you set something as "frontlayer", "background", etc.
I had this information somehere, but I can't find it.
 
Well i tried last time tu use transparency in background image i got afterimages, kinda like when you disabled all layrs but one in emulators and it kept all walking jumping frames onscreen like afterimages and didnt removed them so i didnt pushed it .
Id have to try to find some way to get what i need.
 
Well i tried last time tu use transparency in background image i got afterimages,
oh yeah, sorry, I forgot this wasn't working with fglayers. You can't have transparency on the bakground layer thanks to the issue you mentioned.
My suggestion was to use a fglayer for that, but if you can use PNG 24bits (32 if it has transparency) as fglayers, this solution won't work.
 
Hey its me again a PITA naging guy.

So are there still no changes to 32bit or 24bit and stage elements ?

There was no support for panels with 24bit , only background element worked and Id love to have it for panel too , also fglayers and really need it, even if it requires extra file for just alpha channel like for sprites in animations.
 
There was no support for panels with 24bit , only background element worked and Id love to have it for panel too , also fglayers and really need it, even if it requires extra file for just alpha channel like for sprites in animations.
Yeah it would be cool to have 24bit and 32bit support for fglayers and panel.

Right now, there is a way to bypass the color limit and reach something close to a 24bit png if you use the RGB Trick.
but it will require 3 different files for each layer (red, green and blue). For the panel, you can make it using the blue channel and overlay two fglayers over it with the other two channels.

There is no way to achieve a 32bits using that method because alpha masks doesn't work with alpha blend modes.

Btw, here is a little explanation about 24bit/32bit png format, but basically:

The three color depths here once again in a short overview:

8-bit PNG24-bit PNG32-bit PNG
Palette imageRGB imageRGBA image
Maximum of 256 colors16.8 million colors16.8 million colors + alpha transparency
 
Yeah there are some oldschool stuff that simple works, like this :)
About cycling level assets I have a script that may help.

This is the main function. The logic is simple, the layer ID will be changed with a defined delay, use the frameDelay to adjust the time between frames and the cycleDelay to adjust the time between each cycle.
C:
void main()
{
    cycleSprite("bglayer", 0, 4, 12, 400);
    cycleSprite("bglayer", 7, 12, 12, 400);
    repeatSample("data/sounds/sor1_beach.wav", "sound", 2000);
}

void cycleSprite(void type, int startIndex, int endIndex, float frameDelay, float cycleDelay)
{//Apply simple sprite cycle effects to avoid creating new entities
    float timeCurrent    = openborvariant("elapsed_time");
    float timeCounter    = getlocalvar("timeCounter"+type+startIndex);
    int levelCurrent    = openborvariant("current_level");
    int levelPrevious    = getlocalvar("levelPrevious");
    int frameCurrent    = getlocalvar("frameCurrent"+type+startIndex);
    int frameNext        = getlocalvar("frameNext"+type+startIndex);
    int frameStart        = getlocalvar("frameStart"+type+startIndex);

    //CLEAR ALL LOCAL VARIABLES WHEN THE LEVEL CHANGES
    if(levelCurrent != levelPrevious){clearlocalvar();setlocalvar("levelPrevious", levelCurrent);}
    
    //START ALL VARIABLES
    if(timeCounter == NULL()){setlocalvar("timeCounter"+type+startIndex, timeCurrent+frameDelay);}
    if(frameCurrent == NULL()){setlocalvar("frameCurrent"+type+startIndex, endIndex);}
    if(frameNext == NULL()){setlocalvar("frameNext"+type+startIndex, startIndex);}
    if(frameStart == NULL()){setlocalvar("frameStart"+type+startIndex, startIndex);}

    //DISABLE ALL LAYERS EXCEPT FOR THE LAST, WHEN THE SCRIPT STARTS
    while(frameStart < endIndex-1){
        frameStart = getlocalvar("frameStart"+type+startIndex);

        changelayerproperty(type, frameStart, "enabled", 0);
        setlocalvar("frameStart"+type+startIndex, frameStart+1);
    }
    
    //DELAY REACHED THE LIMIT?? EXECUTE ALL TASKS
    if(timeCurrent > timeCounter){

        //DEFINE THE CURRENT FRAME
        if(frameCurrent < endIndex){
            setlocalvar("frameCurrent"+type+startIndex, frameCurrent+1);
            setlocalvar("timeCounter"+type+startIndex, timeCurrent+frameDelay);
        }
        else
        {
            if(cycleDelay != NULL()){setlocalvar("timeCounter"+type+startIndex, timeCurrent+frameDelay+cycleDelay);}
            setlocalvar("frameCurrent"+type+startIndex, startIndex);
        }

        //DEFINE THE NEXT FRAME
        if(frameNext < endIndex){
            setlocalvar("frameNext"+type+startIndex, frameNext+1);
            setlocalvar("timeCounter"+type+startIndex, timeCurrent+frameDelay);
        }
        else
        {
            if(cycleDelay != NULL()){setlocalvar("timeCounter"+type+startIndex, timeCurrent+frameDelay+cycleDelay);}
            setlocalvar("frameNext"+type+startIndex, startIndex);
        }

        //CHANGE LAYERS
        changelayerproperty(type, frameCurrent, "enabled", 0);
        changelayerproperty(type, frameNext, "enabled", 1);
    }
}

Must be called in the level update script event inside the level file, layers (bg/fg) need to be named and organized in the correct order to work properly.
C:
background        data/bgs/_empty.png
bglayer            data/bgs/sor1/st3a/bg00.png        0.6 0 0 0 0 0 -1 1 1 0 0 0 0 0 0 0 #ID 0
bglayer            data/bgs/sor1/st3a/bg01.png        0.6 0 0 0 0 0 -1 1 1 0 0 0 0 0 0 0
bglayer            data/bgs/sor1/st3a/bg02.png        0.6 0 0 0 0 0 -1 1 1 0 0 0 0 0 0 0
bglayer            data/bgs/sor1/st3a/bg03.png        0.6 0 0 0 0 0 -1 1 1 0 0 0 0 0 0 0
bglayer            data/bgs/sor1/st3a/bg00.png        0.6 0 0 0 0 0 -1 1 1 0 0 0 0 0 0 0 #ID 4
bglayer            data/bgs/sor1/st3a/bg04.png        0.2 0 0 0 0 0 -1 1 1 0 3 0.1 2 0 0
bglayer            data/bgs/sor1/st3a/bg05.png        0.4 0 0 0 0 0 -1 1 1 0 0 0 0 0 0 0
bglayer            data/bgs/sor1/st3a/bg06.png        0.4 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 #ID 7
bglayer            data/bgs/sor1/st3a/bg07.png        0.4 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0
bglayer            data/bgs/sor1/st3a/bg08.png        0.4 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0
bglayer            data/bgs/sor1/st3a/bg09.png        0.4 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0
bglayer            data/bgs/sor1/st3a/bg10.png        0.4 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0
bglayer            data/bgs/sor1/st3a/bg06.png        0.4 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 #ID 12
bglayer            data/bgs/sor1/st3a/bg11.png        0.05 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1
bglayer            data/bgs/sor1/st3a/bg12.png        0 0 0 0 0 0 -1 1 1 0 1 1 20 0.5
panel            data/bgs/sor1/st3a/_map.png        none    none
fglayer            data/bgs/sor1/st3a/_cop.png        -200 0 0 -240 0 0 0 1 1 1 0 0 0 0 0 0 1 #COP CALL
order            a
settime            99
stagenumber     3
spawn1            60 40 300
spawn2            90 60 300
spawn3            120 40 300
spawn4            150 60 300
updatescript    data/scripts/updatelevel/sor1_st3a.c

@danno Buddy, my post may derail the topic but I don't know how to split it 😅
 
Back
Top Bottom