Using coordinates-to-city from https://github.com/mike-koch/ets2-mobile-route-advisor# ets2-ai-driven-co-driver
This plugin adds an AI-powered virtual co-driver to Euro Truck Simulator 2 to enhance gameplay with context-aware dialogue, commentary, and assistance.
-
Install
./install.sh
-
Configure settings in
src/config.py
:- Set
DEFAULT_SESSION_ID
to load an existing session (uuid, from ./data/sessions) or "new" to create one on startup - Set
DEFAULT_PROFILE_NAME
to load a specific co-driver profile from ./src/profiles
- Set
-
Run the plugin:
python ./run.py
The plugin will automatically connect to the game's telemetry data and begin analyzing the driving context. The AI co-driver will provide dialogue through text-to-speech based on events like:
- Harsh braking
- Rapid acceleration
- Long highway stretches
- Navigation updates
- Job status changes
Press the configured hotkey (default: ALT) to toggle the co-driver's speech recognition for natural conversations.
- Modify or create new co-driver profiles in
src/profiles/
- Adjust plugin settings in
src/config.py
- Implement custom telemetry event handlers in
src/domain/event/telemetry/handlers/
- Extend core functionality by registering new modules in
PluginCore
The config
section of the src/co_driver_profiles.json
file allows you to configure various providers and their settings for different functionalities such as text-to-text, text-to-audio, image-to-text, and dynamic co-driver.
The text_to_text
section configures the provider and settings for text-to-text functionality.
Example: "text_to_text": { "provider": "openai", "model_id": "gpt-3.5-turbo", "temperature": 0.9 }
Mistral replicate: "text_to_text": { "provider": "replicate", "model_id": "mistralai/mixtral-8x7b-instruct-v0.1", "history_size": 5, "is_stream": true, "params": { "top_k": 50, "top_p": 0.9, "prompt": "{{text}}", "temperature": 1, "system_prompt": "{{system}}", "length_penalty": 1, "max_new_tokens": 1024, "prompt_template": "<s>[INST] {prompt} [/INST] ", "presence_penalty": 0 } },
The text_to_audio
section configures the provider and settings for text-to-audio functionality.
Arnold with replicate
JSON:"text_to_audio": { "provider": "replicate", "model_id": "lucataco/xtts-v2:684bc3855b37866c0c65add2ff39c78f3dea3f4ff103a436465326e0f438d55e", "params": { "text": "{{text}}", "language": "en", "cleanup_voice": false, "speaker": "https://racingleaguehub.s3.eu-west-2.amazonaws.com/stogie.mp3" } }
Openai: "text_to_audio": { "provider": "openai", "model_id": "tts-1" },
edge tts(free): "text_to_audio": { "provider": "microsoft_edge", "params": { "voice": "en-US-AndrewMultilingualNeural" } },
The image_to_text
section configures the provider and settings for image-to-text functionality.
Example: "image_to_text": { "provider": "openai", "model_id": "toonify", "params": { "api_key": "your-api-key" } }
The dynamic_co_driver
section configures the provider and settings for the dynamic co-driver functionality.
Example: "dynamic_co_driver_nlp_example": { "provider": "nlp" }
src/application/
: High-level services and coordinationsrc/domain/
: Core business logic and event handlingsrc/infrastructure/
: Low-level technical implementationssrc/shared/
: Common utilities and constants
The plugin leverages an event-driven architecture with an EventBus
to loosely couple components. Telemetry data is continuously fetched and dispatched to relevant handlers for processing.
Code is 90% generated by AI ๐ค (disclaimer: may contain bugs ๐)