Skip to content
Rishad Rahman
All work

Graphics · 3D game, Godot 4.4

O Mago! Dhaka!

A colourful 3D open-world game in Godot: pedal a decorated rickshaw through a chaotic, procedurally built Dhaka, carry passengers and survive the traffic. Plays in the browser.

Stack

  • Godot 4.4
  • GDScript
  • Python
  • WebGL 2
intersections, no dead ends
124
intersections, no dead ends
passenger destinations
23
passenger destinations
physics tick in the busiest streets, down from 24 ms
5.5 ms
physics tick in the busiest streets, down from 24 ms
O Mago! Dhaka! main menu: the Bengali title in red and yellow over a street scene, with a decorated red and green rickshaw and its puller on the road beside shops and stalls.

What it does

You are a rickshaw puller in a fictional slice of Dhaka, about 720 × 666 m, with districts such as Farmgate, New Market, Dhanmondi, Mohammadpur, Kallyanpur, Hatirjheel lake and Badda. Pick up passengers who wave from the kerb, take them where they want to go by whatever route you choose, and get paid. Or just ride around. Buses, CNGs, cars, motorbikes and other rickshaws crowd the roads, pedestrians cross wherever they like, and every mistake has a cartoonish, very Dhaka consequence.

Riding up to a junction from behind the rickshaw: a red bus and a green CNG cross ahead, a pedestrian walks on the zebra crossing, and the Bengali HUD shows speed, earnings and a mini-map.
A junction, with the Bengali HUD and mini-map
The rickshaw has hit a stall on the footpath. A big red comic word ধড়াম! (crash) pops up and a bus passes on the road.
A heavy crash: ধড়াম!
KeyAction
W / SPedal; brake, then reverse when stopped
A / DSteer
SpaceStrong brake
HRickshaw bell
EPick up or drop off a passenger; repair at the mechanic
RReset onto the road
MMini-map

Keys use physical positions, so they work with Bangla keyboard layouts such as Avro and Bijoy. On a phone the game shows round touch buttons instead and adapts to portrait or landscape.

A city built from code

The whole map is data in city_layout.gd: roads, districts, landmarks and drop-off points. city_builder.gd turns it into buildings, shop signs, stalls, electric wires, Hatirjheel's lakeside promenade and landmarks such as a low-poly BRAC University campus. The rickshaw, the vehicles and the people in lungi, saree, salwar kameez, panjabi or borka are built from parts the same way. Python scripts generate the rickshaw art textures and all the sound effects, so the only third-party asset is the Noto Sans Bengali font.

Building everything from thousands of small boxes would be slow on integrated graphics, so every model goes through a small mesh kit that merges its parts into one mesh:

scripts/mesh_kit.gdSource (opens GitHub in a new tab)
## Small helper for building low-poly, flat-shaded meshes out of boxes,## cylinders, spheres and quads.#### Everything added to one MeshKit is merged into a single ArrayMesh: all## plain-coloured parts share one vertex-coloured material, and each texture## gets one extra surface. A whole rickshaw therefore costs only a handful of## draw calls, which matters on integrated graphics.

Left-hand traffic that behaves like Dhaka

Traffic runs on a lane graph generated from the map. Each road has one lane per direction on the left half, as in Bangladesh, and curved turn pieces link the lanes through each intersection. Vehicles only ever move along these pieces, so they can't drive into buildings:

scripts/traffic_network.gdSource (opens GitHub in a new tab)
## A drivable polyline: a lane between intersections, or a turn through one.class Piece:	var points := PackedVector3Array()	var cum := PackedFloat32Array()  # distance along the piece at each point	var length := 0.0	var edge := -1                   # lane id, or -1 for a turn	var road_width := 7.0            # width of the road this piece is on	…

On top of that, each vehicle looks ahead along its own route for other vehicles, pedestrians and the player. Vehicles slow down, stop at junctions, wait at the bus stand, weave, cut in front of slow rickshaws, overtake through the other lane, brake for no reason and honk a lot (with a limiter so it stays bearable). Deadlocks are broken by letting one vehicle push through, and vehicles stuck out of sight are recycled.

The passenger job

Some pedestrians decide they want a rickshaw, step to the kerb and wave. Stop next to them, press E, and a four-state machine takes over (none → boarding → on board → exiting). Every transition checks the current state, so a passenger can't be picked up twice and a fare can't be paid twice. The fare is estimated when the trip starts and adjusted when it ends:

scripts/passenger_manager.gdSource (opens GitHub in a new tab)
## Illustrative game values, not real Dhaka fares.const BASE_FARE := 20const FARE_PER_METRE := 0.1const QUICK_TIP := 10const ACCIDENT_PENALTY := 5…func final_fare() -> Dictionary:	var expected_time := _trip_distance / 5.0 * 1.3 + 12.0	var tip := QUICK_TIP if _trip_time <= expected_time and _trip_accidents == 0 else 0	var penalty := ACCIDENT_PENALTY * _trip_accidents	var total := maxi(BASE_FARE, fare_estimate + tip - penalty)	return {"total": total, "tip": tip, "penalty": penalty}

Crashes, crowds and muggers

A crash is graded by the speed going into the obstacle, so a fast glancing scrape stays light, and by what you hit (a bus hurts most). Each grade has its own comic Bengali word, sound, camera shake and damage:

GradeWordDamageEffects
Lightঠক!1%Small jolt, dust
Mediumধাম!6%Wobble, sparks, counts as an accident
Heavyধড়াম!15%Hop, white flash, dizzy stars, big shake
  • Damage: a battered rickshaw is up to 25% slower and its front wheel wobbles. At 0% it breaks down, and the player can pay for a tow to the mechanic on Mirpur Road.
  • Street stalls: vegetable stalls, tea stalls and benches smash when you ride into them, then get rebuilt out of sight.
  • Angry crowds: hit someone and up to three bystanders chase the rickshaw, thumping it if you stand still. Pedal away faster than their 16 km/h and they give up.
  • Mohammadpur: knife muggers rob pedestrians, or come for your earnings when you stop. Ride into one to catch them and earn a reward.

Performance on laptops and phones

The game targets integrated graphics with Godot's Compatibility (OpenGL) renderer. With full traffic and crowds, one physics tick took about 24 ms of CPU time and caused stutter. Cutting it to about 5.5 ms took several changes:

  • Far-away people and rickshaws drop their jointed bodies, and people 14 to 45 m away walk as a single-mesh flip-book.
  • Distant vehicles update every third tick, and pedestrians share one per-tick list of vehicles.
  • About 68 vehicles and 130 pedestrians exist, but only about 24 vehicles and 65 people are kept close to the player, brought in out of sight, so your street always looks busy.

The web build detects phones and switches to lighter settings: the 3D view is drawn at about 0.9 megapixels and scaled up, the city is simulated 30 times a second instead of 60, lighting is computed per vertex, and the view distance is shorter. The city is built once per visit and reused between the menu and rides. A perf_probe scene measures FPS, frame-time spikes and where the time goes.

Automated tests for a game

The game was built in six milestones, and each has an automated test scene that loads the real world, presses the real input actions and checks the result. There are tests for driving, map reachability, traffic, the full passenger loop, collisions and repairs, menus and settings, muggings, angry crowds and the day/night cycle. They run headless with --fixed-fps 60, so they simulate as fast as the CPU allows, accept a --seed to try other random situations, and exit with code 0 only when every check passes.

↑ ↓ to move · Enter to open