Last week (read here), an article taught you how to use vertical position of the car to provide navigational tips.
This time, I’ll conclude the series with an article about bi-directional areas of the track – i.e., about places where cars are going in either direction and you need to provide different tips for each direction.
The demo track for this article is a Red vs. Blue (team) track, where the two teams go in opposite directions, crossing each other’s path on several occasions. To make things even more complicated, the path of each team contains a “loop” (the player passes one point twice).
Let’s first take a look at the track:
The start is at the top; red team turns left, blue team turns right. In the center of the track, there is a double checkpoint, and inside of the ornamental road circle at the bottom, there’s another double checkpoint. After making “one half of an eight” and passing all checkpoints, the racers almost return to the central checkpoints, but instead, they cross the big intersection straight and reach the finish.
Now, let’s look at the two yellow-boxed areas in detail.
In the upper one, the blue team cars have passed the central CP’s and now need to make the right 180 degree turn; the red team cars, however, are going straight towards the CPs and after that, they’ll be making a left 180 degree turn. So, we need to make sure that blue team players see “go right” message, while red team players don’t see anything (yet). After we make this work, we just copy the same principle on the left side of the track, where red team players will see “go left” and blue team players won’t see anything.
In the lower yellow-boxed area, the blue racers have just finished the turn and don’t need to be given any instructions; while red team racers should be told to turn left.
In both cases, the solution utilizes the single most important feature of MediaTracker: Triggering a new clip stops any previous clip from running.
This is how it works:
The track has (for now) 2 clips: “Left” and “Off”. The “Left” (or its symmetric brother “Right”) tells the player to go left (right), while the off trigger is empty and works as a switch-off.
Look at the situation at the top-left of the left image: You can see the car (belonging to red team) entering the triggering cubes of the “Left” clip (moments before, he was inside he Off clip’s triggers, but that didn’t have any effects, so the player doesn’t know about it). If the car belonged to the blue team, it would be entering the same triggering cubes of the “Left” clip from LEFT side, but within split-second, it would pass through and into the “Off” triggers.
Therefore, all we have to do in the “Left” clip is wait for some time (0.3 seconds or so) – which is the time it takes the Blue cars to get into “off” triggers and switch off the Left clip – and after this time, if the clip is still running, display a message “Go left”.
Also, note that the very same Left and Off clips are used in the bottom right corner – once again, the red team cars first pass through the Off triggers and then enter Left triggers, so the message “Go left” is displayed once again; blue cars first enter Left triggers, but very quickly get into Off triggers, thus switching the Left clip off.
In fact, the track contains one other bi-direction clip (besides Left, Right and Off) – it’s the “Straight” clip, which should tell the players to go straight through the big intersection (either on the left or right half of the track) towards finish. Here’s the triggers of Right and Straight:
As you can see, the red car is entering the “Right” clip at top-left, but since there’s an Off clip’s trigger right after it, nothing will be displayed. Blue team’s car, however, would be told to go Right; then, the same car would enter the Straight clip’s triggers (see on the right picture), but immediately afterwards, it again hits the Right clip’s triggers (one of the three cubes on the right). That’s why the blue car sees “Go right” after the central double CP, and then sees it again when inside the big turn.
The red car, coming from bottom (after the bottom double CP), first enters the “Right” trigger, but immediately hits the “Straight” triggers and is told to go straight through the intersection.
Schematically, this whole procedure can be described like this:
For bi-directional area, place two rows/columns of triggering cubes right next to each other; the one row or column that is passed LATER by the car should provide directional hints for it; the hint must be delayed so that the car going in opposite direction can pass through the row into the second row (column).
That’s all from this “Timing” series. You’ve (hopefully) learned how to provide navigational tips to players of all speeds and directions, so I hope I’ll see some cool navigation in your tracks!
— [ATP] Alcator