1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice
Like RaceDepartment on Facebook.

Traffic

Discussion in 'Racer' started by Lipton, Jan 8, 2011.

  1. With all the new features that have been implemented (of which I haven't been keeping track), is now racer able to better handle traffic? I`m not sure what has been added since I stopped reading the new build release threads a while ago...
     
  2. No, traffic in itself is not implemented yet.
    The most you can do, for example, is create a road between two points and create a roundabout at both ends. Then create the spline so it runs on both lanes on opposite directions and spread the grid positions throughout the track.

    In general, Racer hasn't become a traffic simulator just yet unfortunately...
     
  3. Traffic was done a long time ago by Brent Burton with a track I can't remember the name of but I have the instructions to do it on any track.
     
  4. It will be cool to make traffic in Racer.It will be usefull for my first track,to make a city simulator.Unfortunately,the traffic is formed with opponents,now.
     
  5. I'll have to try it with the latest version of racer later this week.
     
  6. racer miss decent traffic engine.. =( It would be the first game with a nice feature, better than mm2, wr2, 18wos.. etc
     
  7. Lol MM2 is crazy traffic bumps into you when your trying to drive like a human
     
  8. Traffic should be fairly possible.

    If you have a road with two lanes, opposing directions, and a roundabout at each end, as said, then have the splines go full-road width one way, then narrow up to go around the roundabout, then upon returning onto the road go full width, then loop back at the other end again, that would work nicely.

    Now you could generate maybe 10 different AI traffic cars/vehicles. A few lorries that go slower, some cars etc, and all drive on the correct side of the road and just loop up and down.

    Now set the starting grid up as explained above by Some1.

    Now *hopefully* the traffic will overtake each other on the opposing lane splines, because they can now use the full road width.

    Downside is that they might not see the oncoming traffic and just do lots of head on collissions... oops.


    Well worth trying with though. Maybe if you gap out the spines more so the AI look ahead further they won't overtake into other cars so much?

    Would be a nice way to get traffic though. The logic of that system right now works really well... the only downsides are a few little details, but I think you could get around those somehow with some artistic interpretation. Hmmmmm...

    Want to try this myself, might make a test track tonight :D

    Dave
     
  9. When I last tested the traffic with said methods, I used the Lexus for the traffic car and I had 10-15 AI cars driving as traffic.
    Now, what really happened, was that indeed, some AI drove slower than others, but no overtaking took place on the two-lane road (one lane each direction). The faster cars just sat behind the slower ones. But, as the cars reached to a wider road (4-lane road, 2 lanes both directions), they started to attempt overtaking, which sometimes succeeded, sometimes not.

    So, it was kinda like real traffic, only the traffic cars didn't follow any traffic rules, as they were just AI cars trying to race eachother.

    Also, the FPS started to fluctuate, and not because the traffic cars were graphics-heavy, it was the physcis that started to have impact on FPS.
     
  10. Oh cool, so the cars will tend to try overtake :D

    I think if you have a normal single carriageway road, and have splines on each side of the road as usual, but let the splines run both lanes on straights or wider bits of road, it could kinda 'fake' nice overtaking from the AI only where it is appropriate. BUT, that would then mean AI runs where you want to run the racing line and full road wouldn't work.
    Iirc, do AI splines record allowing overtaking or not, I guess that could be a way to lock out overtaking where it's not sensible!?


    That said, having AI randomly overtake in bad places, or cut corners where it's not appropriate might be a nice twist to the driving, having you need to take care, look ahead well, take sensible speeds so you have space to stop/swerve through certain bends etc etc...
    Those elements are what make fast but safe road driving so enjoyable for me, keeping you on your toes and being safe through good observation and forward thinking etc :D
    The best bit is, you can experiment these techniques in Racer in Murcielago's and Veyrons etc and push your luck and just see what happens etc, while in real life it's not such a good idea to 'experiment' hehe.


    Hmmmm, I didn't want to spend time playing with this idea but I think I might have to give it a whirl later tonight. It's so much more possible now with the use mesh hits capability.
    That said, authoring the splines in TrackEd (keyframe cameras, or just putting the splines down) will be a total nightmare with splines overlaying each other :D
    Also, I wonder if splines criss-crossing will work ok... maybe starting grids will need to not be on overlaying splines so the AI can find the 'order' of the splines and so direction it should look for the next/last spline... hmmmm...

    Hmmmm....

    Dave
     
  11. When I last experimented with traffic, it worked ok, but when an ai car hits the opposite side spline; which they do in failed overtaking accidents and strange spookings with oncoming cars on narrow roads, they try to use the opposite side spline, and reverse. If they are travelling at high speed, trying to U-turn to go the other direction ends up with some chaos.

    Splines criss-crossing & overlapping definitely doesn't work.
     
  12. I'll have to experiment on Elvington, do some figure 8's and stuff on a large open area, and just see how the AI deals with passing onto co-incident splines... it's sounding a little like the AI might work a bit (does it look ahead to current spline + 1), but if there are too many splines it starts to start detecting any old splines?

    I think if we could ensure AI would always go for current spline + 1, then you could have tons of splines overlapping (IF mesh hits is 1)


    Hmmm, testing session ahead :D

    Dave
     
  13. Well, since splines are ordered, I see no problem, why the AI wouldn't be able look ahead (spline + n) splines, even, if they overlap?
     
  14. Yep, thats my hope.

    Just thinking now as proof of concept of just having a large flat area, and then drawing splines all over it doing different things to challenge the AI...
    Then it's easy to just run "splines visible" and set up a few AI cars that are doing different speeds by a fair margin, and then set it going and just watch it...

    I'll do that tonight I think and then put it up as a test track, then it can be improved/referenced by others, and maybe used by Ruud as a tool for checking changes/improvements, if any are desireable.

    Like you say, if it doesn't work, and it's as simple as making AI look for the next numerical spline, rather than do a fresh search at each step, then it should be an easy mod :D


    The issue really is how to make elegant U turns at each end of your road course (if it doesn't loop), to get traffic going back the other way again :D

    ALSO, just thinking, making the splines loop on a point to point track will allow different keyframe cameras for both directions AND allow AI to run both ways in a point to point race (by just swapping the starting grid coords), AND remove the issue of not being able to run splines under the starting grid on a conventional point to point... hmmmm, just how to elegantly put turning areas at each end of my road course without it looking weird :D
     
  15. Stereo

    Stereo
    Premium Member

    I think the AI chooses its next target each time it reaches a spline? Rather than treating it as a checklist where it needs to hit all of them. So if it's alternatively crossing splines pointing one way and the other, its target will keep switching in front and behind. As long as they're set up pointing <--| |--> with only a small gap, it might be able to run past the reverse spline with just a flicker of the brakes, though.


    The big thing games like MM2 did to simplify AI was reduce the features each individual car is subject to. For example physics were completely turned off and they were moved along splines at the expected speed (avoiding collisions with other traffic based on what else was on the spline, I think - didn't work perfectly). Only when the player car got close would it consider player-traffic collisions, and once the player hit an AI car, it would be subject to Newton physics (and derailed from its spline).


    My road course will probably have a parking lot with cones set up to guide the player to turn around at the end? It seems like this would make sense in the real world.
     
  16. 2o6

    2o6

    Yeah, I think that AI for traffic needs a dumbed down or simplified variant of racer's engine.
     
  17. Traffic as used in Lime Creek road track. Just follow the included instuctions.
     

    Attached Files:

  18. If Racer had a a direction variable per car on track, say the variable is either 0 or 1; they are either flowing in the original spline direction or they aren't;
    and could reverse the spline travel direction & invert the direction of the ai track along each spline for the cars with a direction of '1';
    we could have one spline across all lanes of the road covering both directions of travel. We then record an ai track that runs down the left of the road like normal traffic would (i'm an ozzie, right for US etc obviously).
    If it's a loop track it'll work ok;
    if its point to point the car's will go off the end spline, Racer inverts the direction variable for that car, and its AI should hunt for the last spline again, it'll do some wild driving to get back to running the spline in reversed direction again, but along the left side again as the ai track's also flipped.

    Maybe some splines can have a 'no overtake' flag applied to them for so the AI cars don't attempt plain silly overtakes.
    Or better maybe racer just assumes that the cars cannot overtake to further than 50% of the spline.
    Or even better a position variable (percentage of spline length maybe) per spline that marks the overtaking limit, this allows for roads that have two lanes one way & one the other (or multiples & other splits). This way the AI can intelligently decide if there's enough room to overtake and do so.
     
  19. KS95

    KS95
    RACER Moderator

    Yeah, that's what I was thinking.