npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@adatechnology/game-urban-three

v0.3.4

Published

Draws the urban pattern of game-urban with three.js: parts as meshes with the team's rounded boxes, instanced road dashes and windows (lit and dark), canvas signs and labels, point and spot lights from the light budget, and the animations (flickering lamp

Readme

@adatechnology/game-urban-three

Draws the scenes of @adatechnology/game-urban with three.js, the way the team's Galeria do Vale Cinzento does.

import * as THREE from 'three'
import { createUrban } from '@adatechnology/game-urban'
import { createUrbanThree } from '@adatechnology/game-urban-three'

const urban = createUrban()
const b = urban.builder({ seed: 7 })
urban.streets.grid(b, { block: 36, count: 2, width: 10 })
urban.poles.get('led_double').build(b, { x: 18, z: 5 })

const three = createUrbanThree(THREE, { document })   // `document` only for signs and labels
const drawn = three.draw(b.scene())
scene.add(drawn.root)
// each frame: drawn.animate(elapsedSeconds)            // flickering lamps, sweeping searchlights
// when done:  drawn.dispose()
  • Each part becomes a mesh in the order it was added: boxes with the team's rounded edge (a 4x4x4 grid per face, edge vertices on an arc), tapered cylinders, flat-shaded cones and prisms, planes that only receive shadows, crowns that only cast, canvas signs and labels.
  • The small boxes (road dashes, sandbags) are one instanced mesh, and the windows two (lit ones glow, dark ones are a dark pane). The instance matrices are the page's.
  • Lights are real PointLight and SpotLight objects; drawn.lights lists them. animate(t) flickers the failing lamps (I * (sin(23t + x) > 0.3 || sin(3.1t) > 0.85 ? 0.15 : 1)) and moves each searchlight target around its tower.
  • A terrain part becomes the square mesh with vertex colours (flat shaded, roughness 1, casts and receives shadows); the water is a plane part drawn after it.
  • A placement part (a vehicle of the fleet, a species of the pack) becomes a group at the spot, turned and scaled, holding the object a resolver made: createUrbanThree(THREE, { resolvers: { vehicle: createVehicleResolver(vehiclesThree), plant: createPlantResolver(THREE) } }). The vehicle resolver uses the lite build of game-vehicles-three (six fused meshes) and the plant resolver generate and createPlantObject of game-vegetation; each is built once for an id and paint (or seed) and cloned for every spot, sharing geometry and materials. An id the package does not know leaves the spot empty. resolver.dispose() frees them.
  • draw(scene, { root }) draws into a group of yours. Works on three r160 and later.

The scene hash, the lists of instances and the surface of each material (shadows, roughness, metalness, flat shading) of 34 cases are tested against the page.

Geometry

Planes, cylinders, cones, boxes (and the rounded box built on one), the prism's extrusion and the test area's light reach spheres are made through shapeGeometries(THREE) of @adatechnology/game-shapes-three: the same bytes as three's constructors (tests/exact-golden.test.ts), cached by parameters. The dodecahedron rock is still three's own.

Test area

createUrbanTestModule(options) and loadUrbanTestModule(room, options) put the city in the shared test room (?area=urban in examples/urban-test-area; the module also loads in examples/interactables-test-area).

  • Items (17): the five poles of the kit in a row, a street grid with a filled block, a patch of terrain (a rolling plain with a river and a lake; terrain replaces it) and the ten neighbourhoods of the sample sheet in the Galeria's cells. Everything is drawn by the kit and this package, so a game that passes urban: { packs, patch, remove } sees its own catalogues in the area. Each item is scenery: one anchored slab of concrete as large as the sample.
  • Bench: the neighbourhood, the seed, the share of lamps on (the pattern's own, all, half, none), the budget of real lights and, when asked, the species of the region and the vehicles of the fleet (a game gives vehicles: (THREE) => createVehiclesThree(...); without it the bench parks no cars). Actions draw and take away the neighbourhood in front of the player; changing a setting draws it again.
  • Layers: the reach of every real light and the box of each sample. Metrics: samples, draw calls, triangles, real lights, instances, objects of the bench and the light budget left.
  • Eight scenarios, with no object of the room: pole heights, the light budget (the counter goes below zero as the page's), the dash every 5 m, block heights, the seed, burnt-out lamps, the terrain (vertex height, river bed, lake level) and the providers (vehicles of the fleet, species of the region).
  • The room's camera sees 140 m and the sample sheet is 240 m wide, so the module lends the camera a 600 m view while it is loaded and gives the old one back when it detaches.