sp614x / optifine

1.78k stars 420 forks source link

[Category] FastMath option makes AntiCheat false flag. #5578

Open Tecnio opened 3 years ago

Tecnio commented 3 years ago

Description of Issue

(FOR PEOPLE THAT SAY 99.99 IS UNECESSARY THATS NOT THE POINT! A GAME AFFECTING GAMEPLAY IS NOT FINE AND ANY GAMEPLAY AFFECING MODIFICATION IS AN UNFAIR ADVANTAGE AND FLAGS ANTICHEATS) Basically when I or any other player uses fast math the different sin and cos table screws up my 99.99999% horizontal velocity check as Minecraft uses the MathHelper class which optifine edits while doing and this causes a 1E-4 offset from predicted on my check and for my first attempt at a prediction engine.

I saw this module effecting a few more anticheat developers complete prediction engine as well as my prediction and velocity check. https://artemis.ac https://grim.ac

If this was fixed it would make our job very much easier, and prevent people from having an unfair advantage.

Steps to Reproduce

  1. Enable FastMath and you are flagging like crazy.

OptiFine Version

Any OptiFine version with FastMath.

Installation Method

I used the standalone installer.

F3 Debug Screenshot

Image

Prior Testing

The problem never happens without OptiFine or FastMath.

Additional Information

Well this is really not cool and making prediciton false flag please take this in consideration.

terminalsin commented 3 years ago

As a developer making an anticheatI strongly advocate against this change. I want to make my life harder. Please stop trying to make things easy and neat for everyone.

yanjulang commented 3 years ago

can confirm, fast math's math changes disturb anticheats at actually being exact. Also I doubt there's a great advantage when using fast math as modern CPUs shouldn't have problems with calculating some sins / cos

MWHunter commented 3 years ago

As a developer making a predictive anticheat, fast math fucks up my predictions to a level that would get players banned for using it. The CPU cache is large enough that fastmath isn't any faster than regular trig. Please remove this vanilla incompatibility.

Technosword commented 3 years ago

99.99999% Isn’t a good check. No cheater is ever going to use it. Even if they did, it wouldn’t provide an advantage at all. Instead of removing a feature, why not fix your check? (No hate to you or ghast I just think it’s a little pointless)

SelfMadeSystem commented 3 years ago

yes. FastMath more like BadMath

steviebeenz commented 3 years ago

@Technosword bruh u saying that every ac has to recode everything coz of optifine now?

Maybe u should rather than making fastmath provide less options make it remove any buggy slow Math?

steviebeenz commented 3 years ago

Some Anticheats can't just change the threshold on a check to fix it because of how their made therefore this change is kinda needed.

Oreoezi commented 3 years ago

As a developer making an anticheatI strongly advocate against this change. I want to make my life harder. Please stop trying to make things easy and neat for everyone.

Liquidbounce B72 Velocity: Enabled Mode: AAC Horizontal: 0.75

Bypasses Artemis

GladUrBad commented 3 years ago

This is true FastMath gives the player enormous unfair advantages such as 3.0025312416454687 blocks of reach where the regular reaching distance in Minecraft is 3.000000000000000 blocks. It's also sort of prejudice against slower computer hardware by assuming that the computer hardware is too slow to run Minecraft and that it needs a white knight software optimization to make it more optimized. It's 2021, please stop assuming and please stop being hardwareist.

Tecnio commented 3 years ago

this became a meme thread but im serious

icewormy3 commented 3 years ago

wormy sex

MWHunter commented 3 years ago

I am actually serious too. It really does affect movement predictions precision from 1e-7 to 1e-4.

ghost commented 3 years ago

You should be disgraced, enabling unfair advantages for people using fast math! You have single handedly ruined the minecraft experience for me, and many others, I can no longer attack someone because they're hitting me 0.0025 blocks further away from me. Shame on you!

GladUrBad commented 3 years ago

The CSS malware is down, calculate the wireless network so we can program the CPU hard drive! If we back up the interface, we can get to the PPPoE monitor through the auxiliary HDD network! Try to parse the CSS processor, maybe it will transmit the high speed card! Synthesizing the card won't do anything, we need to hack the online TPS malware! Send the fiber optic antenna into the protocol, it will calculate the bandwidth by backing up its AI circuit! If we network the internet, we can get to the ADP circuit through the visual TPS program!

GladUrBad commented 3 years ago

deez nuts

GladUrBad commented 3 years ago

does anyone want to watch leegoon with me?

ghost commented 3 years ago

Thats it, im no longer a optifine fan, ive been a fan since 2009, im taking my support to Better FPS where they know how to edit a sin() and cos() table

thehydrogen commented 3 years ago

does anyone want to watch leegoon with me?

bro you gotta stop

KaiAF commented 3 years ago

Let's keep GitHub issues relatively serious. If you are going to comment, at least be helpful.

Now actually talking about the issue itself:

I do not actually think this is an issue with optifine, so it's not really needed to be "fixed" or removed. The best thing I can tell you is to probably just update your anti-cheat to where it doesn't check at 99.99999%. All though, I am not the creator of the mod, so I will mark this as an enhancement so that sp614x could see it, and probably change it. If he wants. Sorry about that whole mess up there :)

MWHunter commented 3 years ago

This is an issue with optifine. It is breaking vanilla behavior for little gain, and it should be considered a bug instead of a feature.

update your anti-cheat to where it doesn't check at 99.99999%

I'm not giving up 100x less precision because a non-vanilla client is breaking vanilla behavior. It's insulting for an open source anticheat to be broken by proprietary and closed source software. It's hard to gain precision and is easy to lose precision to issues such as this. My measurements are that I would have to go from 0.0000001 to 0.0001 precision to compensate for optifine fastmath.

Technosword commented 3 years ago

My measurements are that I would have to go from 0.0000001 to 0.0001 precision to compensate for optifine fastmath.

That seems very accurate still? I don't see the point of removing a feature used by thousands to help 1 person's development.

MWHunter commented 3 years ago

It's not one person. It's artemis and grim, plus all the other private predictive anticheats such as Lemoncloud's Kraken. It's not a huge issue when you simply calculate using the fast math class, with Kraken already copying over the optifine class. This allows 1e-7 precision once again. It's a pointless barrier to anticheat development for no gain at all, as CPU cache negates all performance improvement from this option.

Tecnio commented 3 years ago

@Technosword People keep complaining about cheaters tho when we attempt to fix you respond like this. This doesnt make sense lol

Technosword commented 3 years ago

I agree, it is kind of stupid to have. I see your arguments it just seems a little pointless as you can always just sacrifice like 0.01% accuracy to support all mods. I don't disagree with it being removed, it just seems pointless.

MWHunter commented 3 years ago

This accuracy compounds in block collisions. The 0.0001 precision can lead to a 0.5 difference due to slabs, leading to a false ban.

GladUrBad commented 3 years ago

imagine not predicting fastmath

MWHunter commented 3 years ago

If you really want, I can detect fastmath and kick all optifine players and tell them to go use Lithium, as Lithium is open source, doesn't break vanilla compatibility, and listens to the users.

whdjenanzj commented 3 years ago

Bro fuck off and do some research before you start a rant

MWHunter commented 3 years ago

Did you just tell a predictive anticheat developer to do research... on predictive anticheats?

KaiAF commented 3 years ago

Locking the issue as it's just leading no where. I will label this as a bug, the developer will take a look when he can.

sp614x commented 3 years ago

If the anticheat fails due to a position difference of 1e-4m (1mm), then it has some problems. It should have a tolerance for player actions that is well above 1mm, probably 10cm or something.

KaiAF commented 3 years ago

Posted by author in a new issue (forgot to unlock this).

If the anticheat fails due to a position difference of 1e-4m (1mm), then it has some problems. It should have a tolerance for player actions that is well above 1mm, probably 10cm or something.

The issue got locked but that doesn't really make sense prediction should flag 1E-4 differences and this is just calling making an actual proper check wrong. Any good anticheat with good enough predictions can flag 1E-12 no problems with Vanilla Minecraft this is just calling a proper check wrong which really doenst make sense. And 10 cms in ur wording cant even flag 80% velocity nor flag 20% speed bypasses which is just weird of you to tell

I need a good predicted location to run my collisions on which 1E-4 can really effect it and this makes 1:1 movement prediction impossible as a lot of players do use OptiFine but fair enough I guess.

And brute forcing the values for sin and cos and movements for 200 players concurrently can hit the performance by a bit. And for client side calling sin and cos every 50 ms on a modern cpu it really doesn't effect a lot of stuff.

Btw kudos for listening and actually caring about peoples problems I appreciate it.

MWHunter commented 3 years ago

Current issues with fastmath:

All for what? Using less values won't help performance, and the if statement to determine which table to use will just hurt performance more than using a smaller table helps, as an if statement slows down execution. Even people not using FastMath have the if statement checked slowing down their performance. There is a reason why similar mods and 1.16 servers, which have tons of optimizations and entire system rewrites, don't change the lookup table, it's simply not an issue.

Even if the smaller table got it into CPU cache, it would just be replacing something else in the cache and the performance impact would be negligible.

MisterCheezeCake commented 3 years ago

Perhaps just disable FastMath on servers, or implement an API kinda like Badlion's where cheaty features can be disabled by the server

mindforger commented 3 years ago

Perhaps just disable FastMath on servers

this won't help, it's the clients that are affected and send "invalid" data to the server and get a false positive flag

or implement an API kinda like Badlion's where cheaty features can be disabled by the server

that idea might be an idea but i expect the fastmath stuff is something you require the client to restart and can not be changed during connection to a server

MisterCheezeCake commented 3 years ago

Perhaps just disable FastMath on servers

this won't help, it's the clients that are affected and send "invalid" data to the server and get a false positive flag

or implement an API kinda like Badlion's where cheaty features can be disabled by the server

that idea might be an idea but i expect the fastmath stuff is something you require the client to restart and can not be changed during connection to a server

if those are true, then that would require a removal of fast math from the mod, or for servers to blacklist optifine, which now that I think about it, would not work for standalone OF, see issue https://github.com/sp614x/optifine/issues/5300

Technosword commented 3 years ago

I would agree with an API which would let fast math be disallowed or automatically toggled off.

Tecnio commented 3 years ago

yup same that would be poggers

SelfMadeSystem commented 3 years ago

Couldn't you just detect FastMath values and ban them tho? (kicking stating that you must disable them before joining the server)

Edit: But I do agree that an API would be useful (but still would not detect older versions of Optifine). It seems a bit late to do this post imo.

MWHunter commented 3 years ago

Couldn't you just detect FastMath values and ban them tho? (kicking stating that you must disable them before joining the server)

Edit: But I do agree that an API would be useful (but still would not detect older versions of Optifine). It seems a bit late to do this post imo.

Yes, I created a spigot plugin to do this https://www.spigotmc.org/resources/antifastmath.91568/

It detects fast math and kicks the player. It's not on a very high sensitivity, but it can kick in 0.75 seconds under optimal conditions without any false positives with default settings. It could actually be used on parkour servers to stop people abusing optifine as an unfair advantage, since fast math allows players to move faster than vanilla while looking at some angles.

It is not my responsibility to contact a mod creator about their mod breaking vanilla compatibility. It's the mod creator's job to make sure that their mod isn't sending invalid packets. It's the same thing with Lunar, how servers are starting to block Lunar for breaking vanilla mod compatibility. Either remove this or anticheats will start blocking Optifine for breaking vanilla behavior.

It's like if a client started using 3.15 for the value of pi. It's not faster, it's just wrong.

Janmm14 commented 3 years ago

Its not that hard to just copy-paste the optifine fastmath functions to your anticheat and calculate results once with regular math and once with fastmath and take the one which fits better.

This is the only viable option for you, as even if optifine would change, you'd still have to account for the older optifine versions.

MWHunter commented 3 years ago

Its not that hard to just copy-paste the optifine fastmath functions to your anticheat and calculate results once with regular math and once with fastmath and take the one which fits better.

It's not hard but it's CPU intensive and weakens the overall anticheat.

Janmm14 commented 3 years ago

Its not that hard to just copy-paste the optifine fastmath functions to your anticheat and calculate results once with regular math and once with fastmath and take the one which fits better.

It's not hard but it's CPU intensive and weakens the overall anticheat.

Then do some optimizations - let it remember if fastmath was active last movement and calculate the other fastmath state as backup if it does not fit with the current one slightly. You could probably even optimize it a little more, only accept state changes when the user had the chance to actually go into the settings and change the state (like 5 or 10 ticks of movements with no user input or sth. along those lines).

MisterCheezeCake commented 3 years ago

Its not that hard to just copy-paste the optifine fastmath functions to your anticheat and calculate results once with regular math and once with fastmath and take the one which fits better.

It's not hard but it's CPU intensive and weakens the overall anticheat.

Then do some optimizations - let it remember if fastmath was active last movement and calculate the other fastmath state as backup if it does not fit with the current one slightly. You could probably even optimize it a little more, only accept state changes when the user had the chance to actually go into the settings and change the state (like 5 or 10 ticks of movements with no user input or sth. along those lines).

Anticheat devs should not have to accommodate this mod changing vanilla behavior. There are a couple of options to fix the issue on optifine's end.

  1. Just completely disable Fast Math on servers
  2. or 2 have an APi like Badlion where features can be disabled. Alternatively, Anticheat devs could try and accommodate Fast Math, but this would be imperfect and could lead to Bypasses, there is also the option of just kicking/banning users detected with Fast Math,
Janmm14 commented 3 years ago

Its not that hard to just copy-paste the optifine fastmath functions to your anticheat and calculate results once with regular math and once with fastmath and take the one which fits better.

It's not hard but it's CPU intensive and weakens the overall anticheat.

Then do some optimizations - let it remember if fastmath was active last movement and calculate the other fastmath state as backup if it does not fit with the current one slightly. You could probably even optimize it a little more, only accept state changes when the user had the chance to actually go into the settings and change the state (like 5 or 10 ticks of movements with no user input or sth. along those lines).

Anticheat devs should not have to accommodate this mod changing vanilla behavior. There are a couple of options to fix the issue on optifine's end.

  1. Just completely disable Fast Math on servers
  2. or 2 have an APi like Badlion where features can be disabled. Alternatively, Anticheat devs could try and accommodate Fast Math, but this would be imperfect and could lead to Bypasses, there is also the option of just kicking/banning users detected with Fast Math,

I don't see how handling fastmath like I described or in a similar way could ever lead to bypasses.

Also even if optifine would change, you'd still have to account for the older optifine versions. Servers will loose players, especially casual players, if you kick players with fastmath enabled or old optifine versions.

There are already anticheats out there handling FastMath just fine.

Anticheat devs are already really good at accomodating the sometimes shitty information minecraft java clients are sending out (or NOT sending out). I don't see the significance of this problem compared to minecraft java not sending movements in cobwebs constantly and just adding the pressed buttons to the move packets (similar to what Labymod offers). You should try to use mojang's bug tracker / feature request site to get that improved.

Essentially at the end it can be understood easily as you threatening that people without knowledge of the insignificance to gameplay how optifine is not completely vanilla with fastmath enabled will come and spam to optifine and complain about getting kicked if this "issue" is not getting fixed.

MWHunter commented 3 years ago

Are you sure those anticheats can handle the NaN (not a number) being sent https://github.com/sp614x/optifine/issues/3395

Yes, it is rare for this to occur, but the risk of players getting banned for this isn't worth it to keep in an option that isn't helping performance. I've seen NaN be instant bans before.

For handling older versions, yes, we still need the code. But for example, if this option was removed before 1.17 optifine was released, then it would be good to no longer have to check for fastmath on the 1.17 clients helping performance.

Kicking players using fast math will most likely be an option in more anticheats. Fast math does allow jumps not possible in vanilla meaning it is a cheat. I see parkour servers enabling an anti-fastmath check or at least nulling highscores obtained by fastmath.

Anticheat devs will accommodate vanilla behavior and if this was a vanilla option then people wouldn't complain. But this is a third party mod that is miscalculating movements for no real benefit. Don't compare this to vanilla. The anticheat community doesn't want to spend time adding support for misbehaving mods.

ZenithRogue commented 3 years ago

Wouldn't an anticheat that is the precise cause issue with users that have severe network lag?

Ive gotten kicked from servers many times (without OF), bc the server thought i was in a different spot

Janmm14 commented 3 years ago

Wouldn't an anticheat that is the precise cause issue with users that have severe network lag?

Ive gotten kicked from servers many times (without OF), bc the server thought i was in a different spot

You're offtopic and you're wrong

MWHunter commented 3 years ago

Vanilla client: (0, 0) to (0, 1.12345678) Optifine fastmath: (0, 0) to (0, 1.124) or (0, 0) to (0, 1.23)

Network lag has nothing to do with this. At most, with lag, you need to replicate the world per player and lag compensate it. Also, yeah offtopic, lag has nothing to do with FastMath giving the wrong trig results.

MWHunter commented 3 years ago

A bit off topic, but an API for servers to request player inputs for regular movement would be nice. Default off of course. Plus the API for disabling fast math.