Page 1 of 1

Client side texture caching PATCH + win32build added

PostPosted: Fri Dec 23, 2011 21:18
by sapier
Hello,

Problem:
loading textures everytime you start minetest takes too much time in case you have hires textures.

Suggestion:
Adding support for client side caching of textures, only submiting textures needed by client. To avoid outdated textures on client, at each login a hash summ of each textures is sent by server.
-> Client only downoads missing textures or textures with different hash

PostPosted: Fri Dec 23, 2011 21:22
by dannydark
I'm sure I've seen someone mention this already in IRC but either way I agree. +1

PostPosted: Fri Dec 23, 2011 21:26
by sfan5
+1 I like this idea!

PostPosted: Fri Dec 23, 2011 21:49
by RAPHAEL
+1 as well

PostPosted: Sat Dec 24, 2011 07:08
by Calinou
+1 as well. This would allow the use of client-side texture packs again. The server should also have the ability to force a texture pack, but only if the client agrees, like showing a dialog:
"This server forces the texturepack "ThisPackName". Do you want to use it?"

PostPosted: Sat Dec 24, 2011 13:44
by Staffs
+1 I like this idea!

PostPosted: Sat Dec 24, 2011 13:57
by neko259
+1 but add an option for choosing max texturepacks count. Because if I'll visit too much servers, I'll have gigabytes of textures.

PostPosted: Sat Dec 31, 2011 16:01
by sapier
I'm going to write a patch for the simple solution:

(1)Server sends TextureAnnouncement containing md5 sum, name and path information
(2)Client checks TextureAnnouncements against localy cached textures
-->loads textures matching announcement
-->creates texture request for required ones
(3)Client->Server (LIST OF TEXTURES)
(4)Server: Send textures requested

PostPosted: Sun Jan 01, 2012 12:48
by sapier
here's the patch, tested on linux only please have a look at it.

<removed use later patch>

There are a number of "problems" with it:

-requires mods to follow naming conventions.
eg all textures have to be named <modname>_something.png as textures with same name will get transfered every time

-adds another library dependecy to openssl

-breaks protocol compatibility to current minetest

PostPosted: Sun Jan 01, 2012 14:30
by Hackeridze
sapier wrote:There are a number of "problems" with it:

-requires mods to follow naming conventions.
eg all textures have to be named <modname>_something.png as textures with same name will get transfered every time

Bad

PostPosted: Sun Jan 01, 2012 15:06
by sapier
@Hackeridze even you obviously don't like me i wish you a happy new year.
You should have TRIED it before complaining you would have noticed:

1)What you call "bad" currently doesn't apply to ANY default texture nor to any of the more than 30 mod's I've tested.

2)It's not at all a better solution to download ALL textures every time than downloading a single conflicting texture more than once

3)Exactly the same naming convention is already in place for entity names so it wouldn't be that hard to remember.

PostPosted: Sun Jan 01, 2012 17:36
by sapier
As noone seems to want to compile by her/himself I've compiled it for win32.

The client will work with current official minetest server but obviously you won't have any benefit doing this.

I didn't test if standard client will work with this server but i don't expect it to work.

http://www.mediafire.com/?81uj93j6jekdp7d

PostPosted: Sun Jan 01, 2012 18:36
by celeron55
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-adds another library dependecy to openssl


WTF? Why?

That is not going to get into upstream because of making building on Windows crap.

PostPosted: Sun Jan 01, 2012 19:17
by sapier
openssl on windows isn't more complicated than using gettext in windows.
I didn't do a windows build or edit a cmake file before an got it built within an hour.

But I know you don't like to add library dependencys to minetest that's why i didn't even expect you to add it upstream. It's just a proof of concept.

The reason I added openssl is i required a reliable hash algorithm to decide if a texture within the client cache matches the one present on server. If anyone does want to implement md5 or any other hash algorithm himself it it wouln't be much of an effort to switch to that algorithm.

I personaly don't like reinventing the wheel, especially if its something critical as an hash algorithm.

On the other hand, having some sort of cryptographic library available in minetest wouldn't be that bad in my opinion. At least it would reduce the amount of work to add a secure password system.

EDIT1:
The changes i did to build on windows (additional to downloading openssl windows build)
http://www.mediafire.com/?57n7c552787s9q7

PostPosted: Sun Jan 01, 2012 23:00
by sapier
Switched from openssl md5 hash to minetest included sha1 hash thus removing the openssl dependency

http://pastebin.com/bShyhRwF

PostPosted: Mon Jan 02, 2012 04:54
by dannydark
Nice work mate ^_^ I grabbed the links you posted on IRC earlier to test and works very nicely.