The TORCS Racing Board
Username: Password: Remember Me?
Lost Password Register
Author: phi | Created: 2017-07-20 19:06:00
Subject: Hidden-Valley: pit 7
Greetings all


Klin doesn't stop in pit 7 (the closest to the start line):

A) Tested with 7 teams:
- doesn't stop in pit 7
- stop in pit 6

B) Tested with 8 teams:
- stop in pit 8
- doesn't stop in pit 7
- stop in pit 6


EDIT: I mean. It stops, but is not picked up.
Last Edited: 2017-07-20 19:51:47 by phi
    Author: firechief | Created: 2017-07-21 04:22:46
    Subject: Re: Hidden-Valley: pit 7
    Yes this is a critical bug - I'm glad you've picked it up. Its impossible for any car to perform a pitstop as, for whatever reason, TORCS just isn't granting stops for that pit area. I tried doing it manually, but no matter where in that box I stopped, I couldn't get a pitstop to register.

    I don't know if Bernhard's checking these forums so I've sent him an email. We either need the track to be fixed (I could find time to do that if I knew what the problem was), the game to be fixed if its a bug in TORCS, or another track substituted in Hidden Valley's place.

    Edit: After more testing, its because pit #7 starts prior to the S/F line, and ends after it. That's because the first length of pits goes for 100m, and the 2nd length (after the S/F line) goes for 200. Each pit is 15m, and while 15 divides cleanly into 300m, it doesn't divide cleanly into 100. At the moment, it seems TORCS can't handle a pit that crosses the S/F line like that.

    So the question is whether this can be quickly fixed in TORCS, or if the track has to change. Only Bernhard can answer the former (unless someone has time to look at the code, make a fix and submit a patch), and for the latter it'd be best if I did it - I know it'd be a few hours work as the 3D model would change and so would the shadow image. I can't guarantee that I'll have time for it prior to the next race. I might, but at this stage I don't know.
    Last Edited: 2017-07-21 05:29:48 by firechief
      Author: phi | Created: 2017-07-21 09:21:59
      Subject: Re: Hidden-Valley: pit 7
      Is it possible to change the S/F line to another location - only in XML data? I do not know if this is possible or easy, but, if "yes", it could serve as a temporary and emergency solution.
      Last Edited: 2017-07-21 09:21:59 by phi
        Author: firechief | Created: 2017-07-21 09:27:07
        Subject: Re: Hidden-Valley: pit 7
        Unfortunately no, as the position of everything else on the track is relative to the S/F line. The most minimal way to adjust the track is to change the length of the pit areas before & after the S/F line. Even that is quite a bit of work - the track can be auto-generated but all the surrounding terrain & objects are hand placed. There'd be quite a lot of 3D editing to do.
        Last Edited: 2017-07-21 09:27:07 by firechief
    Author: dummy | Created: 2017-07-21 10:57:00
    Subject: Re: Hidden-Valley: pit 7
    I fixed it ;)

    raceengine.cpp:190
    //if ((lgFromStart > car->_pit->lmin) && (lgFromStart < car->_pit->lmax)) {
    bool withinPitLength;
    if ((car->_pit->lmax - car->_pit->lmin) < 0.0) {
    withinPitLength = ((lgFromStart > car->_pit->lmin) && (lgFromStart <= ReInfo->track->length)) || ((lgFromStart >= 0.0) && (lgFromStart < car->_pit->lmax));
    } else {
    withinPitLength = (lgFromStart > car->_pit->lmin) && (lgFromStart < car->_pit->lmax);
    }
    if (withinPitLength) {


    EDIT: Or make sure you don't qualify at position 7 :)
    Last Edited: 2017-07-21 10:58:30 by dummy
      Author: phi | Created: 2017-07-21 11:58:25
      Subject: Re: Hidden-Valley: pit 7
      Thanks, Danny.


      Rookie luck :)
      Last Edited: 2017-07-21 11:58:25 by phi
      Author: firechief | Created: 2017-07-21 12:32:31
      Subject: Re: Hidden-Valley: pit 7
      Awesome work Danny! Make sure you let Bernhard know?
      Last Edited: 2017-07-21 12:32:31 by firechief
      Author: wdbee | Created: 2017-07-30 16:41:49
      Subject: Re: Hidden-Valley: pit 7
      Just did a test with my bot (with the fix described by Danny):
      The Hidden-Valley-Bug still makes the Overrun check be triggered, the bot restarts without be serviced!

      I have to rework the Overrun function as well :(

      Wolf-Dieter

      Last Edited: 2017-07-30 16:41:49 by wdbee
        Author: fa1 | Created: 2017-08-01 20:27:42
        Subject: Re: Hidden-Valley: pit 7
        Since the race is now going on: does it mean the unlucky car qualifying 7th hits the dust? (will run out of fuel while trying to pit)
        Or do we now have a working fix?

        Just want to know before I run my race.
        Thanks.
        Last Edited: 2017-08-01 20:27:42 by fa1
          Author: wdbee | Created: 2017-08-01 20:41:31
          Subject: Re: Hidden-Valley: pit 7
          AFAIK the fix described by Danny works for all except for the wdbee without additional changes.

          For the wdbee I had to change the Overrun detection as well, but this is included in the tarball.

          Have fun
          Last Edited: 2017-08-01 20:41:31 by wdbee
          Author: dummy | Created: 2017-08-01 22:09:43
          Subject: Re: Hidden-Valley: pit 7
          Yes. The fix I described above is in the TORCS source code:

          src/libs/raceengineclient/raceengine.cpp:190
          Last Edited: 2017-08-01 22:09:43 by dummy