Export MapData.GetChecksum to ZScript

Moderator: GZDoom Developers

User avatar
phantombeta
Posts: 2088
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Export MapData.GetChecksum to ZScript

Post by phantombeta »

This feature would be useful for detecting specific maps and such without resorting to hacks such as checking every single actor's position in the map.

Examples of uses for this feature:
Spoiler:
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Export MapData.GetChecksum to ZScript

Post by Graf Zahl »

No. For one very simple reason: This can very, very easily result in mods that don't work. A map checksum will change if you change as much as a single coordinate on a single vertex or remove some redundant hidden upper texture. So any even minimally modified version of a map will fail your check and render the feature inoperative.

This is perfectly acceptable for a compatibility lump but once mods start (ab)using this, all bets will be off.
User avatar
phantombeta
Posts: 2088
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Export MapData.GetChecksum to ZScript

Post by phantombeta »

So you prefer people using hacks to detect maps, then? Yeah, sure, a bad mod might break, but whatever. I'd say the way we currently check for specific maps is much more likely to break than this.
The main use for this would be for IWAD maps and older mapsets, which are very unlikely to be modified.
And if someone somehow made a mod that only works with a very specific version of a map, it's their own fault. The solution is simple: don't play it, and make it clear to other people that the mod is broken. Just like one should do with any broken mod.

And that's also not counting the fact that one could possibly make a hacky version of it using this feature that just got added, so now you can't really prevent people from making mods that break if you're not using a specific version of a map or mod, anyway.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Export MapData.GetChecksum to ZScript

Post by _mental_ »

I agree that broken mods can be created with or without ability to verify map's checksum.
For me it's rather an opportunity than a hack: someone can create a mod that improves or fixes vanilla/old maps.
License for bunch of dated mapsets prohibits distribution of modified versions. The proposed feature can solve this problem.

Graf, I don't know why you are so strictly against this.
There are lots of features that could help to create a "mod" that is nothing more than a piece of crap.
And then use hype to bring attention to that crap. But yes, it's a totally different story.
User avatar
JPL
 
 
Posts: 523
Joined: Mon Apr 09, 2012 12:27 pm
Contact:

Re: Export MapData.GetChecksum to ZScript

Post by JPL »

There is a use for this that has nothing to do with trying to detect specific maps, and it's using a map's checksum as a unique random seed. I wanted to do this for Keymaster and ended up using a sum of all the verts, sectors, and things in the map.
User avatar
Kinsie
Posts: 7399
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33
Contact:

Re: Export MapData.GetChecksum to ZScript

Post by Kinsie »

Can't really say I get the logic here. It'd just remove the need for some of the excruciatingly gross hacks that mods are already using to acquire this sort of information (abusing A_RadiusGive to identify actors at specific X/Y variables in Brutal Doom, JPL's sum-as-a-seed trick, whatever fresh hell Doom Delta is using for a certain feature...)
User avatar
Rachael
Posts: 13542
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Export MapData.GetChecksum to ZScript

Post by Rachael »

I'm going to have to say I agree with _mental_ and Kinsie here. Not that my opinion counts for anything. It doesn't seem like blocking the function off is actually doing anything useful.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Export MapData.GetChecksum to ZScript

Post by _mental_ »

Exactly. The idea is to expose level.md5 byte array and (maybe) to add a function that return a checksum as readable string like those we have in compatibility.txt file.

Sure this can be used by mods to stop functioning right on a particular map.
But this can be achieved via existing functionality even without reading lumps.
If somebody will create a mod that will explicitly refuse to work properly with some map(s) then player must blame such mod maker.

I agree that hash check is fragile. Although checking many properties of a map can break any moment too for the same reason.
At least this helps to stop the invention of more and more comprehensive hacks to detect an exact map.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Export MapData.GetChecksum to ZScript

Post by Major Cooke »

Already people are inventing ways of doing it too.

From DrByspy on Discord:

Code: Select all

Class PyCodeGen
{
    play string levelCode()
    {
        //G_PickPlayerStart(int pnum, int flags = 0);
        string checkcode;
        int playerposes[4];
        for(int i = 0;i<4;i++)
        {
            
            vector3 getvec = G_PickPlayerStart(i);
            playerposes[i] = getvec.x+getvec.y+getvec.z;
        }
        checkcode = level.MapName..checkcode..playerposes[0]..playerposes[1]..playerposes[2]..playerposes[3]..level.Sides[0].GetTexture(1);
        checkcode.ToUpper();
        Console.Printf("PyCode: "..checkcode);
        return checkcode;
    }
}
User avatar
phantombeta
Posts: 2088
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Export MapData.GetChecksum to ZScript

Post by phantombeta »

I'm pretty sure people were doing hacks to check maps before ZScript was even a thing.
And Brutal Doom (as bad as it is) somehow checks maps, and that can't use ZScript, so that shows it's certainly possible to hackily check maps with DECORATE + ACS.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Export MapData.GetChecksum to ZScript

Post by Graf Zahl »

Wait until I slightly randomize the spawn positions of monsters and players... :twisted: :mrgreen: :laff: :flamethrower:
User avatar
Rachael
Posts: 13542
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Export MapData.GetChecksum to ZScript

Post by Rachael »

Graf Zahl wrote:Wait until I slightly randomize the spawn positions of monsters and players... :twisted: :mrgreen: :laff: :flamethrower:
I think the important question is, what exactly are you trying to prevent by blocking this feature?

It's literally 7 lines of code that are copy-pasted and modified from another 7 lines (so about 2 min worth of work max), so there's something wrong with this that you think will actually happen if it's exposed.
User avatar
Kinsie
Posts: 7399
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33
Contact:

Re: Export MapData.GetChecksum to ZScript

Post by Kinsie »

Rachael wrote:I think the important question is, what exactly are you trying to prevent by blocking this feature?

It's literally 7 lines of code that are copy-pasted and modified from another 7 lines (so about 2 min worth of work max), so there's something wrong with this that you think will actually happen if it's exposed.
Someone might make a mod that spawns an actor at the start of E1M1 that's just a big billboarded sprite of the text "XASER IS A BUTT AND ENJOYS LOOKING AT AND THINKING ABOUT BUTTS". Which is both libel and slander, for Xaser is a saint and incapable of impure thoughts and/or actions.
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Export MapData.GetChecksum to ZScript

Post by Xaser »

Let's be real though: who doesn't enjoy looking at butts? 8-)
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

Re: Export MapData.GetChecksum to ZScript

Post by Marisa the Magician »

Honestly I'd rather have this than the dozens of gross hacks that exist because this doesn't.

(Please, I even attempted to torture myself by implementing MD5 in ZScript itself)
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”