Test screenshot-to-click scaling in a simple web game
A developer used Gemini with Playwright to confirm that click coordinates lined up with the browser view.
- What they did
- Guillaume Laforge connected Gemini’s computer-use preview model to Playwright in Java and ran it in headless Chromium with a 1000x1000 viewport. After each action, the agent received a fresh screenshot, then returned click targets on a normalized 1000x1000 grid; his code converted those points to the actual viewport and clicked. He also built a tiny game where a red button shifts after every click and asked the agent to hit it 10 times and read back the score.
- How it went
- The agent followed the moving button and ended with a score of 10. That confirmed the click scaling and input handling were working in this test, and no failures were reported.
- Tips
- Send a new screenshot after every action, and wait about a second before capturing so the page has fully drawn. If you skip that pause, the model may act on a blank or partially rendered screen.
Try it yourself with Gemini
Open [URL of a simple browser game] and play it by inspecting each screenshot and clicking the target element. After every click, wait for the page to update, then take a fresh screenshot before choosing the next move. Use [number] clicks total, and after each one, say whether the click matched the intended spot and whether the target moved as expected. Pause before any irreversible action and ask for approval first. When you finish, report the final score and any mismatch between the screenshot position and the actual click position.
Fill in the [brackets]. Agents can make mistakes, so review anything before it is sent, paid or deleted.
1 more report of this
Get 3 agent uses like this every morning
With the day's top AI news. Free, and one click to unsubscribe.
Related agent uses
Guide a game agent through Goat Simulator 3
SIMA 2 in Goat Simulator 3 can be nudged by a person giving live directions.
Pit three agents against a browser shooter build
Three coding agents independently built the same multiplayer shooter, letting the team compare their strengths and weak spots.
Build a text game around AI narration
A developer used Grok to narrate a choice-based game and said it handled story text better than Gemini and GPT.
Build an HTML5 browser game in small steps
A developer used Gemini to assemble a browser game, then recovered from stalled chats by restarting and reloading the code context.
Build a browser 4X game with LLM help
A developer used Grok and Gemini to assemble Hexwardia, a browser-based 4X game, in two weeks.
Use Gemini to generate a match-3 game from one prompt
A single Gemini prompt produced a working Candy Crush-style game and a share link.