Using ChatGPT/Open AI to identify solid objects in a tile-based 2D game scene
Nobody cares but I wanted to share:
Solid objects highlighted in green (should've changed the highlight color to something other than green for this game).
One thing that I've stumbled over when trying to implement an AI-driven 2D game player is that the vision capabilities are somewhat limited when using the vision right out of the box. What I've done here is break up the scene into the list of tiles, send the tiles to the AI and ask it to guess using its vision capabilities whether or not each given tile would be a solid or not-solid tile. There are a few errors, but I think it does reasonably well.
Since ChatGPT cannot really do pathfinding, I'll add a non-AI pathfinding algorithm (like A*) and give the AI possible destinations which have a valid path from the player to choose from which best suit its current objectives. When it chooses one, the non-AI program would convert the chosen path into a series of button presses to send to the game.
One downside of doing this is that it's relatively expensive from an API usage point of view. This scene has approx. 22 unique tiles in it, each of which need to be evaluated by the AI's vision. So I think I should definitely want to cache the results of these queries rather than run it every time the player moves.
Now I gotta see if I blew through my credits for the month by doing this.
Solid objects highlighted in green (should've changed the highlight color to something other than green for this game).
One thing that I've stumbled over when trying to implement an AI-driven 2D game player is that the vision capabilities are somewhat limited when using the vision right out of the box. What I've done here is break up the scene into the list of tiles, send the tiles to the AI and ask it to guess using its vision capabilities whether or not each given tile would be a solid or not-solid tile. There are a few errors, but I think it does reasonably well.
Since ChatGPT cannot really do pathfinding, I'll add a non-AI pathfinding algorithm (like A*) and give the AI possible destinations which have a valid path from the player to choose from which best suit its current objectives. When it chooses one, the non-AI program would convert the chosen path into a series of button presses to send to the game.
One downside of doing this is that it's relatively expensive from an API usage point of view. This scene has approx. 22 unique tiles in it, each of which need to be evaluated by the AI's vision. So I think I should definitely want to cache the results of these queries rather than run it every time the player moves.
Now I gotta see if I blew through my credits for the month by doing this.





