Page 1 of 2

Export MapData.GetChecksum to ZScript

Posted: Sun Oct 29, 2017 6:00 am
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:

Re: Export MapData.GetChecksum to ZScript

Posted: Sun Oct 29, 2017 6:12 am
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.

Re: Export MapData.GetChecksum to ZScript

Posted: Sun Oct 29, 2017 6:30 am
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.

Re: Export MapData.GetChecksum to ZScript

Posted: Sun Oct 29, 2017 6:54 am
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.

Re: Export MapData.GetChecksum to ZScript

Posted: Wed Nov 01, 2017 12:10 am
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.

Re: Export MapData.GetChecksum to ZScript

Posted: Wed Nov 01, 2017 4:11 am
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...)

Re: Export MapData.GetChecksum to ZScript

Posted: Wed Nov 01, 2017 4:46 am
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.

Re: Export MapData.GetChecksum to ZScript

Posted: Wed Nov 01, 2017 5:36 am
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.

Re: Export MapData.GetChecksum to ZScript

Posted: Sun Nov 12, 2017 9:56 am
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;
    }
}

Re: Export MapData.GetChecksum to ZScript

Posted: Sun Nov 12, 2017 12:30 pm
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.

Re: Export MapData.GetChecksum to ZScript

Posted: Sun Nov 12, 2017 12:33 pm
by Graf Zahl
Wait until I slightly randomize the spawn positions of monsters and players... :twisted: :mrgreen: :laff: :flamethrower:

Re: Export MapData.GetChecksum to ZScript

Posted: Sun Nov 12, 2017 2:06 pm
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.

Re: Export MapData.GetChecksum to ZScript

Posted: Sun Nov 12, 2017 5:28 pm
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.

Re: Export MapData.GetChecksum to ZScript

Posted: Sun Nov 12, 2017 10:44 pm
by Xaser
Let's be real though: who doesn't enjoy looking at butts? 8-)

Re: Export MapData.GetChecksum to ZScript

Posted: Mon Nov 13, 2017 1:14 am
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)