Tutorial 2: Adding Roads

Introduction

This tutorial will guide you through expanding the map created in Tutorial 1: Making a Basic Map with new Road intersects as well as adding a Road Network on top of them. It will also cover making a new HUD map that contains your new road meshes.

A road network is the series of interconnected Roads and Intersections that guide traffic and AI cars through the world.

Prerequisites

You will need the following things to accomplish the steps in this tutorial:

Part 1: The SketchUp File

Step 1: Expanding the map

In Tutorial 1, you created a small square. This doesn't really have any space for your Road network so the first thing you'll want to do is expand the map a bit.

First focus the "Zone001" group. Then you should add some 12 meter wide rectangles to each side of the map and some 12x12 squares to each corner. It would also be good to make some Materials and color them differently so they can be told apart.

After you make them, group the new shapes and name the group Road [Intersect] [Road]. The new [Road] tag on the end is how you tell the tool to include this mesh on the HUD map as roads.

When you're done, your outliner should look like this:

Step 2: Making the roads

Roads are very easy to create as they are just 1 or more connected lines with a special group name. Start by drawing 4 separate lines connecting the midpoints of each corner of the map.

Then select each line individually and group it. Once you have 4 groups tag them each with the following names:

Road001 [SimpleRoadPairRight] [3] [1] [12]

Road002 [SimpleRoadPairRight] [3] [1] [12]

Road003 [SimpleRoadPairRight] [3] [1] [12]

Road004 [SimpleRoadPairRight] [3] [1] [12]

In this case you use the [SimpleRoadPairRight] tag to tell the tool that you want this line to be made into 2 parallel roads going the opposite direction of one another. The "Right" part means cars will drive on the right side of the road though there is an equivalent [SimpleRoadPairLeft] tag. The 3 tags following that tag are as follows:

Amount of traffic cars: The amount of traffic cars that can be on one side of the road at any given time. Use 0 to make it so there's no traffic.

Lanes: The amount of lanes on the road. In this case, you want each side to just have 1 lane.

Width: The width of the road. This is divided in half for each side of the road.

Step 3: Making the intersections

Intersections are also simple as they are just grouped circles. Draw 1 in each corner that fully covers the end of each road. Make sure to delete the face in each one, leaving just the edges of the circles.

Now select each circle individually and group it. Name each one with some tags as follows:

Intersection001 [Intersection]

Intersection002 [Intersection] [Stop]

Intersection003 [Intersection]

Intersection004 [Intersection] [Stop]

The [Intersection] tag tells the tool that these circles should become Intersections. This example also adds the [Stop] tag to the 2nd and 4th one which changes it so traffic will stop at these intersections instead of immediately continuing when they reach them.

Step 4: Making the Terra group

After you make the intersection groups, group all of them and the road groups from the previous step together and name the group "Terra" as these must go into the map's Terra file. This should leave your outliner looking like this:

Part 2: Configuring the Model Builder

Step 1: Including Base HUD Map rules

The first think you want to add to your rules is including the base HUD Map rules next to the Zone rules.

Step 2: Adding a HUD Map file and Mesh

Now that you have the rules, you'll want to add a new OutputPure3DFile next to your other ones for the HUD Map as well as a mesh.

<!-- Make sure to change the level number in the file and mesh names to match the level -->
<OutputPure3DFile Name="HUDMap" Path="$(OutputPath)\frontend\scrooby\resource\pure3d\l1hudmap.p3d"/>
<Mesh Name="HUDMap">
<OutputPure3DFile Name="HUDMap" ChunkName="l1hudmapShape"/>
</Mesh>

Step 3: Updating the ModelOutputInstructions

Next scroll down to your ModelOutputInstructions named "Zone" and add a line to execute the new rules and one to set the OutputHUDMapMesh.