{"action":"closed","issue":{"url":"https://api.github.com/repos/Facepunch/garrysmod-issues/issues/2565","repository_url":"https://api.github.com/repos/Facepunch/garrysmod-issues","labels_url":"https://api.github.com/repos/Facepunch/garrysmod-issues/issues/2565/labels{/name}","comments_url":"https://api.github.com/repos/Facepunch/garrysmod-issues/issues/2565/comments","events_url":"https://api.github.com/repos/Facepunch/garrysmod-issues/issues/2565/events","html_url":"https://github.com/Facepunch/garrysmod-issues/issues/2565","id":149333024,"number":2565,"title":"GM:SetupMove Clientside Hiccups","user":{"login":"Dgrouse96","id":5017491,"avatar_url":"https://avatars.githubusercontent.com/u/5017491?v=3","gravatar_id":"","url":"https://api.github.com/users/Dgrouse96","html_url":"https://github.com/Dgrouse96","followers_url":"https://api.github.com/users/Dgrouse96/followers","following_url":"https://api.github.com/users/Dgrouse96/following{/other_user}","gists_url":"https://api.github.com/users/Dgrouse96/gists{/gist_id}","starred_url":"https://api.github.com/users/Dgrouse96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dgrouse96/subscriptions","organizations_url":"https://api.github.com/users/Dgrouse96/orgs","repos_url":"https://api.github.com/users/Dgrouse96/repos","events_url":"https://api.github.com/users/Dgrouse96/events{/privacy}","received_events_url":"https://api.github.com/users/Dgrouse96/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-19T02:48:03Z","updated_at":"2016-04-19T03:08:11Z","closed_at":"2016-04-19T03:08:11Z","body":"I wrote about this a year ago, but found it hard to reproduce the issue, now with a program called clumsly, I can simulate varying amounts of lag. - Even without using clumsly, the dedicated server shows the same issue.\r\n\r\nClient's lag affects SetupMove.\r\n- If you set the client's velocity only once out of the multiple ticks it will not apply this velocity.\r\n- When I was told it was a problem with my code and and was asked to write a script to set the client's velocity at a key press, there were no issues.\r\n- Of course there's going to be no issues because the keypress is ran correct to the ticks that need the same set velocity value.\r\n\r\nWith 200 ping, I print whether or not the attack key is being pressed ---\r\n- I press my attack key for a split second, \r\n- This is what the server sees:\r\n\r\n( tostring(cmd:KeyDown(IN_ATTACK))..\" : \"..CurTime() )\r\n\r\nfalse : 56.055000305176\r\nfalse : 56.069999694824\r\nfalse : 56.084999084473\r\ntrue : 56.099998474121\r\ntrue : 56.11499786377\r\ntrue : 56.129997253418\r\ntrue : 56.145000457764\r\ntrue : 56.159999847412\r\ntrue : 56.174999237061\r\ntrue : 56.189998626709\r\ntrue : 56.204998016357\r\ntrue : 56.219997406006\r\ntrue : 56.235000610352\r\ntrue : 56.25\r\ntrue : 56.264999389648\r\ntrue : 56.279998779297\r\ntrue : 56.294998168945\r\ntrue : 56.309997558594\r\ntrue : 56.324996948242\r\ntrue : 56.340000152588\r\ntrue : 56.354999542236\r\ntrue : 56.369998931885\r\nfalse : 56.384998321533\r\nfalse : 56.399997711182\r\nfalse : 56.41499710083\r\n\r\n- This is what the client sees:\r\n\r\nfalse : 56.084999084473\r\nfalse : 56.084999084473\r\ntrue : 56.099998474121\r\ntrue : 56.099998474121\r\ntrue : 56.099998474121\r\ntrue : 56.11499786377\r\nfalse : 55.889999389648\r\nfalse : 55.904998779297\r\nfalse : 55.919998168945\r\nfalse : 55.934997558594\r\nfalse : 55.949996948242\r\nfalse : 55.965000152588\r\nfalse : 55.979999542236\r\nfalse : 55.994998931885\r\nfalse : 56.009998321533\r\nfalse : 56.024997711182\r\nfalse : 56.03999710083\r\nfalse : 56.055000305176\r\nfalse : 56.069999694824\r\nfalse : 56.084999084473\r\ntrue : 56.099998474121\r\ntrue : 56.11499786377\r\ntrue : 56.11499786377\r\ntrue : 56.129997253418\r\nfalse : 55.919998168945\r\nfalse : 55.934997558594\r\nfalse : 55.949996948242\r\nfalse : 55.965000152588\r\nfalse : 55.979999542236\r\nfalse : 55.994998931885\r\nfalse : 56.009998321533\r\nfalse : 56.024997711182\r\nfalse : 56.03999710083\r\nfalse : 56.055000305176\r\nfalse : 56.069999694824\r\nfalse : 56.084999084473\r\ntrue : 56.099998474121\r\ntrue : 56.11499786377\r\ntrue : 56.129997253418\r\ntrue : 56.129997253418\r\ntrue : 56.145000457764\r\ntrue : 56.145000457764\r\ntrue : 56.145000457764\r\ntrue : 56.159999847412\r\nfalse : 55.949996948242\r\nfalse : 55.965000152588\r\nfalse : 55.979999542236\r\nfalse : 55.994998931885\r\nfalse : 56.009998321533\r\nfalse : 56.024997711182\r\nfalse : 56.03999710083\r\nfalse : 56.055000305176\r\nfalse : 56.069999694824\r\nfalse : 56.084999084473\r\ntrue : 56.099998474121\r\ntrue : 56.11499786377\r\ntrue : 56.129997253418\r\ntrue : 56.145000457764\r\ntrue : 56.159999847412\r\ntrue : 56.159999847412\r\ntrue : 56.174999237061\r\ntrue : 56.174999237061\r\ntrue : 56.174999237061\r\ntrue : 56.189998626709\r\ntrue : 56.189998626709\r\ntrue : 56.189998626709\r\ntrue : 56.189998626709\r\ntrue : 56.204998016357\r\ntrue : 56.204998016357\r\ntrue : 56.204998016357\r\ntrue : 56.219997406006\r\ntrue : 56.219997406006\r\ntrue : 56.219997406006\r\ntrue : 56.235000610352\r\ntrue : 56.235000610352\r\ntrue : 56.235000610352\r\ntrue : 56.25\r\nfalse : 55.994998931885\r\nfalse : 56.009998321533\r\nfalse : 56.024997711182\r\nfalse : 56.03999710083\r\nfalse : 56.055000305176\r\nfalse : 56.069999694824\r\nfalse : 56.084999084473\r\ntrue : 56.099998474121\r\ntrue : 56.11499786377\r\ntrue : 56.129997253418\r\ntrue : 56.145000457764\r\ntrue : 56.159999847412\r\ntrue : 56.174999237061\r\ntrue : 56.189998626709\r\ntrue : 56.204998016357\r\ntrue : 56.219997406006\r\ntrue : 56.235000610352\r\ntrue : 56.25\r\ntrue : 56.25\r\ntrue : 56.264999389648\r\ntrue : 56.264999389648\r\ntrue : 56.264999389648\r\ntrue : 56.279998779297\r\ntrue : 56.279998779297\r\ntrue : 56.279998779297\r\ntrue : 56.279998779297\r\ntrue : 56.294998168945\r\nfalse : 56.084999084473\r\ntrue : 56.099998474121\r\ntrue : 56.11499786377\r\ntrue : 56.129997253418\r\ntrue : 56.145000457764\r\ntrue : 56.159999847412\r\ntrue : 56.174999237061\r\ntrue : 56.189998626709\r\ntrue : 56.204998016357\r\ntrue : 56.219997406006\r\ntrue : 56.235000610352\r\ntrue : 56.25\r\ntrue : 56.264999389648\r\ntrue : 56.279998779297\r\ntrue : 56.294998168945\r\ntrue : 56.294998168945\r\ntrue : 56.309997558594\r\ntrue : 56.309997558594\r\ntrue : 56.309997558594\r\ntrue : 56.309997558594\r\ntrue : 56.324996948242\r\ntrue : 56.11499786377\r\ntrue : 56.129997253418\r\ntrue : 56.145000457764\r\ntrue : 56.159999847412\r\ntrue : 56.174999237061\r\ntrue : 56.189998626709\r\ntrue : 56.204998016357\r\ntrue : 56.219997406006\r\ntrue : 56.235000610352\r\ntrue : 56.25\r\ntrue : 56.264999389648\r\ntrue : 56.279998779297\r\ntrue : 56.294998168945\r\ntrue : 56.309997558594\r\ntrue : 56.324996948242\r\ntrue : 56.340000152588\r\ntrue : 56.340000152588\r\ntrue : 56.340000152588\r\ntrue : 56.340000152588\r\ntrue : 56.354999542236\r\ntrue : 56.354999542236\r\ntrue : 56.354999542236\r\ntrue : 56.354999542236\r\ntrue : 56.369998931885\r\ntrue : 56.369998931885\r\ntrue : 56.369998931885\r\nfalse : 56.384998321533\r\nfalse : 56.384998321533\r\nfalse : 56.384998321533\r\nfalse : 56.399997711182\r\nfalse : 56.399997711182\r\nfalse : 56.399997711182\r\nfalse : 56.41499710083\r\ntrue : 56.189998626709\r\ntrue : 56.204998016357\r\ntrue : 56.219997406006\r\ntrue : 56.235000610352\r\ntrue : 56.25\r\ntrue : 56.264999389648\r\ntrue : 56.279998779297\r\ntrue : 56.294998168945\r\ntrue : 56.309997558594\r\ntrue : 56.324996948242\r\ntrue : 56.340000152588\r\ntrue : 56.354999542236\r\ntrue : 56.369998931885\r\nfalse : 56.384998321533\r\nfalse : 56.399997711182\r\nfalse : 56.41499710083\r\nfalse : 56.41499710083\r\nfalse : 56.430000305176\r\ntrue : 56.219997406006\r\ntrue : 56.235000610352\r\ntrue : 56.25\r\ntrue : 56.264999389648\r\ntrue : 56.279998779297\r\ntrue : 56.294998168945\r\ntrue : 56.309997558594\r\ntrue : 56.324996948242\r\ntrue : 56.340000152588\r\ntrue : 56.354999542236\r\ntrue : 56.369998931885\r\nfalse : 56.384998321533\r\nfalse : 56.399997711182\r\nfalse : 56.41499710083\r\nfalse : 56.430000305176\r\nfalse : 56.430000305176\r\nfalse : 56.444999694824\r\nfalse : 56.444999694824\r\nfalse : 56.459999084473\r\ntrue : 56.25\r\ntrue : 56.264999389648\r\ntrue : 56.279998779297\r\ntrue : 56.294998168945\r\ntrue : 56.309997558594\r\ntrue : 56.324996948242\r\ntrue : 56.340000152588\r\ntrue : 56.354999542236\r\ntrue : 56.369998931885\r\nfalse : 56.384998321533\r\nfalse : 56.399997711182\r\nfalse : 56.41499710083\r\nfalse : 56.430000305176\r\nfalse : 56.444999694824\r\nfalse : 56.459999084473\r\nfalse : 56.459999084473\r\nfalse : 56.474998474121\r\nfalse : 56.474998474121\r\nfalse : 56.474998474121\r\nfalse : 56.48999786377\r\nfalse : 56.48999786377\r\nfalse : 56.48999786377\r\nfalse : 56.48999786377\r\nfalse : 56.504997253418\r\nfalse : 56.504997253418\r\nfalse : 56.504997253418\r\nfalse : 56.520000457764\r\nfalse : 56.520000457764\r\nfalse : 56.520000457764\r\nfalse : 56.534999847412\r\ntrue : 56.324996948242\r\ntrue : 56.340000152588\r\ntrue : 56.354999542236\r\ntrue : 56.369998931885\r\nfalse : 56.384998321533\r\nfalse : 56.399997711182\r\nfalse : 56.41499710083\r\nfalse : 56.430000305176\r\nfalse : 56.444999694824\r\nfalse : 56.459999084473\r\nfalse : 56.474998474121\r\nfalse : 56.48999786377\r\nfalse : 56.504997253418\r\nfalse : 56.520000457764\r\nfalse : 56.534999847412\r\nfalse : 56.534999847412\r\nfalse : 56.549999237061\r\nfalse : 56.549999237061\r\nfalse : 56.549999237061\r\nfalse : 56.564998626709\r\nfalse : 56.564998626709\r\nfalse : 56.564998626709\r\nfalse : 56.579998016357\r\ntrue : 56.354999542236\r\ntrue : 56.369998931885\r\nfalse : 56.384998321533\r\nfalse : 56.399997711182\r\n\r\nI know having the client refresh faster is how it should be to smooth movements out. But the more lag you have the more the key stutters true-false-true-false-true-false when I've only pressed it once.\r\n- at 5 ping, there's almost no stuttering.\r\n- at 80 ping, there's lots of stuttering. etc.\r\n\r\nThe issue with my code:\r\n- Player presses keys to impulse a velocity, (kicking off a wall)\r\n- A variable (NextWallKick) is set to Curtime()+0.1 (stops the player from kicking for 0.1 seconds)\r\n- With variable set, client does extra refreshes on the code, and the NextWallKick variable blocks the refreshes from setting the clients velocity.\r\n- Without the extra refreshes setting the velocity, nothing happens on the clientside and a prediction error occurs\r\n\r\nA hacky workout I came up with is to get the server to send a net message to the client telling them when they are allowed to kick again.\r\n- The issue with this is that clients will get prediction errors by kicking faster than they are allowed to.\r\n\r\nAnother attempt to fix this issue is by checking if the current refresh is at the same CurTime as the last and setting a bool called IsFirst, but as printing the key showed, it stutters over time.\r\n\r\nSetupMove has always been this rubbish, been trying to work around this issue for ages, but it's much too limiting. Are the extra refreshes and stuttering really necessary?"}}