bradenhurl / DeepGTAV-PreSIL

GNU General Public License v3.0
78 stars 16 forks source link

Error loading paths.xml file in LaneRewarder #15

Open sharma-n opened 4 years ago

sharma-n commented 4 years ago

Hi, Thanks for sharing your work! WHile trying to run the code, I'm facing the following issue (error from Client side) once i run python dataset:

$ python dataset
Trying to connect to DeepGTAV
Successfully connected to DeepGTAV
Connecting to client...
Message sent to client to begin.
Traceback (most recent call last):
  File "dataset", line 188, in <module>
    message = client.recvMessage()
  File "C:\Users\account\Downloads\DeepGTAV-PreSIL\VPilot\deepgtav\client.py", line 52, in recvMessage
    frame = self._recvall()
  File "C:\Users\account\Downloads\DeepGTAV-PreSIL\VPilot\deepgtav\client.py", line 66, in _recvall
    packet = self.s.recv(4 - len(data))
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

Once I run python dataset, the game freezes and is forcefully closed. The deepgta.log file shows:

Initializing Winsock...Initialized.
Socket created.
Bind done.
Listening...

The last log entry I can get from the code by inserting my own log comments is in the void Server::checkClient() function.

Any help would be much appreciated!

sharma-n commented 4 years ago

Update! I have further narrowed the problem down to the LaneRewarder that is instantiated during the initialization of the Dataset. For some reason, the lanerewarder is not able to load the paths.xml file properly.

LaneRewarder::LaneRewarder(const char* pathsfile) {
    log("Starting LaneRewarder constructor");
    while (nodes.size() == 0) {
        if (PATHFIND::_0xF7B79A50B905A30D(-8192.0f, 8192.0f, -8192.0f, 8192.0f)) {
            populateNodes(pathsfile);
        }
        WAIT(0);
    }
    log("Finished LaneRewarder constructor");
}

From the code above, I am able to log the start message, but not the finish message. To be more specific, the error occurs somewhere near this line in LaneRewarder.cpp. I have not been able to log the error though.

sharma-n commented 4 years ago

My guess is that the error is related to the fact that my GTA version is much more ahead of what was used to code DeepGTA (even though I updated ScriptHookV and other stuff accordingly).

My workaround this issue was to just skip the loading of the paths.xml file entirely. It is used in DeepGTA to perform some sort of reward calculation. But for getting the PreSIL dataset I don't think this is really required. So I just removed the reward=[15.0, 0.0], from lines 139 and 158 in VPilot/dataset

Doing this skips the loading of the paths.xml file and then the rest of the code runs smoothly! Able to collect the dataset now. Hopefully someone can solve this issue at a later stage, but since it works without, I'm not going to pursue this.

Hope this helps someone in the future!

Sudo42b commented 3 years ago

Please refer this link page

add #include <stdexcept> in LaneRewarder.cpp