extends Node3D ## Kenney City Kit plaza + stylized nomad NPCs + POIs. const TILE := 10.0 var _cache: Dictionary = {} func _ready() -> void: _build() func _scene(path: String) -> PackedScene: if not _cache.has(path): _cache[path] = load(path) return _cache[path] as PackedScene func _spawn(path: String, pos: Vector3, yaw_deg: float = 0.0, scale := 1.0, block := false, block_size := Vector3(4, 4, 4)) -> Node3D: var ps := _scene(path) if ps == null: push_warning("Missing asset: " + path) return null var n := ps.instantiate() as Node3D add_child(n) n.position = pos n.rotation_degrees.y = yaw_deg if scale != 1.0: n.scale = Vector3.ONE * scale if block: _static_box(pos + Vector3(0, block_size.y * 0.5, 0), block_size) return n func _static_box(pos: Vector3, size: Vector3) -> void: var body := StaticBody3D.new() add_child(body) body.position = pos var col := CollisionShape3D.new() var shape := BoxShape3D.new() shape.size = size col.shape = shape body.add_child(col) func _mat(c: Color, rough := 0.8, emit := 0.0) -> StandardMaterial3D: var m := StandardMaterial3D.new() m.albedo_color = c m.roughness = rough if emit > 0.0: m.emission_enabled = true m.emission = c m.emission_energy_multiplier = emit return m func _box(parent: Node3D, name: String, pos: Vector3, size: Vector3, color: Color, emit := 0.0) -> MeshInstance3D: var mi := MeshInstance3D.new() mi.name = name var mesh := BoxMesh.new() mesh.size = size mi.mesh = mesh mi.material_override = _mat(color, 0.75, emit) parent.add_child(mi) mi.position = pos return mi func _cyl(parent: Node3D, name: String, pos: Vector3, r: float, h: float, color: Color, emit := 0.0) -> MeshInstance3D: var mi := MeshInstance3D.new() mi.name = name var mesh := CylinderMesh.new() mesh.top_radius = r mesh.bottom_radius = r mesh.height = h mi.mesh = mesh mi.material_override = _mat(color, 0.7, emit) parent.add_child(mi) mi.position = pos return mi func _floor_body(size: Vector3, pos: Vector3) -> void: var body := StaticBody3D.new() add_child(body) body.position = pos var col := CollisionShape3D.new() var shape := BoxShape3D.new() shape.size = size col.shape = shape body.add_child(col) func _sign(text: String, pos: Vector3, color: Color) -> void: var root := Node3D.new() add_child(root) root.position = pos _box(root, "Post", Vector3(0, 1.1, 0), Vector3(0.12, 2.2, 0.12), Color("5D4037")) _box(root, "Board", Vector3(0, 2.3, 0.1), Vector3(2.6, 0.75, 0.08), color, 0.2) var label := Label3D.new() label.text = text label.font_size = 52 label.pixel_size = 0.01 label.position = Vector3(0, 2.3, 0.16) label.modulate = Color(0.08, 0.08, 0.1) label.outline_modulate = Color(1, 1, 1, 0.9) label.outline_size = 10 root.add_child(label) func _stall(pos: Vector3, cloth: Color, label: String) -> void: var root := Node3D.new() add_child(root) root.position = pos _box(root, "Table", Vector3(0, 0.55, 0), Vector3(1.8, 0.1, 1.0), Color("8D6E63")) _box(root, "Leg1", Vector3(-0.7, 0.25, -0.35), Vector3(0.08, 0.5, 0.08), Color("5D4037")) _box(root, "Leg2", Vector3(0.7, 0.25, -0.35), Vector3(0.08, 0.5, 0.08), Color("5D4037")) _box(root, "Leg3", Vector3(-0.7, 0.25, 0.35), Vector3(0.08, 0.5, 0.08), Color("5D4037")) _box(root, "Leg4", Vector3(0.7, 0.25, 0.35), Vector3(0.08, 0.5, 0.08), Color("5D4037")) _box(root, "Canopy", Vector3(0, 1.55, 0), Vector3(2.1, 0.06, 1.3), cloth, 0.12) _box(root, "PoleL", Vector3(-0.95, 1.0, 0), Vector3(0.06, 1.1, 0.06), Color("795548")) _box(root, "PoleR", Vector3(0.95, 1.0, 0), Vector3(0.06, 1.1, 0.06), Color("795548")) _box(root, "GoodsA", Vector3(-0.35, 0.72, 0.1), Vector3(0.35, 0.25, 0.35), cloth.lightened(0.2)) _box(root, "GoodsB", Vector3(0.4, 0.7, -0.05), Vector3(0.3, 0.2, 0.3), Color("FFE082")) var t := Label3D.new() t.text = label t.font_size = 36 t.pixel_size = 0.01 t.position = Vector3(0, 1.85, 0) t.modulate = Color(0.1, 0.08, 0.12) root.add_child(t) func _cafe_set(pos: Vector3) -> void: var root := Node3D.new() add_child(root) root.position = pos _cyl(root, "Table", Vector3(0, 0.55, 0), 0.55, 0.08, Color("D7CCC8")) _cyl(root, "Stem", Vector3(0, 0.28, 0), 0.08, 0.5, Color("6D4C41")) for i in 3: var a := i / 3.0 * TAU _box(root, "Chair%d" % i, Vector3(cos(a) * 0.95, 0.35, sin(a) * 0.95), Vector3(0.4, 0.08, 0.4), Color("A1887F")) _box(root, "Back%d" % i, Vector3(cos(a) * 1.1, 0.55, sin(a) * 1.1), Vector3(0.08, 0.4, 0.35), Color("8D6E63")) func _poi(title: String, blurb: String, pos: Vector3, radius := 2.2) -> void: var zone := Area3D.new() zone.set_script(load("res://scripts/poi_zone.gd")) zone.set("title", title) zone.set("blurb", blurb) zone.position = pos var col := CollisionShape3D.new() var shape := CylinderShape3D.new() shape.radius = radius shape.height = 2.5 col.shape = shape col.position = Vector3(0, 1.0, 0) zone.add_child(col) add_child(zone) func _npc(kind: String, name: String, pos: Vector3, accent: Color, lines: PackedStringArray) -> void: var g := Node3D.new() g.name = "%s_%s" % [kind.capitalize(), name] g.set_script(load("res://scripts/npc_wander.gd")) g.set("display_name", name) g.set("lines", lines) g.position = pos add_child(g) var body := AvatarFactory.build(kind, accent) g.add_child(body) var label := Label3D.new() label.text = name label.font_size = 42 label.pixel_size = 0.012 label.position = Vector3(0, 2.55, 0) label.modulate = Color(0.12, 0.1, 0.18) label.outline_size = 6 label.outline_modulate = Color(1, 0.95, 0.85, 0.9) g.add_child(label) func _build() -> void: _box(self, "Earth", Vector3(0, -0.25, 0), Vector3(90, 0.35, 90), Color("5F9E52")) _floor_body(Vector3(90, 0.45, 90), Vector3(0, -0.4, 0)) # Plaza core — fountain only (no overlapping intersection) _spawn("res://art/city/pavement-fountain.glb", Vector3(0, 0, 0)) _spawn("res://art/city/pavement.glb", Vector3(-TILE, 0, 0)) _spawn("res://art/city/pavement.glb", Vector3(TILE, 0, 0)) _spawn("res://art/city/pavement.glb", Vector3(0, 0, -TILE)) _spawn("res://art/city/pavement.glb", Vector3(0, 0, TILE)) _spawn("res://art/city/pavement.glb", Vector3(-TILE, 0, -TILE)) _spawn("res://art/city/pavement.glb", Vector3(TILE, 0, -TILE)) _spawn("res://art/city/pavement.glb", Vector3(-TILE, 0, TILE)) _spawn("res://art/city/pavement.glb", Vector3(TILE, 0, TILE)) # Roads ring outside plaza _spawn("res://art/city/road-straight-lightposts.glb", Vector3(0, 0, -TILE * 2)) _spawn("res://art/city/road-straight-lightposts.glb", Vector3(0, 0, TILE * 2)) _spawn("res://art/city/road-straight.glb", Vector3(-TILE * 2, 0, 0), 90) _spawn("res://art/city/road-straight.glb", Vector3(TILE * 2, 0, 0), 90) _spawn("res://art/city/road-corner.glb", Vector3(-TILE * 2, 0, -TILE * 2), 180) _spawn("res://art/city/road-corner.glb", Vector3(TILE * 2, 0, -TILE * 2), 90) _spawn("res://art/city/road-corner.glb", Vector3(-TILE * 2, 0, TILE * 2), -90) _spawn("res://art/city/road-corner.glb", Vector3(TILE * 2, 0, TILE * 2), 0) _spawn("res://art/city/road-split.glb", Vector3(0, 0, TILE * 3)) _spawn("res://art/city/road-intersection.glb", Vector3(TILE * 3, 0, 0), 0) # Buildings + collision hulls var bsize := Vector3(5.5, 5.0, 5.5) _spawn("res://art/city/building-small-a.glb", Vector3(-TILE * 1.6, 0, -TILE * 1.55), 0, 1.0, true, bsize) _spawn("res://art/city/building-small-b.glb", Vector3(TILE * 1.6, 0, -TILE * 1.45), -15, 1.0, true, bsize) _spawn("res://art/city/building-small-c.glb", Vector3(TILE * 1.65, 0, TILE * 1.35), 165, 1.0, true, Vector3(6, 7, 6)) _spawn("res://art/city/building-small-d.glb", Vector3(-TILE * 1.6, 0, TILE * 1.5), 20, 1.0, true, bsize) _spawn("res://art/city/building-garage.glb", Vector3(-TILE * 2.6, 0, 0), 90, 1.0, true, Vector3(6, 4, 6)) _spawn("res://art/city/building-small-a.glb", Vector3(TILE * 2.6, 0, 0.5), -90, 1.0, true, bsize) _spawn("res://art/city/building-small-c.glb", Vector3(0.5, 0, TILE * 2.7), 180, 1.0, true, Vector3(6, 7, 6)) _spawn("res://art/city/building-small-b.glb", Vector3(-0.5, 0, -TILE * 2.65), 8, 1.0, true, bsize) _spawn("res://art/city/building-small-d.glb", Vector3(TILE * 2.4, 0, TILE * 2.2), 140, 1.0, true, bsize) _spawn("res://art/city/building-small-a.glb", Vector3(-TILE * 2.4, 0, -TILE * 2.1), 40, 1.0, true, bsize) var greens := [ "res://art/city/grass-trees.glb", "res://art/city/grass-trees-tall.glb", "res://art/city/grass.glb", ] for i in 20: var a := i / 20.0 * TAU + 0.15 var r := 26.0 + (i % 5) * 2.2 _spawn(greens[i % greens.size()], Vector3(cos(a) * r, 0, sin(a) * r), rad_to_deg(a)) # River + pier var river := MeshInstance3D.new() var rm := BoxMesh.new() rm.size = Vector3(80, 0.14, 10) river.mesh = rm river.material_override = _mat(Color("29A8C9"), 0.12, 0.35) river.position = Vector3(0, 0.02, 32) river.set_script(load("res://scripts/river_shimmer.gd")) add_child(river) _box(self, "Pier", Vector3(2, 0.28, 26.5), Vector3(6.2, 0.22, 4.0), Color("D4A574")) _box(self, "PierRail", Vector3(2, 0.75, 24.7), Vector3(6.2, 0.1, 0.12), Color("8D6E63")) _box(self, "Boat", Vector3(4.5, 0.2, 30.5), Vector3(2.8, 0.35, 1.1), Color("EF9A9A")) # Mascot duck near fountain var duck := _spawn("res://art/props/duck.glb", Vector3(1.8, 0.15, 1.2), 40, 0.45) if duck: var bob := create_tween().set_loops() bob.tween_property(duck, "position:y", 0.28, 0.9).set_trans(Tween.TRANS_SINE) bob.tween_property(duck, "position:y", 0.15, 0.9).set_trans(Tween.TRANS_SINE) # Fox companion around plaza var fox := _spawn("res://art/chars/Fox.glb", Vector3(-2.5, 0, 2.2), 120, 0.02) if fox: var orbit := Node3D.new() add_child(orbit) orbit.position = Vector3(0, 0, 0) remove_child(fox) orbit.add_child(fox) fox.position = Vector3(3.5, 0, 0) var spin := create_tween().set_loops() spin.tween_property(orbit, "rotation:y", TAU, 14.0).from(0.0) # Street life _stall(Vector3(-8.5, 0, 8.5), Color("F48FB1"), "Thai Tea") _stall(Vector3(-6.2, 0, 10.2), Color("FFE082"), "Satay") _stall(Vector3(-10.2, 0, 6.8), Color("80DEEA"), "SIM Card") _cafe_set(Vector3(8.5, 0, -5.5)) _cafe_set(Vector3(11.0, 0, -7.2)) _box(self, "Scooter", Vector3(-3.5, 0.35, -4.2), Vector3(1.4, 0.7, 0.45), Color("FF7043")) _cyl(self, "WheelF", Vector3(-4.0, 0.25, -4.2), 0.22, 0.08, Color("212121")) _cyl(self, "WheelR", Vector3(-2.9, 0.25, -4.2), 0.22, 0.08, Color("212121")) var lamps := [ Vector3(-6, 0, -6), Vector3(6, 0, -6), Vector3(-6, 0, 6), Vector3(6, 0, 6), Vector3(0, 0, 12), Vector3(-12, 0, 0), Vector3(12, 0, 0), Vector3(0, 0, -12), ] for p in lamps: var lamp := Node3D.new() add_child(lamp) lamp.position = p _box(lamp, "Pole", Vector3(0, 1.6, 0), Vector3(0.12, 3.2, 0.12), Color("37474F")) _box(lamp, "Bulb", Vector3(0, 3.3, 0), Vector3(0.4, 0.28, 0.4), Color("FFE082"), 2.0) var light := OmniLight3D.new() light.light_color = Color("FFD54F") light.light_energy = 1.35 light.omni_range = 9.0 light.position = Vector3(0, 3.15, 0) lamp.add_child(light) _sign("☕ Cafe Nomad", Vector3(9.8, 0, -4.2), Color("FFE082")) _sign("🏠 Hostel", Vector3(-12, 0, -9), Color("FFAB91")) _sign("💻 Cowork Loft", Vector3(11.5, 0, 10), Color("80DEEA")) _sign("🛍 Night Market", Vector3(-9.5, 0, 11), Color("F48FB1")) _sign("🌊 Ping Pier", Vector3(0.5, 0, 24), Color("81D4FA")) _poi("Cafe Nomad", "Wifi · oat latte · meet founders", Vector3(9.5, 0, -5.5)) _poi("Hostel Bed", "From ฿280 · rooftop sunset", Vector3(-11.5, 0, -8.5)) _poi("Cowork Loft", "Day pass · quiet booths", Vector3(11, 0, 10)) _poi("Night Market", "Satay · SIM · street beats", Vector3(-8.5, 0, 9)) _poi("Ping Pier", "Golden hour photo spot", Vector3(2, 0, 25.5), 2.8) _npc("girl", "Lin", Vector3(4.5, 0, -2.5), Color("FF80AB"), PackedStringArray(["Wifi password is sunset!", "Hostel rooftop at 6?"])) _npc("girl", "Mira", Vector3(-4.2, 0, 3.0), Color("CE93D8"), PackedStringArray(["Shipping my first SaaS here.", "Oat latte on me."])) _npc("girl", "Anya", Vector3(3.0, 0, 11.5), Color("81D4FA"), PackedStringArray(["Night market SIM deals.", "Try the mango sticky rice."])) _npc("girl", "Sofi", Vector3(8.5, 0, 1.5), Color("F48FB1"), PackedStringArray(["Design sprint at cowork.", "Amber vibes today."])) _npc("girl", "Yuna", Vector3(-2.0, 0, -9.0), Color("FFCC80"), PackedStringArray(["Just landed from Seoul.", "Anyone for Ping pier photos?"])) _npc("boy", "Kai", Vector3(3.5, 0, 7.2), Color("4FC3F7"), PackedStringArray(["Remote standup in 10.", "Best pad thai is left aisle."])) _npc("boy", "Jun", Vector3(-1.0, 0, -5.5), Color("90CAF9"), PackedStringArray(["Scooter rental behind hostel.", "Let's co-work tomorrow."])) _npc("boy", "Leo", Vector3(-7.5, 0, -2.0), Color("FFAB91"), PackedStringArray(["Building in public.", "Coin for coffee?"])) _npc("boy", "Alex", Vector3(-5.5, 0, 7.0), Color("A5D6A7"), PackedStringArray(["Visa run next week.", "Nomadro meetup Friday."])) _npc("boy", "Noah", Vector3(6.0, 0, -8.5), Color("B39DDB"), PackedStringArray(["Quiet booth upstairs.", "Golden hour is insane."]))