[DISCUSSION] 128x128 pixels Tibia sprites with AI (neural network)

Kazz Kzupzarski

New Member
Joined
May 22, 2018
Messages
2
Reaction score
0
On windows I only compiled it in CodeBlocks some time ago. Now I use Linux at work and there it's very easy to compile.

#topic
Just bought GeForce 1080Ti. Now it will learn 3 times faster then on 1050. I should get some results in 3-5 weeks.

Can you build JSkalskiSBG SPR_from_PNG otclient windows lastest version?
I'm trying build on CodeBlocks, but there are compiling errors.

Att,
Kzpk.
 

GhostWD

I'm in love with the var_dump()
Joined
Jan 25, 2009
Messages
185
Solutions
6
Reaction score
28
Maybe stop only increasing resolution and let's change format? maybe use .svg? this would be great! ( that's my dream <3 ). what do you think guys? possible?
 

tiagomelojuca

Member
Joined
Apr 18, 2021
Messages
16
Reaction score
12
Location
Brazil
GitHub
tiagomelojuca
Can you build JSkalskiSBG SPR_from_PNG otclient windows lastest version?
I'm trying build on CodeBlocks, but there are compiling errors.

Att,
Kzpk.
Precompilled binaries for Windows 64bits:
Download: https://www.dropbox.com/s/7uhdnccvgflnchr/otclient_hr-x86_64.zip?dl=1
Scan: VirusTotal (https://www.virustotal.com/gui/file/77d53e11d62af9a320c2d9a8362c5b4ed4a88ec211f8d62eff8a3e92114290d8/detection)

Providing precompilled binaries just for the sake of convenience. All you need is in USAGE.md

Hope it encourage someone in this achievement... this thread is too good to die :(
Unfortunally, it's so underrated, even being one of the best ones I've saw about Open Tibia over the last years.

Greate work as always, @Gesior.pl ... Big fan of yours here. Thanks for everything :)
Post automatically merged:

Almost forgot... if it helps anyone, here is a simple script I've done for myself in NodeJS for generating 64x64 placeholders (simple resizing) taking the 32x32 extracted folder as input:

JavaScript:
const fs = require('fs');
const path = require('path');
const sharp = require('sharp'); //^0.28.1

// Definitions
const PATH_IN = path.resolve(__dirname, 'sprites_1');
const PATH_OUT = path.resolve(__dirname, 'sprites_2');

// Functions
const getFilepathIn = fileName => path.resolve(PATH_IN, fileName);
const getFilepathOut = fileNameWithoutExt => path.resolve(PATH_OUT, `${fileNameWithoutExt}.png`);
const getBufferIn = fileName => fs.readFileSync( getFilepathIn(fileName) );

async function resizeImgBuffer(inputBuffer, finalHeight) {
    return await sharp(inputBuffer)
        .resize({
            width: finalHeight,
            kernel: sharp.kernel.nearest,
        })
        .png()
        .toBuffer();
};

async function createOutputBufferFromInputPNG(fileNameWithoutExt) {
    const inbuf = getBufferIn(`${fileNameWithoutExt}.png`);
    return await resizeImgBuffer(inbuf, 64);
};

async function resizeFile(fileNameWithoutExt) {
    fs.writeFileSync(
        getFilepathOut(fileNameWithoutExt),
        await createOutputBufferFromInputPNG(fileNameWithoutExt)
    );
};

// Resize all files inside input dir
(async () => {
    if ( !fs.existsSync(PATH_OUT) ) fs.mkdirSync(PATH_OUT, { recursive: true });
    const inFiles = fs.readdirSync(PATH_IN);
    const inFilesWithoutExt = inFiles.map( item => item.slice(0, -4) );
    
    for (const [id, fileName] of inFilesWithoutExt.entries()) {
        await resizeFile(fileName);
    };

    console.log('Finished!');
})();

Just place it in same dir of your sprites' extracted folder and, after renaming it for sprites_1, run a
Bash:
yarn init -y && yarn add sharp
, then you're ready to go (
Bash:
node ./script.js
).
 
Last edited:

Dip Set

Well-Known Member
Joined
Dec 27, 2007
Messages
153
Solutions
1
Reaction score
89
@mrianuraa and I spent >1 week on this (literally took 1 week to convert tibia.spr 300 mb to all png images >2.5GB. The png folder was able to compress to 350~ mb. In the end, it was very nice graphics when standing still, however upon movement there was tremendous lag at times. Mrianuraa attempted to optimize the client, but in the end it was still causing lags.
 

Dip Set

Well-Known Member
Joined
Dec 27, 2007
Messages
153
Solutions
1
Reaction score
89
Well, he's done it guys. @mrianuraa was able to convert my client to 64 x 64. The sprite file size is only 8% larger than my previous tibia.spr. All sprites were converted to 64 x 64, and then packed using a custom packing method by @mrianuraa.

The difference is more noticeable in-game, and it's still a work in progress, but here you can see some differences already.
1620783756475.png
1620783761457.png

You can see how the crown shield looks MUCH more crisp, and the outfit has a heavy outline to it which makes it "pop". The ground has MUCH more detail. Overall huge upgrade. As far as performance, he has made insane strides in a short time. The client loads immediately, but then loads the sprite folder in the background. After about 10-15 seconds, the entire sprite file is loaded. Ingame, movement is VERY smooth, here you can see I am able to still pull 4.8k FPS with 64 x 64 sprites.
1620783906963.png

A major part of this process was converting all of the sprites using a neural network. There were many customizations needed to tweak outfits, animations, effects, etc, and to create a seamless, "magic" like conversion from 32 x 32 to 64 x 64. It is still a WIP. @mrianuraa managed to create a totally automated process to convert tibia.spr into a unique encrypted packed file: spr.mpak.

If you are interested in seeing the difference in quality, my old client with standard tibia.spr support is available on my server's website at
Sanctuary Online Global (https://sanctuary-onlineOTs.com)

The 64x64 HD client is available on my discord at
Join the SanctuaryOnline Discord Server! (https://discord.gg/DF5Tv7MXe9)

While comparing the two clients, my overall opinion is that this will become "The future of OTClients".
 

Sopago

Member
Joined
Dec 15, 2020
Messages
31
Reaction score
11
GitHub
Sopago
Well, he's done it guys. @mrianuraa was able to convert my client to 64 x 64. The sprite file size is only 8% larger than my previous tibia.spr. All sprites were converted to 64 x 64, and then packed using a custom packing method by @mrianuraa.

The difference is more noticeable in-game, and it's still a work in progress, but here you can see some differences already.
View attachment 58588
View attachment 58589

You can see how the crown shield looks MUCH more crisp, and the outfit has a heavy outline to it which makes it "pop". The ground has MUCH more detail. Overall huge upgrade. As far as performance, he has made insane strides in a short time. The client loads immediately, but then loads the sprite folder in the background. After about 10-15 seconds, the entire sprite file is loaded. Ingame, movement is VERY smooth, here you can see I am able to still pull 4.8k FPS with 64 x 64 sprites.
View attachment 58590

A major part of this process was converting all of the sprites using a neural network. There were many customizations needed to tweak outfits, animations, effects, etc, and to create a seamless, "magic" like conversion from 32 x 32 to 64 x 64. It is still a WIP. @mrianuraa managed to create a totally automated process to convert tibia.spr into a unique encrypted packed file: spr.mpak.

If you are interested in seeing the difference in quality, my old client with standard tibia.spr support is available on my server's website at
Sanctuary Online Global (https://sanctuary-onlineOTs.com)

The 64x64 HD client is available on my discord at
Join the SanctuaryOnline Discord Server! (https://discord.gg/DF5Tv7MXe9)

While comparing the two clients, my overall opinion is that this will become "The future of OTClients".
Is there any downsides atm that u have discovered?
 

tiagomelojuca

Member
Joined
Apr 18, 2021
Messages
16
Reaction score
12
Location
Brazil
GitHub
tiagomelojuca
Well, he's done it guys. @mrianuraa was able to convert my client to 64 x 64. The sprite file size is only 8% larger than my previous tibia.spr. All sprites were converted to 64 x 64, and then packed using a custom packing method by @mrianuraa.

The difference is more noticeable in-game, and it's still a work in progress, but here you can see some differences already.
View attachment 58588
View attachment 58589

You can see how the crown shield looks MUCH more crisp, and the outfit has a heavy outline to it which makes it "pop". The ground has MUCH more detail. Overall huge upgrade. As far as performance, he has made insane strides in a short time. The client loads immediately, but then loads the sprite folder in the background. After about 10-15 seconds, the entire sprite file is loaded. Ingame, movement is VERY smooth, here you can see I am able to still pull 4.8k FPS with 64 x 64 sprites.
View attachment 58590

A major part of this process was converting all of the sprites using a neural network. There were many customizations needed to tweak outfits, animations, effects, etc, and to create a seamless, "magic" like conversion from 32 x 32 to 64 x 64. It is still a WIP. @mrianuraa managed to create a totally automated process to convert tibia.spr into a unique encrypted packed file: spr.mpak.

If you are interested in seeing the difference in quality, my old client with standard tibia.spr support is available on my server's website at
Sanctuary Online Global (https://sanctuary-onlineOTs.com)

The 64x64 HD client is available on my discord at
Join the SanctuaryOnline Discord Server! (https://discord.gg/DF5Tv7MXe9)

While comparing the two clients, my overall opinion is that this will become "The future of OTClients".

Indeed, even if it's not perfect, it's a huge upgrade and a fantastic result.
Congratulations to you both, I'll check your server soon to see the ingame result with my own eyes!

It's certainly something very interesting to work on... And totally agree with you: this is this future of OTClient - not all that useless discussion about which one is the better, client X vs client Y, or how Y supports machines from 1990 and X has some fps drops.

Again, congratulations, and thanks for who became this possible (just another debt this community has with Gesior and his awesome ideas).
 

Dip Set

Well-Known Member
Joined
Dec 27, 2007
Messages
153
Solutions
1
Reaction score
89
Actually I tested with a 2001 HP Inkjet printer and got 5 pages per minute, so not bad.
 

Erexo

Kage
Premium User
Joined
Mar 27, 2010
Messages
732
Solutions
5
Reaction score
164
Location
Pr0land
GitHub
Erexo
The crispness of that crown shield is making me wet.
Is there any chance at all that you would share that network?
 

Dip Set

Well-Known Member
Joined
Dec 27, 2007
Messages
153
Solutions
1
Reaction score
89
The crispness of that crown shield is making me wet.
Is there any chance at all that you would share that network?
There were many, many steps made and optimized by @mrianuraa , I highly suggest you contact him if interested.
Post automatically merged:

You might think I'm joking but I'm not. You might be surprised what PC is average Tibia player using.
It takes no more effort for me to offer both old 32x32 client and 64x64, so I think that’s a solid solution for players with pc from 2010.
 
Last edited:

Night Wolf

I don't bite.
Joined
Feb 10, 2008
Messages
452
Solutions
6
Reaction score
678
There were many, many steps made and optimized by @mrianuraa , I highly suggest you contact him if interested.
quoting the Linux creator: "Talk is cheap, show me the code".

@mrianuraa gesior has provided a step by step on the process and even shared his repo with functions to load png directly.
What have you done besides this? Did you packed back to spr just to reduce the size?
 

Dip Set

Well-Known Member
Joined
Dec 27, 2007
Messages
153
Solutions
1
Reaction score
89
quoting the Linux creator: "Talk is cheap, show me the code".

@mrianuraa gesior has provided a step by step on the process and even shared his repo with functions to load png directly.
What have you done besides this? Did you packed back to spr just to reduce the size?
If it were easy, everyone would have done it by now.

To clarify, he created a program which converts tibia.spr to png and then enhances it, packs those, encrypts it, then encodes it into a custom file extension.
To add new sprites, or edit the current sprites, all you need to do is rerun the program and it auto updates everything.
Overall, he essentially created a super user friendly, super easy, method for 64x64 sprites, compression, and encryption.
 
Last edited:

tiagomelojuca

Member
Joined
Apr 18, 2021
Messages
16
Reaction score
12
Location
Brazil
GitHub
tiagomelojuca
quoting the Linux creator: "Talk is cheap, show me the code".

@mrianuraa gesior has provided a step by step on the process and even shared his repo with functions to load png directly.
What have you done besides this? Did you packed back to spr just to reduce the size?

Usually, I don't agree with most of your thoughts (I do agree with your ideas, but not with your extremism).
I have no intention of attack you at all... but, also, there is no need to provoke them this way. Even if they don't share the code, their results can represent a goal to our community. And maybe make people realize that this is something cool, and worth the effort.

That said, totally agree with you about the fact we all should thanks Gesior. Not only for his initiative, but also for his clearly step-by-step.
But let's not forget about edubart too :) after all, the original idea is his (so as the client that made it possible).
 

Dip Set

Well-Known Member
Joined
Dec 27, 2007
Messages
153
Solutions
1
Reaction score
89
The initial processing time is intense. For normal sprite file 24-48 hours. After that initial conversion, mrianura has it only convert new or changed sprites, so it’s like 1 second per sprite (3-4 second per outfit?).
 
Top