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
D3DShotfor this very purpose. It can take 800x600 screenshots at around 50 FPS.
MSSis 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
- Clone this repo
- Make sure you have pip installed by running
pip --versionon your computer. If not, navigate to the jalopy folder and run
- 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.
- Place Euro Truck Simulator 2 to the upper left corner of your screen
- Navigate to the main directory with
- Run the main .py file with
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
- There are no shortcut commands for this program
- 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!