Warzone 2100 3.1.5.1 to be or not to be... DXT

Discuss the future of Warzone 2100 with us.
Post Reply
User avatar
moltengear
Trained
Trained
Posts: 170
Joined: 22 Jul 2017, 15:05

Warzone 2100 3.1.5.1 to be or not to be... DXT

Post by moltengear »

Hello!
3.1.5 can load the dxt files now. FPS increased somewhere around 10-13%.
Also I think there will be less delays in the multiplayer. Fast loading, decoding of png files is not used.
it's like a coronary bypass.
Do you want to see release 3.1.5.1? :hmm:
User avatar
Lord_Kane
Trained
Trained
Posts: 104
Joined: 24 Nov 2016, 21:51

Re: Warzone 2100 3.1.5.1 to be or not to be... DXT

Post by Lord_Kane »

did you make this release? did you fix the unit template bug?
User avatar
moltengear
Trained
Trained
Posts: 170
Joined: 22 Jul 2017, 15:05

Re: Warzone 2100 3.1.5.1 to be or not to be... DXT

Post by moltengear »

First you need to download warzone2100 3.1.5. Replace 3 files.
I have a folder with dxt textures. About 20 megabytes.
I don't know how to copy this folder to buildbot.wz2100.net/files.
Also I don't know what file extension to use. I know the dds format.
But I came up with my .gldxt format. This is a simple format.
But I can rewrite everything for the ktx format.

https://www.khronos.org/opengles/sdk/to ... rmat_spec/

Gldxt files don't have mipmaps. I just use the function glGenerateMipmap.
There is another folder - images. For compressed textures,
it is necessary that the multiplicity of the width and height be 4.
I could not compress these files.
For ios devices, we need square images. In addition, it is possible to create large textures from many small textures.
It seems to me that the costs of switching are significant. Can anyone do this?
Then we would look at the FPS.

I don't know if vulkan has an analog of function glGenerateMipmap.
If not, I will prepare the files for version 3.2.3.
It's amazing how much FPS (3.2.3) has decreased significantly in comparison with version 3.1.5, all other things being equal. :augh:
Vincent
Trained
Trained
Posts: 103
Joined: 06 Aug 2016, 17:24

Re: Warzone 2100 3.1.5.1 to be or not to be... DXT

Post by Vincent »

Vulkan has no generate mipmap function, that's why I use nvidia-texture-tools that generates .dds files containing texture and mipmaps stored as dxt5 from CMake build system :
https://github.com/Warzone2100/warzone2100/pull/99

BTW I'm using nvidia-texture-tools but there are other tools available like ISPCTexture from Intel : https://github.com/GameTechDev/ISPCTextureCompressor
AMD also has an even more Advanced tools that can generated ASTC (mobile friendly format) and ktx file using opencl but unfortunalty it's Windows only :
https://github.com/GPUOpen-Tools/Compressonator
There's also closed source tools from imgtech sdk. I guess ARM should have their own too.

Adding support for them is only a matter of adding the correct command line arguments in a CMakeLists.txt file.
User avatar
moltengear
Trained
Trained
Posts: 170
Joined: 22 Jul 2017, 15:05

Re: Warzone 2100 3.1.5.1 to be or not to be... DXT

Post by moltengear »

Finally, I realized the generation of mipmaps. I think this will help to simplify the loading of textures in texture.cpp.
Implementing the coexistence of different graphic api will be easier.
I would not want to complicate the course of compilation using the program from nvidia.
Now I can merge the squish library with the mipmap generation code.
I added these two files to the lib / ivis_opengl folder.
Example of use.

Code: Select all

    #include "mipmaps.h"

    ZoomOutTwice k ;
    k.width =  width_png;      // only 32x32, 64x64, 128x128, 256x256, 512x512, 4096x4096
    k.height = height_png;
    k.format = GL_RGBA;
    k.DataIn = textureImage;
    k.SizeEnd = 1;              // if (width == 1 || height == 1) break;  number 1 for INTEL

    while(1)
	{
	   if(k.ReduceImageByHalf() != 1) break;
	   glTexImage2D(GL_TEXTURE_2D, k.level, k.format, (int)k.width, (int)k.height, 0, 
                                k.format, GL_UNSIGNED_BYTE, k.DataOut);
	}  	
For the first time, the function does not change the image. Do not worry.
I tried to minimize the code.

I already checked this code in the game. I was able to get rid of these functions:
gluBuild2DMipmaps and glGenerateMipmap.
warzone2100 mipmaps.cpp.zip
(8.57 KiB) Downloaded 233 times
User avatar
moltengear
Trained
Trained
Posts: 170
Joined: 22 Jul 2017, 15:05

Re: Warzone 2100 3.1.5.1 to be or not to be... DXT

Post by moltengear »

Manual for those who want to get a higher speed for version 3.1.5.
First you need to download the source code 3.1.5.
warzone2100-3.1.5.tar.xz - https://sourceforge.net/projects/warzon ... ses/3.1.5/

https://github.com/Warzone2100/warzone2100
You need the path to the texture folder to be that way - "C:/warzone2100-master/data/base/texpages"

Download this -
warzone2100 tools.zip
(56.06 KiB) Downloaded 224 times
In the folder warzone2100 tools there is a folder - Create Dxt Files lesson.
You need to create a console application. I created two convenient functions for creating dxt files and also a detailed manual.
You can specify different compression parameters.
In the folder warzone2100-3.1.5.1 there are files that you need to replace the files.
Now replace the folder texpages. This folder does not have png files.
The squish library has many files.
I managed to combine everything into one file. Which is very convenient.
There is also an example of loading a dxt file.
I want the future version 3.3.0 to be able to load compressed textures.
Version 3.1.5.1 should work well with version 3.1.5 in multiplayer.
Please make a release! :P
User avatar
moltengear
Trained
Trained
Posts: 170
Joined: 22 Jul 2017, 15:05

Re: Warzone 2100 3.1.5.1 to be or not to be... DXT

Post by moltengear »

Of course compression takes a lot of time.
Now a simpler instruction.

1) First you need to download the source code 3.1.5.
warzone2100-3.1.5.tar.xz - https://sourceforge.net/projects/warzon ... ses/3.1.5/

2) Download this. You need to replace old files with these new files
warzone2100-3.1.5.1.zip
(18.97 KiB) Downloaded 221 times
3) You can download the folder with dxt textures by this link.
https://1drv.ms/u/s!AsgQGT2swaQHam-o9bdOl2RLtRo

You need to replace this folder. I used the physfs.
Also you can easily archive the folder named base, where there is a folder called texpages.
I implement the download of dxt files for version 3.3.0 in a few days.
User avatar
moltengear
Trained
Trained
Posts: 170
Joined: 22 Jul 2017, 15:05

Re: Warzone 2100 3.1.5.1 to be or not to be... DXT

Post by moltengear »

I found one problem! The fact is that the textures don't load from mod maps. :(
For example, when new textures are loaded instead of the original textures.
I implemented it so that the extension of the png file is simply renamed to a dxt file.
My code does not know the origin of the texture.
I think that the search for a solution to the problem will take a long time for me.
I don't know how to create tickets yet.
I would very much like to see that version 3.3.0 could download the dxt files.
It can be expanded the structure of IV_Image

struct IV_Image
{
unsigned int width, height, depth;
unsigned char *bmp;
bool modTexture; // Add
}

I think that it's even better to expand the structure.

struct IV_Image
{
unsigned int width, height, depth;
unsigned char *bmp;
bool modTexture; // Add
const char* fullPath;
}

Maybe in some other way to report that the mod wants to load its textures. :hmm:
User avatar
moltengear
Trained
Trained
Posts: 170
Joined: 22 Jul 2017, 15:05

Re: Warzone 2100 3.1.5.1 to be or not to be... DXT

Post by moltengear »

I seem to have found an opportunity to solve the problem.
One of these days I will show the corrected version.
User avatar
moltengear
Trained
Trained
Posts: 170
Joined: 22 Jul 2017, 15:05

Re: Warzone 2100 3.1.5.1 to be or not to be... DXT

Post by moltengear »

I want to report that the program is suddenly closing. There should be no mistakes!
What is the problem?
stderr.txt
(474.71 KiB) Downloaded 187 times
Post Reply