Traffic

Hi guys. I've got one question to you. Is there any chance to do traffic on tracks, like in World Racing 2 ? I think it would be nice to have something like a real driving simulator with traffic cars. I searched many websites, but I didn't find any information about this.
 
Sad to hear that Mitch... I hope your new ventures are going well :D

Feel free to pester us guys here if there is something you want to work on, but need someone else to work with you on it, ie, you need some mesh/texture work to test with but built to a certain spec etc...

There are tons of diverse skills here but I guess half the issue is getting people working together at the bits they like but are also good at, and combine it into one project that comes together quickly :D


Dave
 
I tried to set up some traffic, right now the AIs seem to start on the grid positions and then drive to their first waypoint. Or, if they run across a waypoint, they pick up on it. I can't be sure I've got it set up correctly, though.

If anyone's familiar with Small City 2009, I'm setting up traffic waypoints for it, and will upload traffic.ini when it's done so you can take a look. My copy hasn't got CG shaders so it's a bit ugly but it provides the various traffic-ish stuff you'd want (ie. intersections and roads)


edit: http://dl.dropbox.com/u/20733494/small_city_traffic.7z
about 400 waypoints placed in tracked, plus 15 cars, along with starting points due to them starting on grid positions atm.

You'll want to open traffic.ini and change car= lines so you get a model you have... I used the Lexus hoping it'd kill framerates less, but this is mostly physics-heavy.
 
I have hard times with traffic...:)

trafficcrazy.jpg
 
I tried the dowmload that Stereo posted on an old version (049) of small city and it worked very well except for a problem with a track "overrun" problem. Good job, Stereo!

Now a question. Just how does one place the waypoints on a track? A simple tutorial would be very helpfull.
 
F8 in TrackEd, it's pretty straightforward actually.
Shift+click to place the cursor somewhere on the track.
Ctrl+a will put a waypoint that is 'forward' from the one currently selected.
Ctrl+s will let you select a waypoint (by number; they're all clearly displayed)
Other options have buttons, but those 2 are the main things you'd use.

Basically you set the cursor where you want the traffic to start, then click somewhere forward, ctrl+a, repeat until it gets back near the start. Then choose "set forward waypoint" and input the number of the first waypoint on the loop to complete it.

As far as I can tell, the waypoint speeds pretty much update the traffic's target velocity when they cross the waypoint. So if you want a car to slow down you need to set it up with enough distance to get to the target speed.

pQ5Cf.jpg


Adding leftward/rightward waypoints gives the traffic random choices when it hits those points, and TrackEd displays them with L/F/R when you have the wp selected.

One problem I've had is that the traffic tends to automatically acquire waypoints when it drives over them, so the paths need to be laid out to avoid hitting waypoints on other routes. It might be good to have some sort of 'detection radius' you could set on points so this could be more obvious and avoided.
Anyway, that's why I have 3 points per turn - more and they just overlap too much. It does make the AI steer a bit suddenly.

Most of the time they do avoid collisions, but they can only see what's in front of them, so when two come at each other from the side they don't always have time to stop.

If you need to remove waypoints, select the first one along the route you want removed, cause it automatically jumps to the 'forward' waypoint when you edit waypoints, and that way you can just repeatedly hit remove.
 
Made traffic for Carlswood to see if I could get it to work. Used two Lambo's that run across the grass and thru the pits knocking down cones. Works ok but how does one get a car to start from a specific waypoint?

I tried to set the waypoint in the "car" section but it allways starts from the grid.

Attachment for your perusal and enloyment.
 

Attachments

  • traffic.txt
    3.3 KB · Views: 575
Nice stuff Stereo, it's exactly the stuff I was thinking about, you know from a orthogonal angle, get the curve to interpolate nicely from 2 vectors & virtually create the curves on runtime.

For those, who want to integrate a checking radius function, simple solution, get the distance between cars, & build the condition on top of it. It works quite nicely...


Code:
// function to calculate distance from 2 points in 3D
func int distance3D (float $x1, float $y1, float $z1, float $x2, float $y2, float $z2)
{
    // Distance of 2 pts in 3D
    float $x = $x2 - $x1
    float $y = $y2 - $y1
    float $z = $z2 - $z1
    int $result = abs (sqrt (($x*$x) + ($y*$y) + ($z*$z)))
    return $result
}

I hope Ruud will plug Python into Racer, what about having a Python console instead of our old console ?
Just an idea, that would ease our work so much, stuff would be easy, concise & highly efficient/powerful...:)
 
I hope Ruud will plug Python into Racer, what about having a Python console instead of our old console ?
Just an idea, that would ease our work so much, stuff would be easy, concise & highly efficient/powerful...:)

I doupt it is nowhere near trivial to do such thing, and if it was done in Racer, I reckon it would be buggy as hell :)
Frankly, I couldn't care much, we have many other things that need sorting out.

I wonder, why Ruud didn't use Lua in the first place... hmm.
 
Thanks guy's.

Cars are placed on the grid and should have the ability to have thier own starting location specified.

The traffic.ini file does indicate this is possible but it don't work. Ruud needs to fix it.
 

Latest News

Online or Offline racing?

  • 100% online racing

    Votes: 75 7.2%
  • 75% online 25% offline

    Votes: 111 10.6%
  • 50% online 50% offline

    Votes: 151 14.5%
  • 25% online 75% offline

    Votes: 287 27.5%
  • 100% offline racing

    Votes: 415 39.8%
  • Something else, explain in comment

    Votes: 4 0.4%
Back
Top