The Dink Network

The state of PNG support in 2023

June 1st 2023, 12:54 PM
goblins.gif
drone1400
Peasant He/Him Romania
C# nerd 
Hello, so you might be wondering about how PNG support works in <current year> across Dink versions.

While testing stuff for the new version of Periculo, along with RobJ, I did some research and found the following:

You can have a sprite frame be two files at the same time, both a PNG and a BMP file. Engines that support PNG will prioritize the PNG frame, while engines that don't will use the BMP frame instead. This way, you can develop a DMOD that both uses PNGs, and supports older engine versions to some extent by using an alternative BMP frame.

Out of the current dink versions out there, here is how using both a PNG and a BMP works:

Game engines:
DinkHD (tested V1.99) - Will prioritize the PNG
YeOldeDink (tested V0.6.2) - Will prioritize the PNG
FreeDink (tested V109.6) - does not support PNG, will use the BMP


Editors:
WinDinkEditPlus (RW's V2.5 and older) - does not support PNG, will use the BMP
WinDinkEditPlus D (my modified edition, V2.5.4) - Will prioritize the PNG


Now you might be wondering, wtf is WDE+D? Well, it's my fork of RW's WinDinkEditPlus, which has a bunch of modifications, the most significant being fixing some sprite rendering bugs when rescaling sprites, and adding PNG support.

The source for the modification is here: https://gitlab.com/drone1400/wdep2

Current latest test build of the experimental "devtest" branch from the repo is on discord, here:
https://cdn.discordapp.com/attachments/959479388938829824/1115233096065888287/WDED_V2.5.5.zip
(Or if you're on Bluedy's discord, here's the message with the attachment https://discord.com/channels/959479242138214452/959479388938829824/1115233095952646185 )

I should probably upload it on TDN, but I wanted to test it more before doing so... But uh, that hasn't really happened so far
June 2nd 2023, 02:33 AM
peasantmb.gif
yeoldetoast
Peasant They/Them Australia
LOOK UPON MY DEFORMED FACE! 
Now this is very cool! Nice work. As an addendum, Yeoldedink will also read PNG tilescreens as if they were BMPs. Seth got most of the way there but forgot to search for the PNG extension meaning you will need to rename tile PNGs to ts??.bmp for them to load in 1.99. Freedink will also load PNGs if you rename the extension, but a lot of the time they'll look weird.
June 2nd 2023, 08:38 AM
goblins.gif
drone1400
Peasant He/Him Romania
C# nerd 
Oh! I didn't know that Freedink can load PNGs if you rename them.

In my tests and what I mean in the first post, is PNG files that also have the correct PNG extension.

Edit: Huh, it hadn't actually occured to me to test PNG tile sheets too

I don't really see the point in those, since you can't have multiple tile layers, what would even show up if part of the tile is transparent?
June 2nd 2023, 11:12 AM
peasantmb.gif
yeoldetoast
Peasant They/Them Australia
LOOK UPON MY DEFORMED FACE! 
I use PNGs purely for the sake of saving disk space at high bit-depths. The equivalent PNG of a tilescreen BMP can sometimes be several hundred KBs smaller which adds up significantly if you have multiple tilescreens, and sometimes they can have a bit more shaved off with pngcrush/oxipng etc. It looks like if you change tiles to load with loadBitmapImage(), the extension trick should work without any further intervention, and also enable every other compression format that SDL2_Image supports.

In Yeoldedink, transparent tiles will overlap the previous screen's tiles because I was lazy, while Seth did it properly so it displays white. My testing is limited though, and it may be possible to perform interesting graphical effects with map_tile() by painting over existing screen tiles with semi-transparent ones.
June 5th 2023, 07:19 AM
goblins.gif
drone1400
Peasant He/Him Romania
C# nerd 
Oh! That makes sense... When you have a big DMOD with lots of sprites, PNGs would help indeed!
July 8th 2023, 06:06 AM
peasantmb.gif
yeoldetoast
Peasant They/Them Australia
LOOK UPON MY DEFORMED FACE! 
I've put together a little engine compatibility matrix listing various filetypes except for a few fringe ones such as video playback that never got used and probably never will be.
July 16th 2023, 03:15 AM
goblins.gif
drone1400
Peasant He/Him Romania
C# nerd 
Very nice! Should probably get RobJ to post that somewhere on the DinkC reference, or in the tutorial thread? hmmm