Google Gen AI Plugin
Bring the power of Google's latest generative AI directly into your Construct 3 projects! This plugin acts as a bridge to the official Google Gen AI SDK, allowing you to create smart NPCs, generate dynamic text, analyze images, and even generate new images inside your game.
Powered by the official module: @google/genai
Getting Started
To use this plugin, you will need a valid Google Gemini API Key.
- Create a Google account and start your Free Trial.
- Get your API Key here: https://aistudio.google.com/api-keys
Core Actions & Functions
Here is a breakdown of the main actions provided by the plugin. Most actions require a modelName (e.g., gemini-2.5-flash) and a promptText.
1. Generate Text
Generates a standard text response based on your prompt. Perfect for single questions or generating creative content.
- modelName: The AI model to use (e.g.,
gemini-2.5-flash).
- promptText: Your instructions or questions for the AI.
2. Chat Interaction
Maintains conversation history. This is perfect for creating interactive NPCs that remember what the player said previously.
- modelName: The AI model to use.
- promptText: The player's next message in the ongoing chat.
3. Analyze Image
A multimodal feature that allows the AI to "see" and describe an image you provide.
- modelName: The AI model to use (Make sure to use a model that supports multimodal input like
gemini-2.5-flash).
- promptText: What you want to ask about the image (e.g., "Describe what is in this picture").
4. Generate With Search
Grounds the AI's response with real-time Google Search data to prevent hallucinations and provide up-to-date facts.
- modelName: The AI model to use.
- promptText: Your query that requires real-time info (e.g., "What is the weather in Tokyo today?").
5. Generate Image
Generates a brand-new image from a text description using Google's Imagen model.
- modelName: The Imagen model to use (e.g.,
imagen-3.0-generate-001).
- promptText: A highly detailed description of the image you want to create.
6. Convert Blob URL To Base64
A helpful utility function. Use this to convert local images chosen via the Construct 3 FileChooser plugin into a Base64 string before sending them to the Analyze Image action.
FAQ
Why am I getting a "Bad Request" or "400" error when using Generate Image?
Even if you have a remaining free or trial balance, Google requires an active payment profile (credit/debit card) tied to your project API key to prevent abuse.
Credits & Support