Skip to content
Python plays Euro Truck Simulator 2 πŸš›
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets Commit Message May 3, 2019
autolab
deprecated final-tp3 May 3, 2019
jalopy
.gitignore
LICENSE
README.md Update README.md Jul 11, 2019
README.txt
demo-video.txt
packages.txt
proposal.pdf final-tp3 May 3, 2019
storyboard.pdf storyboard Apr 16, 2019

README.md

jalopy

Self-driving system for Euro Truck Simulator 2.

Can I run it?

  • (note) Windows comes packaged with something called a Desktop Duplication API that uses fast DXGI and Direct3D libraries to produce fast lighning-fast screenshots. I use a package called D3DShot for this very purpose. It can take 800x600 screenshots at around 50 FPS. MSS is also pretty good, and is a great generic solution for MacOS and Linux, but beware, I haven't yet tested those platforms for complete compatibility with Jalopy.
  • Windows >8.1 (I'll figure out how to send key inputs to Unix operating systems later)
  • Python >3.6 (64-bit installation only)

Installation (tested on Windows 10)

  • (optional) Install Anaconda for ease of installation
  • (conditional) If you use Visual Studio Code, add "python.linting.pylintArgs": ["--extension-pkg-whitelist=cv2"] to your settings.json file
  1. Clone this repo
  2. Make sure you have pip installed by running pip --version on your computer. If not, navigate to the jalopy folder and run python get-pip.py
  3. Install necessary packages (OpenCV, sklearn, etc.) with pip install -r packages.txt

How to run Jalopy

  • (optional) If you are running Jalopy on laptop, you probably want to plug in your computer to prevent battery consumption conservation from slowing down the game/OpenCV/Jalopy
  • (note) Run Euro Truck Simulator 2 at the highest possible settings for your system (ultra mode is best). This increases the smoothness (anti-aliasing) of your game and makes Jalopy happier.
  1. Place Euro Truck Simulator 2 to the upper left corner of your screen
  2. Navigate to the main directory with cd jalopy
  3. Run the main .py file with python main.py

Update history

  • TP1 : Quick demo of lane detection, working on streaming the game output to the OpenCV feed. Using personal gameplay and YouTube videos for testing purposes, transcoding on Handshake for optimal filesize and resolution.
  • TP2 : Working self-driving demo with lane-slope heuristic. However, this heuristic is awful and should be discarded in favor of a cNN (coming TP3)
  • TP3 : Better lane-finding and steering logic heuristics, runs in real-time without cNN

Shortcut commands

  • There are no shortcut commands for this program

Notes

  • PIL's ImageGrab functionality is way, way, way too slow for jalopy. That package took around half a second to process a single screenshot, and that's before I even use OpenCV. Ew!

Helpful links for learning

You can’t perform that action at this time.