real world asphalt (RWA in short) is a physical controller for Asphalt8 (by changing keys can be used in other games). Since python can't directly communicate with arduino firmata is used as a bridge. following are some demos of the project.
there are two buttons under each paddle that you see in the image. there is another button close to the right hand in the steering wheel. and steering wheel is attached to a potentiometer. when a button is pressed the program identifies the signal and then presses the key accordingly. when steering wheel is turned program identifies whether it's center, left or right according to the tilt. all the keys can be pressed parallely. here are the buttons and the keys supposed to be pressed.
Buttons
- Accelerator Button (right paddle) - w
- Brake Button (left paddle) - s
- Nitro Button (Steer Wheel) - space
Steer Wheel
- Straight - Nothing
- Left - a
- Right - d
- Python 3.7 or later
- poetry (optinal)
- an arduino
- 3 buttons (script will run without buttons)
- Arduino IDE (btw if we call it an IDE vim is an OS)
Install arduino IDE from www.arduino.cc and install it.
upload the Standardfirmata sketch to the arduino from firmata library.
first clone the project cd into it
git clone https://github.com/Anu2001dev/realworld-asphalt8
cd realworl-asphalt8
installs deps. you can install via pip but poetry is recommended for maintainability
pip
pip installl -r requirements.txt
poetry
poetry install
finally
python main.py
- Poetry - Dependency Management
- Rich - Logging Colorized Output
- Pyfirmata - Python Firmata Client
- PyAutoGUI - Pressing Keys
- Me - Code
- Visal Ranindu - All the mechanical work (Although he doesn't know any coding he is a great engineer)
This project is licensed under the MIT License - see the LICENSE.md file for details