Giter Site home page Giter Site logo

ets2-ai-driven-co-driver's Introduction

Using coordinates-to-city from https://github.com/mike-koch/ets2-mobile-route-advisor# ets2-ai-driven-co-driver

ETS2 AI Co-Driver Plugin

This plugin adds an AI-powered virtual co-driver to Euro Truck Simulator 2 to enhance gameplay with context-aware dialogue, commentary, and assistance.

WIP, not tested with actual SDK telemetry.

Setup

  1. Install ./install.sh

  2. 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
  3. Run the plugin: python ./run.py

Usage

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.

Customization

  • 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

Config Section

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.

Text-to-Text

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 } },

Text-to-Audio

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" } },

Image-to-Text

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" } }

Dynamic Co-Driver

The dynamic_co_driver section configures the provider and settings for the dynamic co-driver functionality.

Example: "dynamic_co_driver_nlp_example": { "provider": "nlp" }

Architecture Overview

  • src/application/: High-level services and coordination
  • src/domain/: Core business logic and event handling
  • src/infrastructure/: Low-level technical implementations
  • src/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 ๐Ÿ˜‰)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.