{"id":47625710,"url":"https://github.com/electrified/sheffield-supertram-simulator","last_synced_at":"2026-04-01T22:47:30.844Z","repository":{"id":345924622,"uuid":"1184169670","full_name":"electrified/sheffield-supertram-simulator","owner":"electrified","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-21T23:50:30.000Z","size":4630,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-22T01:32:42.099Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/electrified.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-17T10:19:12.000Z","updated_at":"2026-03-21T13:36:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/electrified/sheffield-supertram-simulator","commit_stats":null,"previous_names":["electrified/sheffield-supertram-simulator"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/electrified/sheffield-supertram-simulator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electrified%2Fsheffield-supertram-simulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electrified%2Fsheffield-supertram-simulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electrified%2Fsheffield-supertram-simulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electrified%2Fsheffield-supertram-simulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/electrified","download_url":"https://codeload.github.com/electrified/sheffield-supertram-simulator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electrified%2Fsheffield-supertram-simulator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31292696,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-01T22:47:26.526Z","updated_at":"2026-04-01T22:47:30.835Z","avatar_url":"https://github.com/electrified.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sheffield Supertram Simulator\n\nA Unity 6.3 LTS driving simulator for the Sheffield Supertram light rail network, using real-world terrain (Ordnance Survey) and route data (OpenStreetMap).\n\n## Prerequisites\n\n- **Unity 6000.3.x** (Unity 6.3 LTS) with Universal Render Pipeline\n- **Python 3.10+** with venv\n- **GDAL CLI tools**: `gdalbuildvrt`, `gdal_translate`, `gdalwarp`, `gdalinfo`\n- **jq** (JSON processor)\n\nInstall GDAL and jq on Arch Linux:\n```bash\nsudo pacman -S gdal jq\n```\n\n## Quick Start\n\n### 1. Set up Python environment\n\n```bash\npython3 -m venv .venv\n.venv/bin/pip install -r tools/requirements.txt\n```\n\n### 2. Download and process terrain data\n\nDownload **OS Terrain 50** (ASCII Grid format) from:\nhttps://osdatahub.os.uk/downloads/open/Terrain50\n\nExtract the needed tile `.asc` files into `data/terrain_tiles/`. The required tiles are: SK28, SK29, SK38, SK39, SK48, SK49.\n\nIf you downloaded the full UK zip:\n```bash\nmkdir -p data/terrain_tiles\nfor tile in sk28 sk29 sk38 sk39 sk48 sk49; do\n  unzip -o -j \"data/terrain_tiles/sk/${tile}_OST50GRID_*.zip\" \"*.asc\" -d data/terrain_tiles/\ndone\n```\n\nThen run the terrain pipeline:\n```bash\nbash tools/terrain_pipeline.sh\n```\n\nThis produces:\n- `data/sheffield_terrain.raw` — 16-bit unsigned RAW heightmap (4097x4097)\n- `data/terrain_metadata.json` — dimensions, elevation range, Unity settings\n\n### 3. Fetch and process OSM data\n\n```bash\n# Fetch raw data from Overpass API (takes a few minutes, respects rate limits)\n.venv/bin/python3 tools/fetch_osm.py\n\n# Process into game-ready formats\n.venv/bin/python3 tools/osm_to_json.py\n```\n\nThis produces:\n- `data/tram_routes.json` — route waypoints with Unity coordinates\n- `data/stations.json` — all 50+ tram stops with Unity coordinates\n- `data/buildings.geojson` — building footprints near tram routes\n- `data/roads.geojson` — road centrelines near tram routes\n- `data/road_network.json` — road network for detail zones\n\n### 4. Import into Unity\n\nOpen the project in Unity, then either:\n\n**GUI method:**\n1. `Window \u003e Sheffield Supertram \u003e Import Terrain` — imports the heightmap\n2. `Window \u003e Sheffield Supertram \u003e Import Routes` — imports tram routes and stations\n\n**Batch method (command line):**\n```bash\n# Remove stale lock file if Unity isn't running\nrm -f Temp/UnityLockfile\n\n# Full import: terrain + scene setup + routes\nUnity -projectPath . -executeMethod FullImport.Run -batchmode -quit -logFile -\n```\n\nOr run individual steps:\n```bash\n# Terrain + scene setup only\nUnity -projectPath . -executeMethod BatchSetup.Run -batchmode -quit -logFile -\n\n# Routes only (requires terrain scene to exist already)\nUnity -projectPath . -executeMethod RouteImporter.BatchImport -batchmode -quit -logFile -\n```\n\n### 5. Open the scene and play\n\n1. Open `Assets/Scenes/DevScene.unity`\n2. Press Play — a test cube will follow the first tram route automatically\n3. Use the **Dev Camera** (free-fly) to explore:\n   - **WASD** — move horizontally\n   - **Q/E** — move down/up\n   - **Right-click + mouse** — look around\n   - **Shift** — move faster\n   - **Scroll wheel** — adjust movement speed\n\n## Tools Reference\n\n| Tool | Purpose |\n|------|---------|\n| `tools/terrain_pipeline.sh` | Process OS Terrain 50 `.asc` tiles into Unity RAW heightmap |\n| `tools/fetch_osm.py` | Download tram routes, stations, buildings, roads from OpenStreetMap |\n| `tools/osm_to_json.py` | Convert raw OSM data into game-ready JSON and GeoJSON |\n| `tools/coord_utils.py` | Coordinate conversion utility (WGS84 / OSGB36 / Unity) |\n| `tools/config.json` | Central configuration for all pipeline parameters |\n\n### Coordinate conversion examples\n\n```bash\n# WGS84 lat/lon to Unity coordinates\n.venv/bin/python3 tools/coord_utils.py --lat 53.3826 --lon -1.4691 --unity\n\n# OSGB36 easting/northing to Unity coordinates\n.venv/bin/python3 tools/coord_utils.py --easting 435850 --northing 387100 --unity\n\n# Run self-test\n.venv/bin/python3 tools/coord_utils.py --test\n```\n\n## Coordinate System\n\n- **OSGB36 / EPSG:27700** (British National Grid) — metres\n- Unity axes: **X** = Easting, **Z** = Northing, **Y** = Up\n- Origin: terrain SW corner (E 431000, N 380000) = Unity (0, 0, 0)\n- Terrain extent: 15,000m x 15,000m (E 431000–446000, N 380000–395000)\n- Elevation range: ~17m (Don Valley) to ~280m (western hills)\n\n## Project Structure\n\n```\nREADME.md                    This file\nPLAN.md                      Full implementation plan (13 milestones)\nCLAUDE.md                    Project conventions for AI assistants\ntools/\n  config.json                Pipeline configuration (bounding box, tiles, zones)\n  terrain_pipeline.sh        GDAL terrain processing pipeline\n  fetch_osm.py               OSM data downloader (Overpass API)\n  osm_to_json.py             OSM data processor\n  coord_utils.py             Coordinate conversion (pyproj)\n  requirements.txt           Python dependencies\ndata/\n  terrain_tiles/             OS Terrain 50 .asc source files (not in git)\n  intermediate/              GDAL intermediate files (not in git)\n  osm_raw/                   Raw Overpass API responses\n  sheffield_terrain.raw      Unity heightmap (generated)\n  terrain_metadata.json      Terrain dimensions and settings (generated)\n  tram_routes.json           Tram route waypoints (generated)\n  stations.json              Tram station positions (generated)\n  buildings.geojson          Building footprints (generated)\n  roads.geojson              Road centrelines (generated)\nAssets/\n  Editor/\n    BatchSetup.cs            Batch terrain import + scene setup\n    RouteImporter.cs         Batch route/station import\n    FullImport.cs            Combined terrain + routes import\n    TerrainSetup.cs          GUI terrain importer\n    SceneSetup.cs            GUI scene setup\n    URPSetup.cs              URP pipeline configuration\n  Scripts/\n    Tram/\n      TrackSegment.cs        Spline wrapper with length, gradient, stations\n      TramRoute.cs           Ordered list of track segments\n      SplineFollower.cs      Moves transform along a route\n      TrackMeshGenerator.cs  Generates visible track mesh from spline\n      Junction.cs            Track junction switching\n      StationMarker.cs       Station metadata component\n    Camera/\n      FreeFlyCamera.cs       Developer fly camera (WASD + mouse)\n  Scenes/\n    DevScene.unity           Main development scene\n\n.venv/                       Python virtual environment (not in git)\n```\n\n## Vehicle Profiles\n\nVehicle physics are configurable via ScriptableObject profiles, editable in the Unity Inspector. Create new profiles via **Create \u003e Sheffield Supertram** in the Project window.\n\n| Profile Type | Used By | Key Parameters |\n|---|---|---|\n| **Tram Profile** | `TramPhysics`, `TramArticulation` | Mass, power, max speed, braking forces, rolling/aero resistance, bogie geometry |\n| **Car Profile** | `CarPhysics` | Torque, max speed, braking forces, steering angle |\n| **AI Car Profile** | `AICarController` | Raycast interval/distances, stuck detection thresholds, speed variation |\n\nAssign a profile to the `profile` field on the relevant component. If no profile is assigned, built-in defaults are used (matching the real Siemens-Duewag Supertram specs for trams, and sensible defaults for cars). This means existing scenes work unchanged.\n\nTo create a variant (e.g. a heavier loaded tram):\n1. **Create \u003e Sheffield Supertram \u003e Tram Profile**\n2. Adjust values in the Inspector\n3. Assign to the `TramPhysics` and `TramArticulation` components on your tram\n\n## Data Attribution\n\n- Terrain: [OS Terrain 50](https://osdatahub.os.uk/downloads/open/Terrain50) — Open Government Licence v3.0\n- Routes, stations, buildings, roads: [OpenStreetMap](https://www.openstreetmap.org/) — ODbL\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectrified%2Fsheffield-supertram-simulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felectrified%2Fsheffield-supertram-simulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectrified%2Fsheffield-supertram-simulator/lists"}