Hello fellow developers, Hope you are all having a great day!
I recently made a quiz game where you
Input the questions in yourself (objective/subjective)
Create a game (with all the questions)
Players can play your game by joining your lobby
and now what i want to achieve is:
Making AI generate its own questions regarding a certain topic that the player inputted.
There will be an answer to every question. It can be objective/subjective questions too
If objective then my system will auto mark the questions (i alr coded this in)
If subjective then AI would mark the questions (right now only the host can mark the questions)
Example: Generate 15 questions regarding the preservance of wildlife species
I have no idea how to achieve this so im asking for help. I wasn’t entirely sure if i had to code my own neural network into it or incorporating GPT-5 into my game.
First and foremost, using AI means you will have to watch for player base usage, I believe running off a free key should work for most services unless your game really pops off.
You can request & incorporate any form of 3rd Party AI service out there, like OpenAI
You will simply:
Take the player’s input for the topic, send it over to the AI
Have a structure initial prompt ready, this tells the AI how it should reply. In your case it would be the 15 questions & their objective answers, like so:
{"Question1": {"Q": "XYZ", "A": "ABC"}, ...}
You will then parse that response in your own game, then do the rest.
As for subjective questions, you can send each player’s response to the AI and let it handle correction with a simple boolean response.
You could look into the TextGeneration API which has a really simple API, though as far as I’m aware it’s not out yet.
Alternatively, Using HttpService to make requests to an AI is the only other option. You could either use/create a proxy or even better, the new WebSockets feature which allows live streaming so you can easily get each letter as the AI generates it.
For my replica of ChatGPT, I made my own proxy and got it working in a day. And for OpenAI at least, you have to buy credits to get tokens to be able to send requests..