SDK
The InventAI SDK is a powerful C# library for AI-powered game development. It provides tools for image generation, 3D model generation, text and novel generation, character management, and more.
If you're working with Ren'Py or Unity, we suggest using the specific tools for those platforms that provide a more straight-forward experience.
If you're working with other platforms such as Godot, the SDK is a good starting point.
Features
- Image generation
- 3D model generation
- Text and novel generation
- Character management
- Export to Ren'Py, JSON, and more
Installation
The InventAI SDK is a C# library that can be added to your project as a reference. Simply add the InventAI project to your solution and reference it in your project.
Architecture
The SDK follows a modular architecture with clear separation of concerns:
- Core functionality in the
Inventai
project - Novel-specific features in the
InventaiNovel
project - Example implementations in the
InventaiNovelTestApp
project
Key Components
Novel Generation
The SDK includes a robust novel generation system that can create branching narratives with multiple paths and endings. The Novel
class serves as the core component for managing the story structure.
Character Management
Character interactions are handled through the CharacterManager
class, which manages character states, relationships, and dialogue options. Characters can have complex personalities and relationships that evolve throughout the story.
Discussion Context
The DiscussionContextManager
class maintains the context of ongoing conversations, ensuring continuity and coherence in character interactions. It tracks conversation history and manages the flow of dialogue.
Export Options
The SDK supports multiple export formats, including:
- Ren'Py script format for visual novel engines
- JSON format for data storage and transfer
- Custom formats through the exporter interface
Image Generation
The SDK provides image generation and modification through the ImageAgent
class, supporting both text prompts and image inputs.
3D Model Generation
The SDK offers 3D model generation through the ModelAgent
class.
Integrating Hunyuan3D with InventAI
The ImageAgentHunyuan3D
class serves as a bridge between the InventAI SDK and the Hunyuan3D-2 model generation API. Here's how it works:
This agent allows you to generate 3D models via prompts or images, integrating seamlessly with the narrative logic of InventAI.
How It Works
The class uses an internal HttpClient
to send a POST request to the Hunyuan3D-2 API endpoint. You provide either a text prompt or a base64-encoded image. Here's what happens:
- A JSON payload is created using the provided
prompt
orimage
. - The payload is serialized using snake_case naming conventions for compatibility.
- The request is sent to the specified endpoint.
- If successful, the API returns the generated 3D model as a byte array (typically a
.glb
file), which can then be saved or used directly in Unity.
Example Request
Here's an example of what the JSON payload might look like when sending a text prompt: