The Dink Network

The state of PNG support in 2024

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 Drone edition (my modified edition, V2.5.7.9) - Will prioritize the PNG


Now you might be wondering, wtf is WDEP Drone Edition? 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

The released file can be found here on TDN: https://www.dinknetwork.com/file/windinkedit_plus_2_drone_edition/
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
February 27th, 05:54 AM
custom_simon.gif
SimonK
Peasant He/Him Australia
 
Ah-ha. that explains why I can't load png files in freedink using the init() command, was just getting no image.

Hmmm, to use png or not I guess comes down to what engine is in most use these days?

HD or freedink?

Anybody know?
February 27th, 08:42 AM
custom_robj.png
Robj
Jester He/Him Australia
You feed the madness, and it feeds on you. 
You could always include BMP and PNG, I think engines that support PNG prioritise them first and then older engines will use the BMP. Although maybe that's tedious to include both. I dunno..
February 27th, 11:38 AM
spike.gif
SlipDink
Peasant He/Him United States bloop rumble
2nd generation. No easy way to be free. 
BMP is still the most compatible choice, assuming you want the widest audience possible for your dmod.
February 27th, 11:46 AM
peasantmb.gif
yeoldetoast
Peasant They/Them Australia
LOOK UPON MY DEFORMED FACE! 
My completely unsubstantiated suspicion is that the majority of casual dinkers are using the web build these days. It's about time people moved on from BMP.
February 27th, 11:56 AM
pq_cthunik.gif
GOKUSSJ6
Peasant He/Him Poland
Everyone should get a pizza for free in each week. 
"Hmmm, to use png or not I guess comes down to what engine is in most use these days?

HD or freedink?

Anybody know?"

Honestly at this point FreeDink might as well be less prioritized considering YeOldeDink exists. Both that and HD versions support PNG files which saves a lot of space along with alpha channel support.
February 27th, 08:51 PM
custom_simon.gif
SimonK
Peasant He/Him Australia
 
Hmm, okay I might end up sticking with BMPs as I'm not planning to do a lot of new graphics. But will try out that YeOldeDink engine and see.

Certainly can't be bothered doing both PNGs and BMPs at this point.
March 1st, 12:47 PM
spike.gif
SlipDink
Peasant He/Him United States bloop rumble
2nd generation. No easy way to be free. 
@yeoldetoast:
My completely unsubstantiated suspicion is that the majority of casual dinkers are using the web build these days. It's about time people moved on from BMP.

My completely unsubstantiated suspicion is as follows:

What you say may be correct, but I doubt the most common Linux distros have PNG support as they still run version 109.[x]. I'd still say that many Linux users fire up & finish the original game* and then come here to the DN expecting to be able to run any dmod they download.

BTW, as of February there are still many Linux users reviewing (VERY positively!) our beloved gaming obsession.

*(The Linux version of the game that I use is still at version freedink 109.6-3. Does that support PNG? I suspect it does not.)

March 2nd, 09:03 AM
peasantmb.gif
yeoldetoast
Peasant They/Them Australia
LOOK UPON MY DEFORMED FACE! 
Yes, heaven forbid someone should have to install a new program on their computer, or *gasp* open a new tab in their web browser! What a calamitous ordeal! Just thinking about the prospect of clicking on a hyperlink fills me with nothing but profound Lovecraftian dread.

I am in disbelief of there being any recent positive reviews, as the package is broken in recent distro releases as per the newest review(s) in KDE Discover, but i'd love to see them if you have them to hand.
March 3rd, 01:10 PM
spike.gif
SlipDink
Peasant He/Him United States bloop rumble
2nd generation. No easy way to be free. 
These bitmaps are from the Ubuntu Software App (from the ubuntu-jammy-universe [deb]) repository.

dink1

dink2

dink3

dink4
March 19th, 01:08 AM
custom_simon.gif
SimonK
Peasant He/Him Australia
 
PNG is so nice... and it renders straight out of blender, with alpha, shadow intact, none of that annoying replace shadow with the checkerboard, remove offwhite pixels, etc etc...

After much fiddling around I found redink1's post about PixelFormer being used to make bmp files with Alpha, which is also nice, but unfortunately freedink doesn't support that, maybe YeOldeDink does but I don't have that running.

I've got 24 more png files to manually convert to the old bmp white background with checkboard shadow, off-white pixel removal to do, but that's it. If I ever do any new graphics it is going to only be PNGs with alpha.

Thanks Redink1 for making the shadows sexy - I just read the thread where you were the one coming up with the code to make it so.
March 20th, 02:31 AM
goblins.gif
drone1400
Peasant He/Him Romania
C# nerd 
A proper DMOD with PNGs would be so nice... Imagine all the cool "lighting" effects you could have, like the whole "lantern" thing, or making everything darker with a semi-transparent black sprite. Or a full on night club rave. Dink goes partying? Hah.

WAAAAIT... Simon, do you know about the Dink Shadows For Blender file: https://www.dinknetwork.com/file/dink_shadows_for_blender/

It automagically generates the checkerboard using blender compositing.

I'm not sure if the version there works with Blender 3.6 though...

Here's also my updated version that I haven't released yet: [redacted, no longer available]

It features a script for automatic rendering all sprite directions too... If you run the "renderAnimatedSprite.py" script, it should render Bluedy's test model in the folder C:\temp_dink\example\

Uh, I'm not sure how paths work under MAC though, you might need to edit these two lines at the end of the script:
renderModel(True, "dinkArmature", "idle", "C:\\temp_dink\\example\\")
renderModel(True, "dinkArmature", "push", "C:\\temp_dink\\example\\")


I think I wanted to release it but there was still something about the compositing process I wasn't quite happy with, and I wanted to make some proper documentation for it too...
March 20th, 07:20 AM
custom_simon.gif
SimonK
Peasant He/Him Australia
 
I did see that blender shadows thing, but haven't tested it out yet.

I wasn't planning to blender anything new for the redux, but Tim's comments about Story 6 had me thinking about the matrons/women just being furniture so... eventually blender was the solution. Version 4 of blender has soooo many new things... modifiers, constraints, it's been over 15 years since I played with it.

The shadow checkerboarding isn't the huge issue for me, you can do that with a quick colour select and bucket fill with shadow pattern in Krita. It's the annoying off-white pixels that kill me with the white background. Either I end up deleting too many off-white pixels and the image suffers, or I increase their opaqueness and the image suffers... I was hoping that alpha bmps might get around this as you can set the background colour to white in the file, but alas I couldn't get it to work.

Both Gimp and Krita can make alpha bmp files but DinkHD doesn't recognise the alpha channel for these files, only ones made with Pixelformer as far as I can tell.

And I'm using Windows 10 with bootcamp, so effectively a PC.
March 20th, 09:44 PM
custom_simon.gif
SimonK
Peasant He/Him Australia
 
Straight out of the box that blender shadow file doesn't render with shadows in the latest version of Blender - ver 4.0, which is a shame. Switching between cycles, eevee etc still no shadow in the final composite. I can see it being made as it renders, but then the screen goes all white, so probably needs a tweak in the compositing nodes to get it to work with this latest Blender version.
March 21st, 04:59 AM
anon.gif
drones-ghost
Ghost They/Them
 
I'm not home so I'll try posting as a ghost-guest.

When you say the blender shadow file do you mean the one on TDN or the one I linked from my dropbox? The latter should work in up to 3.6, but I haven't tested it on 4... I'll look into it!

Also, about the white pixels, I don't know how familiar you are with blender and compositing, but there's a part of it in the dink shadows thing on my dropbox that does exactly that. If I recall there was some other setting in the scene rendering options you had to change too maybe...

Either way, I'll try to get everything set up and working in the latest version of Blender!
March 21st, 06:34 AM
custom_simon.gif
SimonK
Peasant He/Him Australia
 
not the dropbox one... which I'll grab now.

I found a way to convert via Gimp and index colour mode that achieved the same result, but doing it straight out of Blender makes more sense - but png is just better with alpha anti-aliasing etc, rather than the hard edges of this work around to support old engines.

I'm done with new graphics for the redux version. Just need to test the DMOD two more times from start to end, once in DinkHD and once in freedink...

=============================

one drive version works in blender v4.0.