Skip to content

truckermudgeon/maps

Repository files navigation

TruckSim Maps

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/.

Getting Started

Prerequisites

Installation

# clone the repo into a local directory
mdkir maps
cd maps
git clone --recurse-submodules [email protected]:truckermudgeon/maps.git .

# install maps projects
npm install

# build native addon
npm run build -w packages/clis/parser

Projects

The TruckSim Maps repo contains the following projects:

parser

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

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 combined ATS and ETS2 footprints.geojson file
npx generator footprints -m usa -m europe -i dirWithParserOutput -o dirToWriteFilesTo

# generate spritesheet files
npx generator spritesheet -i dirWithParserOutput -o dirToWriteFilesTo

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

demo-app is a React app that renders ATS/ETS2 maps.

demo-screenshot

# 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

prefabs-app is a React app that helps visualize and debug how PrefabDescriptions are converted into LineStrings and Polygons.

prefabs-screenshot

# from the project root:
#
# 1. run the `parser` command listed above to generate
#      usa-prefabDescriptions.json
#
# 2. copy usa-prefabDescriptions.json to
#      packages/apps/prefabs/public
#
# Then run the following to start the web server:
npm start --workspace=packages/apps/prefabs

License

TruckSim Maps is licensed under GPL v3.

Credits

Parts of the parser and generator projects are based on:

The parser project includes code from:

The generator project includes data from Natural Earth.