Reverse Tracks - Printable Version

+- Forums (
+-- Forum: Community (
+--- Forum: Cars & Tracks (
+--- Thread: Reverse Tracks (/showthread.php?tid=531)

Pages: 1 2 3

Reverse Tracks - pwp71 - 02-21-2007

What do you think to drive in some circuits like dijon(very funny) pau, weekend and some
others on the contrary way?

So, we have a more circuits with few work (I hope).
We can insert in the track.txt file one attribute like reverse true/false
and below give new start position and start directions, etc.
Another solution is add another file like trackr.txt with reverse info.

Give me your feedback ( but before drive a little bit with reverse dijon Wink )


- joevenzon - 02-22-2007

Sounds good to me. Other games tend to do this a lot.

- thelusiv - 02-22-2007

This would be pretty simple to code up. If someone takes the time with the tracks, and creates backwards starting points and a backwards track sequence for them, someone will code it. However to really support such a feature, sort of like any of our track features, it must be retro-fitted onto our old tracks.

So is someone willing to go through and make reversed versions of all our tracks? If so, I'll gladly throw a "Reverse track" option on the start game menus.

To make a track backwards, just open it in the editor as if it's a new import, then re-trace the track in reverse, and set new starting points. Save the file and then add it to VDrift SVN under the data/tracks/track_name/roads.reverse.trk. I think we'll also need a track.reverse.txt for each of these. Post here if you add some, and we'll make them work. Smile

- pwp71 - 02-22-2007

After I'll finish to update start positions, I should try to create reverse tracks.

Someone could create "Reverse track" option on the start game menus?


- thelusiv - 02-22-2007

I will add the option, I'll just need some data to test it with. If I have time I could possibly get this done this weekend, I will copy one of the normal track files and simply name it as reversed, and test that way. Right now though I should really focus on getting the menus set up to allow editing the control assignments, which I'm finally making some progress on.

- joevenzon - 02-23-2007

I don't think you'd need to trace it backwards... just set the timing sectors up again backwards and also the starting positions to be backwards.

- rookie1 - 02-23-2007

The AI driver does rely on the patch sequence. So if you want to race against AI in reverse direction, we will need to reverse the patch sequence. Since the patch sequence is just a linked list, another way would be to change the code in track.cpp to create another linked list in reverse order.

- thelusiv - 02-23-2007

It shouldn't be too hard to make a function to reverse the linked list. If someone sets up a track with reversed timing sectors and starting positions, Joe or I could set up the track patch reversing code, and test it out.

- joevenzon - 02-23-2007

Now that I think about it, we should just be able to reverse the patches AND the timing sectors and be set. We could even flip the starting positions. It shouldn't be hard to do at all....

- joevenzon - 02-24-2007

Preliminary support for reversible patches in SVN r1559. Still not working: laps aren't being marked correctly. You tell the track class to make the track reversible with the new TRACK::Load overloaded function.

Also, I'm not sure if this is something that I broke or something that was already broken, but the "POSITION" display isn't working correctly.

- rookie1 - 02-25-2007

The lap counter increases when the car pass through timing sector 0. In the track reverse code, the timing sectors are also reversed. So the last timing sector in the original track becomes the new sector 0. This causes the lap counter to increase at the wrong place.

Car position depends on the relative distance from the starting line (timing sector 0) to the current patch. These are calculated during track loading, in BEZIER::Attach() and TRACK::Load(). I guess when the track is reversed, the relative distance is not recalculated. The position display become reversed as a result.

- joevenzon - 02-25-2007

Thanks for the info. I'll try to fix this the next chance I get.

- joevenzon - 02-25-2007

Everything seems to be working now except the position display, which is the opposite of what it should be. Any idea why this is? I've left the track reversal enabled for all tracks in SVN R1562 if you need to debug.

- rookie1 - 02-26-2007

I think we need one more change in BEZIER::Attach(), that is to reverse the sequence of the 4 corner points. This is because the car's relative distance from starting line is calculated as follows (you can look at Vamos_World::World::update_race_position() for the details),

car's distance from starting line = current patch's distance from starting line + car's distance from the beginning of current patch
|<------ a ----->|<---- b ---->|    
                 |                          |
                 |                          |
                 |-------------*            |
                 |                          |

a = current patch's distance from starting line
b = car's distance from the beginning of current patch
* is the car
The beginning of current patch is the straight line formed by points[3][0] and points[3][3] of the patch. In a reversed track, it should be the line formed by the other 2 corner points.

I hope the above makes sense.

- thelusiv - 02-27-2007

I added a "Reverse Track" toggle option to the Practice Game and Single Race menus, in SVN r1565. Tested it out, seems to work fine.

Trying this option on Ruudskogen (please note I only tried this once on one track) if I choose to reverse the track, I don't see the starting gate as I do when I race forwards. It seems perhaps the starting points need to be moved backwards (relative to the reverse-facing cars) about one track segment...would what you describe fix this, rookie1?