• "Auto racing began 5 minutes after the second car was built." - Henry Ford
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Dear Guest. Follow RaceDepartment on Twitter, Facebook, Instagram, Twitch, Steam and YouTube.

How to create traffic in Racer?

Discussion in 'Racer' started by Kalmykov, Jun 15, 2013.

  1. Kalmykov

    Kalmykov

    Messages:
    16
    Ratings:
    +0
    I've noticed there is a tab in TrackEd called "Traffic" where you can create and customize waypoints. But how to actuaaly create traffic and make it follow those waypoints? It is possible to make the traffic cars accelerate/deccelerate at a certain time-step or at least at certain position?
     
  2. Alexander Knoll

    Alexander Knoll
    NEVER GIVE UP!!

    Messages:
    1,417
    Ratings:
    +286
  3. Mr Whippy

    Mr Whippy

    Messages:
    2,989
    Ratings:
    +461
    Is Boomer's post there using AI though, or the newer traffic waypoint system?

    Iirc there isn't a guide on racer.nl as I looked the other day and didn't find anything... Hmmmm.

    I think Stereo knows how so maybe he'll be kind enough to give us a few hints :)


    Also we could do with some traffic car assets... anyone fancy modelling a bunch of common cars? Hehe

    I wonder if there is a way to have any given car use random colours maybe? Maybe have a random offset in uv in shader and have a body colour texture swatch somehow!?

    Obviously if you can load in these meshes to gpu memory its better to add colour variety with instances vs whole new unique cars just to have a different colour. Hmmm.


    I put some traffic on a track the other day via tracked but no idea how you even make cars appear on it hehe :)

    Dave
     
  4. Stereo

    Stereo

    Messages:
    2,441
    Ratings:
    +1,475
    I think you need to open up the traffic.ini and manually add car entries right now.

    It goes like this:
    Code:
    cars
    {
      car0
      {
        car=car_folder
        waypoint=1
      }
    }
    They start in the track's starting grid rather than at waypoints though, so you need a starting grid with enough entries for the number of traffic you want.
    Once the game's started, you can warp them to specific waypoints with console command "traffic warp <car> <waypoint>", like "traffic warp 0 38". By default they'll be on random-roam, and picking up any waypoints they run over, so you have to be careful that if two routes overlap there are no waypoints near the intersection.


    Each waypoint does include a velocity in m/s that the car will try to reach, every time it hits a waypoint it change the velocity target.
     
  5. boomer541

    boomer541

    Messages:
    1,350
    Ratings:
    +165
    Damn, that was a long time ago. I forgot all about it but it did work quite well.
     
  6. Kalmykov

    Kalmykov

    Messages:
    16
    Ratings:
    +0
    Stereo, thank very much! It is working very well. And thanks to other guys for their answers as well :)
     
  7. aadilf1

    aadilf1

    Messages:
    714
    Ratings:
    +164


    How do I know where the waypoints are. And also that warp thing I don't understand And I dont know how to open console commands! I press shift+~ and nothing happens! It is enabled in Racer.ini too!
     
  8. Mr Whippy

    Mr Whippy

    Messages:
    2,989
    Ratings:
    +461
    My console just gives me "did not understand console command traffic warp 0 0" which should in theory move the 0 indexed traffic car to waypoint 0.

    Doesn't work with 1 0, or 0 1, or 1 1.

    Do I need a nice grid of waypoints? I just have 9 so far that just go forward 3, then split into 3 choices each with one extra after those...


    I'm sure I'll get it working though eventually hehe.

    Do you need splines or something for it to work on top of?!

    Dave
     
    • Like Like x 1
  9. aadilf1

    aadilf1

    Messages:
    714
    Ratings:
    +164

    Same for me. I got console working but the above issue happened :(
     
  10. Stereo

    Stereo

    Messages:
    2,441
    Ratings:
    +1,475
    Huh, that might just be broken then... I copied it from documentation, and thought I remembered using it, but now I can't get it to work either. "Traffic start #" and "traffic stop #" seem to work.
     
  11. Mr Whippy

    Mr Whippy

    Messages:
    2,989
    Ratings:
    +461
    It probably did work, but has since been broken but not spotted?

    That does happen so well worth adding to the list of bugs on the release thread. Hopefully when Ruud has free time again he can then fix all these things up :D

    Dave
     
  12. Stereo

    Stereo

    Messages:
    2,441
    Ratings:
    +1,475
    Did some digging in Racer.exe's strings to figure out what commands did exist...

    The track needs a non-zero number of splines for the traffic to work (which is why the Exeter Rd. AI was being lazy and not moving). As far as I can distinguish it doesn't use them for anything so probably should be considered a bug.

    The actual console command to move a car is
    car warp <car> <waypoint>

    There's also a
    route goto <car> <waypoint>
    Which instructs traffic to drive directly for ... something. I'm not sure what the <waypoint> is indexed on. Sometimes they work for me, sometimes they don't.

    Since some of this stuff is a pain to find information on I'm gonna put up a unified document on my website in a bit.
    [edit] http://nmurdoch.ca/racer_traffic.html - haven't got pictures yet, but collected my knowledge of making traffic work.
     
  13. Mr Whippy

    Mr Whippy

    Messages:
    2,989
    Ratings:
    +461
    Great work Stereo...

    Haha, nice exe snooping there. At least we know the command issue isn't a bug, just wrong documentation :D


    Yep, that works here now... now for the looonnggg task of authoring the traffic lines hehe.

    Dave
     
  14. Brodon

    Brodon

    Messages:
    4
    Ratings:
    +0
    Last edited: Nov 8, 2014