How to Create an AI Chat with Gemini in Construct 3

UpvoteUpvote 7 DownvoteDownvote

Index

Features on these Courses

Stats

1,654 visits, 1,977 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 26 Aug, 2025.

Step 1: Get Your Gemini API Key

Before you can write any code, you'll need an API key. This key acts as a unique identifier for your application, allowing Google to authenticate your requests and track usage. And the best part? You don't have to spend a dime to start experimenting. Google's free tier provides a generous number of requests per minute, which is more than enough for development and testing.

Getting the key is simple:

  1. Go to the Google AI Studio website.
  2. Click the "Get API Key" button.
  3. On the next screen, click "Create API Key".

An alphanumeric key will be generated. Important: Treat this key like a password. Never share it, commit it to a public repository, or embed it directly in client-side code. For a real application, you would use a secure server-side method to store and use the key.

  • 2 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • Good tutorial. I'm not sure how memory is normally achieved, but sending the entire chat back to the ai each prompt does not sound good. It will use an exponentially larger amount of tokens. Not sure how it will effect the free tier, but it will cost you a fortune if you have to pay.

    • Hi, thank you for the comment!

      You're right, sending the full history increases token usage. This method is necessary because models like Gemini are stateless and need that history for context. For a real application, it's vital to manage this to control costs. Common solutions include using a "sliding window" of recent messages or summarizing the chat.

      From a game design perspective, I also believe it's better to guide the AI instead of allowing completely free chat. Using structured output helps maintain creative control over the game's narrative, a topic I hope to explore soon.