TruckSim Maps is a collection of tools and components for building web-based maps for American Truck Simulator and Euro Truck Simulator 2.
The long-term goal of the project is to build a Route Advisor for ATS that can run on a phone or tablet.
A demo app built with these tools and components can be found at https://truckermudgeon.github.io/.
# clone the repo into a local directory
mdkir maps
cd maps
git clone --recurse-submodules https://github.com/truckermudgeon/maps.git .
# install maps projects
npm install
# build native addon
npm run build -w packages/clis/parser
The TruckSim Maps repo contains the following projects:
parser
is a CLI tool that parses map data in ATS/ETS2 files and outputs JSON and
PNG files.
npx parser -i pathToGameDirectory -o dirToWriteFilesTo
Parsing can take a couple of minutes, depending on the machine and the installed map DLCs.
Note
- All released map DLCs are supported.
- Third-party map mods are not supported.
generator
is a CLI tool that generates GeoJSON, PMTiles and MapLibre
spritesheet files from parser
output.
# generate ATS pmtiles file
npx generator map -m usa -i dirWithParserOutput -o dirToWriteFilesTo
# generate ETS2 pmtiles file
npx generator map -m europe -i dirWithParserOutput -o dirToWriteFilesTo
# generate combined ATS and ETS2 cities.geojson file
npx generator cities -m usa -m europe -i dirWithParserOutput -o dirToWriteFilesTo
# generate ATS and ETS2 footprints pmtiles files
npx generator footprints -m usa -m europe -i dirWithParserOutput -o dirToWriteFilesTo
# generate spritesheet files
npx generator spritesheet -i dirWithParserOutput -o dirToWriteFilesTo
# generate ATS and ETS2 contours (aka elevations) pmtiles files
npx generator contours -m usa -m europe -i dirWithParserOutput -o dirToWriteFilesTo
# generate ATS achievements.geojson file
npx generator achievements -m usa -i dirWithParserOutput -o dirToWriteFileTo
Important
PMTiles output requires tippecanoe to be installed.
The generated GeoJSON for roads and prefabs is far from perfect; many intersections look incorrect. Improvements to how they're generated are slowly being made.
demo-app
is a React app that renders ATS/ETS2 maps.
# from the project root:
# run the `generator` commands listed above, specifying
#
# packages/apps/demo/public
#
# as the output directory.
#
# Then run the following to start the web server:
npm start --workspace=packages/apps/demo
prefabs-app
is a React app that helps visualize and debug how PrefabDescriptions are converted into LineStrings and Polygons.
# from the project root:
#
# 1. run the `parser` command listed above to generate
# usa-prefabDescriptions.json
# usa-prefabs.json
# usa-nodes.json
#
# 2. copy those generated files to
# packages/apps/prefabs/public
#
# Then run the following to start the web server:
npm start --workspace=packages/apps/prefabs
TruckSim Maps is licensed under GPL v3.
Parts of the parser
and generator
projects are based on:
The parser
project includes code from:
- CityHash
- Nvidia's libdeflate fork
The generator
project includes data from Natural Earth.