Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Texture Compression Community Project

Author
Message
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 7th Aug 2017 15:06
Hello AppGameKit community,

There are some graphic formats for the use in AGK2. For textures and sprites. e.g. PNG, JPEG and BMP

PNG loads very slowly because of the ZIP like compression and so the decompression.
JPEG could look very blocky and unsharp, but can be very small.
And BMP in the uncompressed version is easy to use, can load fast, but is also very large on the disk.

In memory how ever, they will stay all at the same space.

I would like to see some memory compression in AGK2, too. Like e.g. ASTC (or other like DXT, ETC2, S3TC ... https://developer.nvidia.com/astc-texture-compression-for-game-assets )
But that would be not easy, because it has to work on all plattforms with nearly every manufactura of hardware. Not every smartphone graphic chip is able to use all of these formats, some support some, some only one, or less.
So what can we do?

One way is to use Load SubImages
https://www.appgamekit.com/documentation/Reference/Image/LoadSubImage.htm

It's a bit tricky, because you have to create an textfile, also if you don't need one, and you images will all named liked index 1... to 32 or so.


I started experimenting with textures in AppGameKit and loading times. And also looked at a typical texture from FPSC Classic or GameGuru. They often share some patterns.
So one idea was, to create the textures on the fly, with the use of Masks, and masks could be used more often and compressed very good with PNG.

Source like here: https://forum.thegamecreators.com/thread/213539
Or maybe with some Shaders.

One idea was also to compress PNG and JPEG better with
TinyPNG, https://github.com/google/guetzli, TruePNG, or RIOT with IrfanView ... or something like that. But that would not be good enough. And it will not compress the needed RAM, because of it's decompression in memory.

So I had the idea of tileset textures, not levels, but textures. Not XML, but a ByteArray or so.

e.g. 512 x 512 pixel texture at 24 Bit (3 Byte) into tiles with 4x4 Pixels and also 24 Bit (3 Bytes) per Pixel in Color.
so the 128 x 128 Tiles, if we have only 256 diffirent 4x4 tiles, we would have about 16kByte for the tilemap and 256 x 4x4*3 byte for the image data itself. That would be about 12 kByte. Combined that would be 28kByte instead of 768 kByte in memory.
If we would have more than 256 different tiles, that would be vary.

That also will not work on all textures. Some could be one pixel of and so that would take more tiles. But that could be optimized, if the textures would be created with that in mind. Only 256 brushes (tiles) or so.
Or 16 Bit tiles, so 65536 tiles possible. (per texture)

Something like that
https://developer.nvidia.com/gpugems/GPUGems2/gpugems2_chapter12.html

There is also a C++ code version in the project Crabby
https://github.com/mainroach/crabby
And a site with comparision for Crabby http://mainroach.blogspot.de/2014/06/crabby-vs-icebreaker.html

Maybe we could implement it i AppGameKit (together) or you have other ideas, to save memory in memory and disk space, and so get faster loading times.

Thanks for reading. I am interested in your opinion. Kind regards, xaby.
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 8th Aug 2017 22:44
Subimages is extremely easy to use if you use the TGC supplied image joiner tool.

TinyPNG and others are useful as well for the initial reduction.

Login to post a reply

Server time is: 2024-04-23 17:34:10
Your offset time is: 2024-04-23 17:34:10