Hash-based resource replacement

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Hash-based resource replacement

Post by Nash »

Inspired by Graf Zahl's initial thoughts on the matter.

The jist of this suggestion is a way to do lump replacement based on the hash of the "to-be-replaced" lump.

What's different from Graf's idea and what's being proposed here is that it would work for any lump, not just /graphics/ lumps. I'm not sure how it would work from a technical standpoint - would it work similar to the filter folders (so now we'd have "hash folders")?

Besides the use case Graf presented in that other post (mod-specific TITLEPIC replacements), one mod that could immediately benefit from this is NightFright's Brightmaps Plus pack - currently, there are separate downloads depending on whether the user uses vanilla sprites or the sprite fix sprites. With hash-based replacement, the entirety of Brightmaps Plus can be a single file.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49072
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Hash-based resource replacement

Post by Graf Zahl »

The main problem here is performance. To replace any lump based on its hash you have to read it. This can take quite a bit of time when loading lots of things.
User avatar
Rachael
Posts: 13571
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Hash-based resource replacement

Post by Rachael »

Maybe what might help with performance issues is if the replacement requires a title - i.e. TITLEMAP.replacement.2EC59756DA<whatever>.png
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49072
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Hash-based resource replacement

Post by Graf Zahl »

That was pretty much my original suggestion about this.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Hash-based resource replacement

Post by _mental_ »

I would add a special lump that does files remapping. It will specify source name+size+MD5 and target's full path.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49072
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Hash-based resource replacement

Post by Graf Zahl »

Now that's precisely what I'd like to avoid.
User avatar
Tormentor667
Posts: 13534
Joined: Wed Jul 16, 2003 3:52 am
Contact:

Re: Hash-based resource replacement

Post by Tormentor667 »

Graf Zahl wrote:The main problem here is performance. To replace any lump based on its hash you have to read it. This can take quite a bit of time when loading lots of things.
Would this happen at startup?
User avatar
Rachael
Posts: 13571
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Hash-based resource replacement

Post by Rachael »

Yeah, that's when resources are loaded so that's when it would make the most sense to do the replacements.
User avatar
Tormentor667
Posts: 13534
Joined: Wed Jul 16, 2003 3:52 am
Contact:

Re: Hash-based resource replacement

Post by Tormentor667 »

I wonder if the filename is something like “orIginallumpname.replacementname.md5hash”, wouldn’t it be enough if the engine just checks the original name hash?
User avatar
JPL
 
 
Posts: 523
Joined: Mon Apr 09, 2012 12:27 pm
Contact:

Re: Hash-based resource replacement

Post by JPL »

Not exactly the same use case that's being discussed here, but if the ability to get hashes / checksums for non-map assets, eg textures, were exposed to ZScript it would let me do some compatibility fixes for WadSmoosh. (specifically, fixing custom skies that are defined via the TEXTUREx lump and can't be otherwise detected)
Post Reply

Return to “Feature Suggestions [GZDoom]”