PostEngine Prediction in Gmod

Posts 1–15 of 23 · Page 1 of 2
Engine Prediction in Gmod
Since there's a shit ton of misinformation floating around and a lot of people who really don't know what they're doing (partially including me for a bit) I decided to post this here. Why? Because I want someone else to make a C++ cheat for gmod one of these days and not paste it from weeabot or d3x's or fami's cheats.

Why do we need engine prediction?
LocalPlayer is **NOT** predicted in your createmove calls. You will be using outdated data for your aimbot/bhop/garbage cheat and therefore you'll lose in hvh.

Why not velocity prediction?
Why would you not want to use the exact method the engine uses to predict instead of inaccurate math to predict a player's position.

How do we do it?
Below is some general pseudo code that you can get the gist of easily. Underneath will be an explanation of why each step exsists.

Code:
backup curtime
backup frametime

set curtime to interval_per_tick * GetTickBase 
set frametime to interval_per_tick

set m_pCurrentCommand to the current command

Setup movedata struct

Call SetupMove pass local player, current command, nullptr and movedata
Call FullWalkMove pass localplayer, current command, and movedata
Call FinishMove pass local player, current command, and movedata

set m_pCurrentCommandto nullptr

set frametime to old frametime
set curtime to old curtime
Explanation of code
Backing up curtime and frametime are pretty straight forward, we'll be modifying those values and we want to be able to restore them.

frametime is really just the tickrate of the server

curtime is very straight forward

In certain source games (aka not csgo) the 'current tick' isn't set in time so we do that. (Shitty explanation, do your own research if you want to understand why this is important)

Setupmove in general handles all of your flags and netvar changes (read through the function please)

Wait a second, where's ProcessMovement!!!!! Instead of calling SetHost and ProcessMovement, you can call FullWalkMove instead which has a couple bonuses including some velocity fixes that you should read up on if you want 100% perfect prediction. Ever wondered why you can't hit entities while their Z velocity is over 200? (wink wink)

FullWalkMove is our main 'prediction' function which basically calls a bunch of others and if you really care you should read up on what each one does.

FinishMove does exactly what you think it does.
And oh my god look! It's that garbage AAA everyone uses and thinks they're cool!

Finally, reset the current command and frametime and curtime. This prediciton should be able to work in any source game so this doesn't just reflect gmod.
thats great an all... but what key to open menu

jk, nice post
Useful.

/2shrt
Code:
 Wait a second, where's RunCommand!!!!! Instead of calling SetHost and RunCommand, you can call FullWalkMove instead which has a couple bonuses including some velocity fixes that you should read up on if you want 100% perfect prediction. Ever wondered why you can't hit entities while their Z velocity is over 200? (wink wink)
it sounds like you don't know what runcommand even is... which questions if you even understand why you are calling these functions besides someone telling you to or doing basic research in sdk
Quote Originally Posted by D3M0L1T10N View Post
Code:
 Wait a second, where's RunCommand!!!!! Instead of calling SetHost and RunCommand, you can call FullWalkMove instead which has a couple bonuses including some velocity fixes that you should read up on if you want 100% perfect prediction. Ever wondered why you can't hit entities while their Z velocity is over 200? (wink wink)
it sounds like you don't know what runcommand even is... which questions if you even understand why you are calling these functions besides someone telling you to or doing basic research in sdk
Actually you pointed out a mistake. I meant to say ProcessMovement, not RunCommand. Whoops
doesn't processmovement call playermove then playermove calls fullwalkmove
Quote Originally Posted by eth0s View Post
doesn't processmovement call playermove then playermove calls fullwalkmove
Pretty sure, but it's been a bit since I stepped through. Leme check and I'll update this post.

Strange it does. For whatever reason (thanks to an unmentionable for tipping me of to this) player's z velocities are always highly inaccurate when falling. I had to manually fix it myself to gain accuracy. You're right it should be called but for whatever reason it never is quite right. In the end though, You still end up needing to use FullWalkMove instead of SetHost/ProcessMovement for gmod. I'm not sure if it's just the face that SetHost doesn't exsist in gmod or if there's another reason, but no combination and amount of rechecking got it to work for me.
Thanks so much for this. I have a dumb question though. This is obviously supposed to be placed before any aimbot code, correct? Is there any aimbot code that needs to go between FinishMove and SetupMove? I know these are extremely dumb questions, but will help me immensely. Thanks!
Quote Originally Posted by click4dylan View Post
Thanks so much for this. I have a dumb question though. This is obviously supposed to be placed before any aimbot code, correct? Is there any aimbot code that needs to go between FinishMove and SetupMove? I know these are extremely dumb questions, but will help me immensely. Thanks!
You use this to predict the movement of the player, your aimbot's find player goes b4 and the target pos goes after. Also this method won't work in lua
Quote Originally Posted by Gorzoid View Post
You use this to predict the movement of the player, your aimbot's find player goes b4 and the target pos goes after. Also this method won't work in lua
This doesn't make sense. Why would you find a player before calling prediction? Calling traceline before calling prediction will still have the unpredicted local player position. Also, do I need to call this for each enemy player?
Quote Originally Posted by click4dylan View Post
This doesn't make sense. Why would you find a player before calling prediction? Calling traceline before calling prediction will still have the unpredicted local player position. Also, do I need to call this for each enemy player?
How can you predict a player if you don't even have one??
I've found that ProcessMovement is the best, but you can also try running AirMove and FullWalkMove
Do you guys even bother to read? You need to predict LOCALPLAYER not your target. This is all for C++ cheats anyways. also @dasq , you can call ProcessMovement without SetHost in gmod you will crash when you go into water. I'll let you figure out why.

- - - Updated - - -

Quote Originally Posted by eth0s View Post
doesn't processmovement call playermove then playermove calls fullwalkmove
eth0s, I did a bit more digging and a bit of talking with a couple of friends and I can share what I found in a PM if you'd like
IAmPhage: I do StartTrackPredictionErrors and FinishTrackPredictionErrors after and before i write the CMDs instead and it works fine, virtual tables 2 and 3 in GameMovement. I know you can also just skip that and do SetHost or *(DWORD*)(clientaddr + m_predictedplayer) = localplayer; but I prefer this method.
Quote Originally Posted by dasq View Post
IAmPhage: I do StartTrackPredictionErrors and FinishTrackPredictionErrors after and before i write the CMDs instead and it works fine, virtual tables 2 and 3 in GameMovement. I know you can also just skip that and do SetHost or *(DWORD*)(clientaddr + m_predictedplayer) = localplayer; but I prefer this method.
That'll work as well, you dont have to call StartTrackPredictionErrors and FinishTrackPredictionErrors though
Posts 1–15 of 23 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?