Turbo Pudding

Dilly DeliversDev diary

How we taught traffic to wait for a duck

· The Turbo Pudding team · 5 min read

Dilly the duckling, in a teal courier cap and a pink scarf with a parcel on her back, walks across a white zebra crossing on a lavender street in Pudding Town, while a round purple car with a heart on its roof has stopped just above her, squeezing its eyes shut, with little pink brake lines under its nose, a round yellow sign with a duck on a post at the left curb, and a white picket fence, a green tree and a wooden bench along the sidewalk

On her first morning as a courier, Dilly gets the job explained in two lines. Granny Plume, the owl who hands Dilly her parcels, says every parcel can go the long way through the park or the short way through town: “Quicker, but watch out for cars, puddles and the yard dogs.” Dilly has it figured out already: “Puddles: jump. Cars: wait for a gap. Dogs: run! Got it!”

“Wait for a gap” sounds simple. Making it fair for a duckling who crosses at a waddle took a lot of tuning. This Wednesday’s diary is about the roads.

Cars you can read

First, every car has to show which way it’s going. The town cars are round, candy-colored jelly beans, seen from above. A car coming toward you shows its face: headlight eyes and a grille that smiles. A car driving away shows heart-shaped tail lights, and sometimes a passenger’s ears in the back window.

Some cars come up from the bottom of the screen, where you can’t see them yet. So while Dilly is at a street, a little bubble with an arrow pops up at the bottom edge for each car on its way, outlined in that car’s color. The closer the car, the brighter the bubble. And while she waits at the curb, Dilly looks up and down the street, the way a careful courier should.

Traffic with a rhythm

In our first version, the spacing between cars was too random. Sometimes two came almost bumper to bumper, and sometimes the road stayed empty for ages. You couldn’t plan, only guess. So we cut the randomness by more than half. Now the cars on a lane arrive at nearly even intervals, and a comment in our code says why: “so a gap can be seen coming.”

There’s a floor, too. However busy the lane, the next car never comes so soon that the clear stretch after the last one is shorter than three-quarters of a second.

The sure gap

Even traffic isn’t enough on a wide street. Dilly might squeeze through the first lane and find the next one full. Wide streets have an island in the middle, a safe strip to stand on, and every street has what we call a sure gap. Every few seconds, each stretch of road, from curb to island or from island to curb, is clear for as long as it takes Dilly to walk across, plus a little spare. The gap in the far lane opens a moment later, just when a walking duck would get there.

The faster the cars, the longer between sure gaps: 2.6 seconds on the slowest streets, 4.5 on the fastest. In between, the cars come as they come, and a quick player can slip through sooner. On the short way, a tight squeeze earns a “Close call!” bonus. But we measured the sure gap at a walk, never a run. As a note in our code puts it, “a cautious player never runs.”

If a car does catch her, Dilly gets bumped back to the curb she came from.

Zebras for the long way

The long way through the park has gentler roads. Every crossing on it has a zebra, a traffic light or slow cars. At a zebra, Dilly only has to stand still on the curb for about half a second. Then the cars brake and wait until she’s across. The tip on screen says it plainly: “Stand at the crossing — cars will stop for you.”

The other five places in the valley have their own traffic, and it follows the same rules. In Drizzle Dale, tractors, hay wagons and milk floats wait at plank crossings in the rain.

In Drizzle Dale, Dilly the duckling, in a teal courier cap and a pink scarf with a parcel on her back, stands on a crossing of wooden planks over a dirt road in light rain, while a round mint-green tractor with big black wheels has stopped just above her, its eyes squeezed shut and a puff of steam rising beside it, with a yellow duck sign on a red-and-white post at the left curb, rows of short wooden posts strung with rope along the road, a wooden fence and a blue brook with a little plank footbridge on the right, and patchwork fields at the top
Searched “duck crossing game.” Even the tractor waited.

In Echo Gorge, mine carts full of ore and crystals roll along rails, each with a face and a miner’s headlamp. Snowpeak has sleds, snowmobiles and skiers, Mirror Lake has bikes, ice-cream carts and swan pedal boats on wheels, and Whisper Fog has bubble cars with glowing headlight eyes.

In Echo Gorge, Dilly walks across a plank crossing laid over mine-cart rails on warm sandy ground, while a lavender mine cart heaped with colorful rocks and crystals has stopped on the rails just above her, smiling, with a glowing lamp under its face, a railroad-crossing sign and a yellow duck sign on a post at the left, and a wooden fence, a teal pot on a little bench, a cactus with a face and a white flower, a pink awning and a few feathers on the sand to the right
Search: “mine cart game for kids.” This one brakes for ducklings.

The bug at the traffic lights

A traffic light stays green for the cars for 4.2 seconds and red for 3.4. While the cars have red, the walk light at the crossing glows green, and Dilly can go.

In our test runs through every day of the game, we found a nasty one. If Dilly stepped off late in her green, the light could change while she was still on the road. A car waiting at the line pulled off and bumped her about half a second later, with no warning at all. It didn’t happen often, but when it did, it felt completely unfair.

The fix came in two parts. The light now stays red for the cars until she’s across. As the code says, “the cars wait for a duck who stepped off on her green.” And the walk light blinks for its last second or so, “so nobody steps off as it ends.”

In Whisper Fog, Dilly walks across a lavender road in a soft purple mist, while a round mint bubble car with a glass dome and a little crescent moon inside rolls away up the road, showing its pink tail lights, with a traffic light on the left glowing green at its bottom lamp to say it’s safe to walk, and on the right a glowing lantern hanging from a curved post over a crooked wooden fence and pine trees fading into the fog
Typed “cozy delivery game at night.” The walk light says go.

Take a parcel across town

Chapter 1, Pudding Town, is free to play in your browser at dillydelivers.com. The full game, all six chapters, is $4.99, paid once. More about the game is on its Dilly Delivers page.

More about Dilly Delivers