aitorzip / DeepGTAV

A plugin for GTAV that transforms it into a vision-based self-driving car research environment.
GNU General Public License v3.0
1.12k stars 274 forks source link

Steering angle offset wrong since latest update (1290) #89

Open IanKirwan opened 6 years ago

IanKirwan commented 6 years ago

The value that comes out for steering angle is now junk since update to 1.1290. Other values seem OK. Anyone know how to get the offset right? What tools?

IanKirwan commented 6 years ago

Update: Throttle and brake also junk. Have managed to get the vehicle base address as: 0x8BAA8850 However when I try to examine this address up to +999 CheatEngine is having none of it. Just returns a dialog saying 'scan error: no readble memory found'. Have been trying the long way by searching the whole address range for 0 value float (looking for throttle) then increase throttle but my machine keeps running out of space for the generated address list so I cant get to it that way at the moment. Any help would be appreciated in getting these offsets.

xiaoli-chen commented 6 years ago

same here, I never develop GTA plugin before, but found these to conversation maybe helpful https://github.com/aitorzip/DeepGTAV/issues/3 https://github.com/aitorzip/DeepGTAV/issues/43

Anyone can help me on setting the compile environment ?

IanKirwan commented 6 years ago

@xiaoli-chen Install visual studio 2017 community edition, then you should just be able to open DeepGTAV.vcxproj which is ready to go and builds successfully unmodified.

Thanks for the links. I have looked at these before which helped in getting the vehicle base address. However when I try to use the vehicle base address and the suggested range for a cheat engine scan, cheat engine says 'scan error: no readable memory found'. Just wondering if I'm doing something fundamentally wrong with CheatEngine and the base address. So for instance I just started up GTAV with DeepGTAV and got the vehicle base address as 0xCD4BD110. CheatEngine however shows the following status of memory regions:

Address     State      Protect        Size
7FFF0000  Free        No Access   A300010000

This makes me think the vehicle base address is relative to some other address, but what? Can't be GTAV.exe as that seems to be the same address every session whereas the vehicle base address changes every GTAV session.

IanKirwan commented 6 years ago

OK have found steering offset, though it nolonger requires the division by 0.69.... Could only find a combined throttle and brake offset. So my code is modified (scenario.cpp) to give the negative part to brake and positive part to throttle, like this:

float Scenario::rectifyValue(float value) {
    if (value > 0.0f) {
        return value;
    }
    else
    {
        return 0.0f;
    }
}

void Scenario::setThrottle(){
    d["throttle"] = rectifyValue(getFloatValue(vehicle, 0x874)); // Previously:  0x92C
}

void Scenario::setBrake(){
    d["brake"] = rectifyValue(-getFloatValue(vehicle, 0x874)); // Previously: 0x930
}

void Scenario::setSteering(){
    d["steering"] = -getFloatValue(vehicle, 0x93C); // Previously: (0x924) / 0.6981317008
}

It's not quite right because if you have throttle and press brake, brake values dont go positive until throttle hits zero and vice versa, but it'll have to do for now.

angelapper commented 6 years ago

also I add keyDown detection for W, A, S, D, sample code is in ScriptHookV_SDK_1.0.617.1a which you can download from http://www.dev-c.com/

angelapper commented 6 years ago

the DeepDrive project is discontinued, did anyone still have the code?

fuenwang commented 6 years ago

Hi all, just follow the offset of scripthookdotnet source code, which is still maintained. https://github.com/crosire/scripthookvdotnet/blob/dev_v3/source/scripting/World/Entities/Vehicles/Vehicle.cs#L1258 I think this line is what you looking for. BTW, I think the angle get from this offset is already angle in radian which doesn't need to be divided by 0.6981317008. I think the author just want to normalize it, but 0.6981317008 is actually a wrong number.

angelapper commented 6 years ago

@fuenwang good, this is a good source ~, agree, author just want to normalize it