AI players?
-
Would it be possible to make AI players in games like my Star Trek?
-
@mathew139616-10db496a Yes, if you want them to not just be hard coded you wouldn’t be able to because the neural networks in the editor require set data tables, so you can’t really train them with manual inputs and reward them accordingly
-
@mathew139616-10db496a Tyller is right but here are some other solutions:
- you could also use the ChatGPT blocks. Those can take a couple seconds though, and more processing power, so maybe not the best idea considering your game would be fast paced and you wouldn’t want to have to wait for the AI to give a response and then move or do whatever. This could work for a Pokemon-like or turn based fighting game though, where you make your move, the enemy gets hurt, and then you have to wait for them to choose their move.
(with the method I was explaining) You may be wondering how would you just casually “get ChatGPT to move your NPC or an enemy”, and the thing is you can’t. But the thing is you could use them to make an “AI player” by making it give a sort of “code” as it’s response and then you’d make it move or do an action based on what code it gave. You would start off by giving the ChatGPT block a prompt like this:
“You are controlling an AI enemy in my game. The player is moving towards you and shooting you. What are you going to do? Pick one of these options and respond with the corresponding letter in parentheses (for example, if you wanted to shoot the player, then respond with “s” and that only): shoot the player (s), dodge the player’s bullets (b), shoot the player with rockets (x), or enable the shield (e).”
And then using if else blocks, you would check if ChatGPT’s result is either s, b, x, or e, and then making the “AI player” do different things based on what letter ChatGPT responded with.
Also you would want to tell ChatGPT every time the player is doing something important or slightly significant, like if the player is moving closer to the AI, rotating around, shooting it, etc.
And after that, you would continue the same chat so that it doesn’t forget what the player is doing and what it did as a response. This is also so that you can allow ChatGPT to be strategic, because so that it can realize patterns in what the player is doing and then adapt to it and respond with any of those letters.And that is how you’d basically utilize ChatGPT to control an AI character. It’s a bit complicated but it just would take a bit of blocks as well. But that’s better than having to reinvent the wheel and hardcode an algorithm that watches everything the player does and reacts to it (because there are a lot of possible things, so you’d have like a million if/else blocks!).
If you want help making what I just said, I’m happy to make code for your specific case!
-
That would help! Thank you!
-
@mathew139616-10db496a tell me if you want help coding something like that
-
Ok, thank you! Also, how do you upvote a post?
-
@mathew139616-10db496a press the up arrow right near where it says “Quote”
-
@jeffreyrb03-gmail said in AI players?:
@mathew139616-10db496a Tyller is right but here are some other solutions:
- you could also use the ChatGPT blocks. Those can take a couple seconds though, and more processing power, so maybe not the best idea considering your game would be fast paced and you wouldn’t want to have to wait for the AI to give a response and then move or do whatever. This could work for a Pokemon-like or turn based fighting game though, where you make your move, the enemy gets hurt, and then you have to wait for them to choose their move.
(with the method I was explaining) You may be wondering how would you just casually “get ChatGPT to move your NPC or an enemy”, and the thing is you can’t. But the thing is you could use them to make an “AI player” by making it give a sort of “code” as it’s response and then you’d make it move or do an action based on what code it gave. You would start off by giving the ChatGPT block a prompt like this:
“You are controlling an AI enemy in my game. The player is moving towards you and shooting you. What are you going to do? Pick one of these options and respond with the corresponding letter in parentheses (for example, if you wanted to shoot the player, then respond with “s” and that only): shoot the player (s), dodge the player’s bullets (b), shoot the player with rockets (x), or enable the shield (e).”
And then using if else blocks, you would check if ChatGPT’s result is either s, b, x, or e, and then making the “AI player” do different things based on what letter ChatGPT responded with.
Also you would want to tell ChatGPT every time the player is doing something important or slightly significant, like if the player is moving closer to the AI, rotating around, shooting it, etc.
And after that, you would continue the same chat so that it doesn’t forget what the player is doing and what it did as a response. This is also so that you can allow ChatGPT to be strategic, because so that it can realize patterns in what the player is doing and then adapt to it and respond with any of those letters.And that is how you’d basically utilize ChatGPT to control an AI character. It’s a bit complicated but it just would take a bit of blocks as well. But that’s better than having to reinvent the wheel and hardcode an algorithm that watches everything the player does and reacts to it (because there are a lot of possible things, so you’d have like a million if/else blocks!).
If you want help making what I just said, I’m happy to make code for your specific case!
Thanks for the input. However, I’d like to add that this may run into context window limit issue, since, as you explained, each iteration is a continuation of the previous chats, so it makes the chat history longer and longer, and soon this will run into the limit of context window. It will also cost a lot of money, though that is currently fully paid for by CreatiCode. Another potential issue is the respond speed, since it may take too long for ChatGPT’s response to come back to make the AI player take an action. Therefore, most of such AI players are still better controlled by more traditional rule-based logic than ChatGPT.
We would recommend using ChatGPT for strategy games that require the AI talk to the human players, such as this game:
https://www.forum.creaticode.com/topic/961/chatgpt-ai-who-s-the-spy-difficulty-3
-
@info-creaticode that is very true, I did say though that it would take longer and more computing power but I didn’t even think of the costs, which is very important as well.