# The example town The plugin ships a second module, `DrivecraftExample`, with everything needed to try Drivecraft on an empty map: a town of blocks with traffic, cars, a truck with its semi-trailer and a motorbike to drive, and a person on foot to get in and out of them. Nothing in it is art. It is the engine's basic shapes with two materials of the plugin's that draw asphalt, pavement, windows and wheel rims without textures, so you can see what the plugin does and copy what you need from the code. ## Trying it 1. Open `Drivecraft Content/Example/Maps/L_DrivecraftTown` (turn on **Show Plugin Content** in the Content Browser settings if the folder is hidden). 2. Press Play. The map itself is empty: the game mode builds the town, its sun and sky, the traffic and the vehicles when play starts. Any other empty map works the same with **GameMode Override** set to `DRCExampleGameMode` in World Settings. To play with others, press **F1** to host and have the others press **F2** on the same PC (Play as Listen Server with 2 players in the editor works too). Another machine joins by opening the host's address. | Keys | On foot | Driving | |---|---|---| | WASD / left stick | Walk | Throttle, brake and steer (hold S when stopped to back up); triggers on a gamepad | | Mouse / right stick | Look | Look around the car | | Space | Jump (A on a gamepad) | Handbrake (B) | | E / Y | Get in the nearest vehicle (driver, or passenger if taken) | Get out | | F / X | Riding: the next free seat | The next free seat (leaves the wheel) | | C / right stick click | | Chase camera or driver's seat | | L / D-pad up | | Headlights | | Arrows / D-pad | | Turn signals, down for the hazard lights | | R / Back | | Back on its wheels after rolling over | | H / left stick click | | Horn | | F1 / F2 | Host / join | Host / join | Driving, a panel at the bottom left shows the speed, the gear, the rpm, engine and body health, and what is on: the turn signals (blinking with the lamps), the hazard lights, the handbrake (red while held) and the headlights. The vehicles' lamps glow when lit, so they show in daylight. Getting in lets go of the handbrake the last driver left on. ## What is in it | Class | What it is | |---|---| | `ADRCExampleTown` | The town: a 5 x 5 grid of two-way streets, 54 m blocks, pavements and buildings, built the same on every machine. On the server it lays the traffic lanes, one per street and direction and one per turn, the junctions and the traffic manager. The streets along X have the right of way, the middle crossing is a stop for everyone, the four around it have traffic lights, and the horizontal street through the middle is an avenue with two lanes each way | | `ADRCExampleCar`, `ADRCExampleTruck`, `ADRCExampleTrailer`, `ADRCExampleBike` | The vehicles, from the ready-made setups, with boxes for a body and cylinders for wheels that turn and steer. The paint is replicated; traffic picks one of 7 colours | | `ADRCExampleCharacter` | A person with a `UDRCRiderComponent`, a camera behind, walking and jumping. It is the Third Person template's mannequin when the project has it (`/Game/Characters/Mannequins`, **Person Mesh** and **Person Animation**), a capsule-sized cylinder otherwise | | `UDRCExampleInputSubsystem` | The Enhanced Input actions and mappings, made in code so the example needs no assets | | `ADRCExampleGameMode` | Builds the town, parks two cars, a motorbike and the truck with its trailer along one street, and starts each player on the pavement beside them | | `ADRCExampleHUD` | The text in the corner and the driving panel | West of the town, past a strip of grass, there is a dirt yard and an ice yard to try the grounds on (see [Surfaces](getting-started.html#surfaces)). The town's `GridSize`, `BlockSpacing`, `StreetHalfWidth`, `SpeedLimit`, `TrafficCars` and `Seed` are on the actor; `-DRCTownCars=N` on the command line changes the traffic. ## Measured On one PC with no network, 30 cars for 120 s: no two cars touched, none rolled over, the median car 1 cm off its lane (92 cm at worst, coming out of a tight turn), and the longest any car stood waiting at a junction was 11 s. The engine sound is a racing car loop by domasx2 and the horn one by GGBotNet, both under CC0 (public domain), from OpenGameArt, played through the plugin's Engine Loop with a lower pitch range on the truck and a higher one on the bike. The trailer has none.