Skip to content

BlocTheWorker/Inworld-BaldursGate-Mod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Baldur's Gate 3 Inworld Mod Source Code

This repository houses the source code for a Baldur's Gate 3 mod that empowers players to engage in conversation with their AI companions.

Target Audience:

This repository is geared towards developers, not players. It presupposes familiarity with C# application development and Baldur's Gate 3 modding. Players without development experience should simply search for the packaged version on Nexus Mods https://www.nexusmods.com/baldursgate3. Developers unfamiliar with the concepts presented here are encouraged to delve into independent research and build simple mods first before exploring this source code.

Component Breakdown:

The mod comprises two key components:

  1. Desktop Application:

    • Written in C#
    • Interacts with the game (hooks)
    • Initiates a fastify NodeJS socket server
    • Connects to socket server for bidirectional connection
    • Communicates with Inworld Backend via gRPC Streaming
    • Records and listens audio during open session and transmits data to Inworld for AI communication.
  2. Mod:

System Functionality:

  • The desktop application retrieves the API key and secret from the Windows Credential Manager.
  • It continuously monitors running applications, specifically checking for Baldur's Gate 3.
  • Upon detecting Baldur's Gate 3, it establishes a hook within the DirectX layer and launches the NodeJS connector.
  • The NodeJS connector creates a local socket connection, which the desktop application also establishes a connection to.
  • When a player starts a session, the application communicates with the connector, which interacts with Inworld using a gRPC connection.
  • Responses and UI elements are rendered on the DirectX layer.
  • The layer additionally listens for mouse events to enable 2D raycasting. This calculates bounding boxes to prevent unintended clicks from passing through.

Special Thanks

Fararagi for his Configurable Movement Speed Mod (https://www.nexusmods.com/baldursgate3/users/64167336) Open Faerûn Enjoyer for giving some insights about existing mods (From Larian Modding Discord) Inworld Team for their development key for me to fool around

About

Source Code for Baldur's Gate 3 Mod which allows players to talk with the AI Companions

Resources

License

Stars

Watchers

Forks

Contributors