Raycasting Question w/ FE

How can I check to see if a player is lag switching? And what would be a good way of teleporting them back to their previous position?

I want the player to teleport back to their original position from the time that they were last connected…

For example, if they are at point A, and they lag switch to point B, I want the player to teleport back to point A (which represents their previous location before lag switching).

Thanks for reading this.

1 Like

I guess you’d want to check on an interval if their last position is further away than than max speed + buffer can reach or not?

2 Likes

yeah. So within a loop, if the player’s distance from their previous position is > 2 studs, then teleport them back to the previous position from the last loop execution?

i wasn’t doing this to prevent lag switching, but rather to prevent glitching through doors.

I saved their last position into a table every .1 seconds, then if they’re detected glitching I find the closest value to like 1 second ago and teleport them back there.

I also auto removed old positions past the point I would need to put them back to (ex 3 seconds) prevent from saving positions infinitely.

1 Like

Thanks fireboltofdeath and gullet for your replies. If anyone has something to add, feel free to comment.

1 Like

Also, if a player is like over 20 studs from their last position recorded, the game should probably kick them because they lag switched pretty far out, or teleported via exploits. I will implement that into this logic as well.

You probably shouldn’t kick someone for lagging, people can genuinely lag that far and it’s super annoying to get a false positive and get kicked. If a game kicked me thinking I was an exploiter, I’d probably never play it again.

5 Likes

Returning players to their last position if you detect them moving a certain amount of studs isn’t very good for laggy players.

Have you ever seen a laggy player join a game, walk on the spot for ages then seemingly teleport? This happens because movement is handled on the client. Therefore, you will probably have a whole load of laggy players getting teleported backward and forward. In the end, they might not even get anywhere, which isn’t good.

I don’t really know what you can do to solve this, but I just thought I should say. If anybody does know, please reply because I would be interested to find out.

That seems soo true lol. Well, I guess I could allow some “lagging”, but if the player somehow manages to move like 20-30+ studs since the last loop / render step, it’s probably safe to assume that they probably lag switched and moved around and / or teleported.

In the game Apocalypse Rising 2, I sometimes get teleported back a little bit because there must’ve been some lag. Their system seems to work fine, but it can get annoying when you do get teleported back from your position 1 - 2 seconds ago (even though you weren’t intentionally trying to lag).

Maybe you could log how many times a person has lagged. If it was just the one time, do nothing. If it’s all the time but with intervals, then you could probably assume they are teleporting. Because, a laggy person will pretty much be teleporting every time they try to move, but an exploiter will move normally, teleport at will, move normally, teleport at will.

You could use this to your advantage and check for teleport exploits this way.

1 Like