Godot 4 में AI Playtesting: Simulated Input, Screenshots और Assertions

AI Playtesting क्यों? Build → Run → Observe → Fix Loop

ज़्यादातर AI coding assistants अंधेरे में काम करते हैं। वे एक GDScript फ़ाइल लिखते हैं, शायद जाँच लेते हैं कि वह parse होती है, और आपको लौटा देते हैं। आप F5 दबाते हैं, पता चलता है कि player हिलता नहीं या game over screen कभी दिखती ही नहीं, error को chat में copy करते हैं, और यही दोहराते रहते हैं। सारी testing आप ही कर रहे होते हैं।

इंसानी developers इस तरह काम नहीं करते। वे कुछ build करते हैं, गेम run करते हैं, स्क्रीन पर असल में क्या हो रहा है उसे observe करते हैं, और जो गलत है उसे fix करते हैं। AI playtesting assistant को यही loop देता है। Code काम करता है या नहीं, इसका अंदाज़ा लगाने के बजाय वह गेम शुरू करता है, keys दबाता है, screenshots देखता है, node values पढ़ता है और error log जाँचता है — फिर code edit करके दोबारा कोशिश करता है।

Godot MCP Pro इसे संभव बनाता है। यह एक MCP server और Godot 4 editor plugin है, जो Claude Code, Cursor और Cline जैसे AI assistants को Godot editor के लिए 190 tools देता है, जिनमें input, runtime और testing tools का एक सेट शामिल है, जो Godot में ठीक इसी तरह की automated playtesting के लिए बनाया गया है।

मुख्य विचार

Static checks बताते हैं कि code compile होता है। Playtesting बताती है कि गेम काम करता है। नीचे दिए गए कई bugs साफ़-साफ़ compile हुए और कोई error नहीं दी — वे सिर्फ़ स्क्रीन पर दिखाई देते थे।

चल रहे Godot गेम में AI क्या-क्या test कर सकता है

गेम चलने के बाद AI उसके साथ लगभग आपकी तरह interact और inspect कर सकता है। Tools कुछ समूहों में बँटे हैं (नाम ठीक वैसे ही हैं जैसे Godot MCP Pro में दिखते हैं):

लक्ष्यTools
गेम शुरू और बंद करनाplay_scene, stop_scene
Player input simulate करनाsimulate_key, simulate_mouse_click, simulate_mouse_move, simulate_action, simulate_sequence
स्क्रीन पर क्या है, देखनाget_game_screenshot, capture_frames, record_frames, compare_screenshots
Live game state inspect करनाget_game_scene_tree, get_game_node_properties, batch_get_properties, monitor_properties, watch_signals
UI के साथ interact करनाfind_ui_elements, click_button_by_text, wait_for_node
अपेक्षाएँ जाँचनाassert_node_state, assert_screen_text, run_test_scenario, get_test_report
Stress और timingrun_stress_test, set_game_speed
Testing के लिए state बदलनाexecute_game_script, set_game_node_property
समस्याएँ पढ़नाget_editor_errors, get_output_log
Regression replaysstart_recording, stop_recording, replay_recording

व्यवहार में यह इस तरह के सवालों को कवर करता है: क्या arrow keys दबाने पर character हिलता है? क्या coin इकट्ठा करने पर score बढ़ता है? क्या GAME OVER text सच में दिखता है? क्या camera player को view में रखता है? क्या random input की बाढ़ आने पर भी गेम स्थिर रहता है? क्या एक मिनट खेलने के बाद log में errors हैं?

स्टेप बाय स्टेप: AI playtest कैसे काम करता है

ये tools आपको ख़ुद call नहीं करने पड़ते। आप सामान्य भाषा में बताते हैं कि क्या test करना है, और AI tools चुन लेता है। फिर भी यह जानना उपयोगी है कि अंदर क्या होता है, ताकि आप सही चीज़ें माँग सकें।

1. गेम शुरू करना

AI play_scene से main scene, current scene या कोई विशेष scene चलाता है। हर runtime tool को चलता हुआ गेम चाहिए, इसलिए यह हमेशा पहले आता है। Test पूरा होने पर stop_scene उसे बंद कर देता है।

2. Input simulate करना

एक-एक press simulate_key, simulate_mouse_click या simulate_mouse_move से होते हैं। Input Map पर बने गेम्स के लिए simulate_action सीधे कोई Godot input action, जैसे jump action, trigger करता है। एक press से लंबी किसी भी चीज़ के लिए — दाईं ओर चलना, jump, इंतज़ार, shoot — simulate_sequence input events की एक श्रृंखला भेजता है, जिनके बीच frame delays होते हैं। Menus के लिए click_button_by_text आसान है, जो pixel position के बजाय label से button click करता है।

3. जो हुआ उसे capture करना

get_game_screenshot मौजूदा frame लेता है ताकि AI उसे देख सके। अक्सर एक frame काफ़ी नहीं होता — animation, fade या गिरती हुई ball समय के साथ होती है — इसलिए capture_frames multi-frame capture लेता है, और record_frames कई frames को disk पर PNG फ़ाइलों में लिखता है। तस्वीरों के साथ-साथ monitor_properties समय के साथ property values (कोई position, कोई health value) record करता है, और watch_signals log करता है कि कौन-से signals fire हुए।

4. अपेक्षित state assert करना

Screenshot देखना उपयोगी है, लेकिन सटीक जाँच उससे बेहतर है। assert_node_state चल रहे गेम में node property values जाँचता है, और assert_screen_text जाँचता है कि कोई दिया गया text स्क्रीन पर है — उदाहरण के लिए, player के मरने के बाद “GAME OVER” label मौजूद है। run_test_scenario एक automated test scenario चलाता है, और get_test_report pass/fail नतीजे लौटाता है।

5. Errors पढ़ना

आख़िर में, get_editor_errors errors और stack traces लौटाता है, और get_output_log Output panel लौटाता है। कई runtime समस्याएँ — null instance, गायब node path, engine warning — गेम को असल में खेलने के बाद ही यहाँ दिखती हैं।

6. Fix करना और दोहराना

सबूत हाथ में आने पर AI script या scene edit करता है और check pass होने तक loop फिर से चलाता है। यही वह हिस्सा है जो आपका समय बचाता है: assistant आपको लौटाने से पहले अपना काम ख़ुद test करता है।

उदाहरण prompts जो आप अपने AI को दे सकते हैं

ये Godot MCP Pro से जुड़े AI assistant के लिए लिखे गए हैं। सामान्य भाषा काफ़ी है; tool का नाम लेना वैकल्पिक है लेकिन मदद कर सकता है। (नीचे prompts मूल अंग्रेज़ी में दिए गए हैं; आप उन्हें हिंदी में भी लिख सकते हैं।)

Prompt — बुनियादी movement जाँच
Run the game, hold the right arrow for about two seconds, then press jump.
Take a screenshot before and after, and check that the player's position
actually changed. If it didn't, find out why and fix it.
Prompt — game over flow
Playtest the game until the player dies (don't press anything if that's
the fastest way). Use assert_screen_text to confirm "GAME OVER" is visible,
take a screenshot to make sure it's readable, then click "Restart" and
confirm the score resets to 0.
Prompt — समय के साथ visual review
Start the level and capture frames while the ball rolls off the first ledge.
Check that the camera keeps the ball in view the whole time, and that
nothing important is cut off at the edges of the window.
Prompt — stability और errors
Run a stress test with random input for a while, then read the editor
errors and output log. List every error or warning with its script and
line, and fix the ones caused by our code.
Prompt — late-game state पर सीधे जाना
Use execute_game_script to give the player 9999 coins and open the shop.
Buy every upgrade, then check with assert_node_state that the player's
stats changed as expected.
टिप: सबूत माँगें

अपने prompt के अंत में “show me the screenshot” (मुझे screenshot दिखाओ) या “tell me which assertion failed” (बताओ कौन-सा assertion fail हुआ) जोड़ें। इससे AI ईमानदार रहता है और आपको review करने के लिए कुछ ठोस मिलता है।

Playtesting से AI द्वारा पकड़े गए असली bugs

हमारे showcase का हर गेम Claude Code ने Godot MCP Pro के ज़रिए सादे अंग्रेज़ी prompts से बनाया है। हर build के दौरान AI ने गेम चलाया, input simulate किया और screenshots लिए — और ऐसे bugs पकड़े जिनकी ओर किसी इंसान ने इशारा नहीं किया था। यहाँ उनमें से कुछ हैं।

अदृश्य GAME OVER banner (tower defense)

Pop Tower Defense में GAME OVER banner अदृश्य था, क्योंकि उसका pop-in animation उसे बहुत ज़्यादा बड़ा scale कर देता था। ऐसा bug कोई error नहीं देता — वह सिर्फ़ स्क्रीन देखने पर दिखता है। इसी build में एक game window भी पकड़ी गई जो दाहिना किनारा काट रही थी, जिसे AI ने stretch mode सेट करके ठीक किया।

एक hero जो हिलता ही नहीं था (platformer)

Pop Jump में hero simulated input से नहीं हिल रहा था, इसलिए AI ने controls को फिर से bind किया। Playtesting में यह भी पकड़ा गया कि controls hint window दिखने से पहले ही fade हो जाता था, एक win message अब भी चल रहे tween की वजह से आधा fade हुआ रहता था, और जीतने के बाद आप level के अंत से बाहर चल सकते थे। इसी तरह की input-binding समस्या Pop Survivors में भी मिली, जहाँ bindings simulated keys पर प्रतिक्रिया नहीं दे रही थीं।

Ball को खो देने वाला camera (3D ball roller)

Pop Roller में गिरने के बाद camera ball को खो देता था; अब वह वापस snap हो जाता है। AI ने फीके रंग भी नोटिस किए और tonemapping, glow और saturation को फिर से tune किया, goal के पीछे एक दीवार जोड़ी क्योंकि ball अंत से लुढ़ककर गिर सकती थी, और gem pop animation से आने वाली एक engine warning हटाई।

स्क्रीन से बाहर खिसकते score popups (match-3)

Pop Match! में सबसे ऊपर वाली row के matches से निकलने वाले score popups स्क्रीन के ऊपर से बाहर खिसक जाते थे — एक layout bug जो तभी दिखता है जब match ठीक सही जगह पर हो।

Balance और timing bugs (survivors-like, bullet hell)

Pop Survivors का पहला playtest 14 सेकंड में game over पर ख़त्म हुआ, इसलिए AI ने difficulty को फिर से balance किया। Pop Bullet Hell में GAME OVER banner एक fade होते wave banner के पीछे छिपा रहता था, boss के बाद का victory banner तुरंत बदल जाता था, और enemies player की lane में बह आते थे, जब तक AI ने उन्हें मुड़कर दूर जाने वाला नहीं बनाया। लंबे Pop Survivors PLUS build में उसने पकड़ा कि boss स्क्रीन से बाहर रहते हुए ही attacks fire कर रहा था, एक swarm wave victory वाले frame पर ही fire हो रही थी, और victory screen पर hero की टोपी “WIN” अक्षरों को ढक रही थी।

पैटर्न

इनमें से लगभग कोई भी compile check में नहीं दिखता। ये visual, timing और input bugs हैं — वही जो आम तौर पर खेलकर ही मिलते हैं। यहीं AI playtesting का फ़ायदा मिलता है।

सीमाएँ: AI playtesting क्या नहीं कर सकता

AI playtesting एक मज़बूत functional QA tool है, इंसानी players का विकल्प नहीं। यह क्या कवर करता है, इस बारे में यथार्थवादी रहें:

  • यह मज़ा नहीं आँक सकता। AI पुष्टि कर सकता है कि jump काम करता है और enemy मर जाता है। Jump महसूस करने में अच्छा है या नहीं, difficulty curve संतोषजनक है या नहीं, या गेम खेलने लायक है या नहीं, यह इंसान का फ़ैसला है। Game feel और design के लिए अब भी आपकी ज़रूरत है।
  • यह धीरे खेलता है। हर observe step एक tool call है, इसलिए AI इंसानी player की तरह frame-दर-frame प्रतिक्रिया नहीं देता। Precision platforming या लंबी boss fight सिर्फ़ simulated input के लिए उपयुक्त नहीं हैं।
  • Late-game content के लिए shortcuts चाहिए। Simulated input से level 20 तक पहुँचना व्यावहारिक नहीं है। AI को debug shortcuts दें — कोई key जो level skip करे या items दे — या उसे execute_game_script या set_game_node_property से सीधे state सेट करने दें। set_game_speed समय को fast-forward कर सकता है।
  • यह सिर्फ़ वही जाँचता है जो जाँचने को कहा जाए। स्पष्ट लक्ष्य (“restart के बाद score 0 पर reset होना चाहिए”) “सब कुछ test करो” से बेहतर tests बनाते हैं।
  • Screenshots की व्याख्या की जाती है, वे pixel-perfect नहीं होते। सटीक जाँच के लिए assert_node_state और assert_screen_text, या किसी known-good image के मुक़ाबले compare_screenshots को प्राथमिकता दें।

Regression testing के लिए start_recording और stop_recording से एक बार play session record करें, फिर हर बदलाव के बाद AI से replay_recording करवाएँ। अगर आपके प्रोजेक्ट में पहले से test suite है, तो run_headless_scene किसी scene को अलग headless Godot process में चला सकता है।

FAQ

क्या AI सच में Godot गेम का playtest कर सकता है?

हाँ, functional checks के लिए। Godot MCP Pro के साथ AI assistant गेम शुरू कर सकता है, keyboard, mouse और input actions simulate कर सकता है, screenshots capture कर सकता है, node properties पढ़ सकता है, अपेक्षित state assert कर सकता है और error log पढ़ सकता है। गेम मज़ेदार है या नहीं, यह वह तय नहीं कर सकता; उसके लिए अब भी इंसान की ज़रूरत है।

क्या मुझे test framework चाहिए?

नहीं। AI, Godot editor plugin के ज़रिए चल रहे गेम को नियंत्रित करता है, इसलिए आपको पहले test scripts लिखने की ज़रूरत नहीं है। अगर आपके प्रोजेक्ट में पहले से test suite है, तो AI run_headless_scene से किसी scene को अलग headless Godot process में भी चला सकता है।

इसके साथ कौन-से AI assistants काम करते हैं?

कोई भी MCP-compatible client, जैसे Claude Code, Claude Desktop, Cursor, Cline के साथ VS Code, Windsurf और अन्य। Godot MCP Pro, Windows, macOS और Linux पर Godot 4.4 या उसके बाद के versions को support करता है।

इसकी लागत कितनी है?

कुछ AI playtesting tools मासिक subscription के रूप में बिल किए जाते हैं। Godot MCP Pro एक बार की $15 खरीद है, जिसमें lifetime updates, असीमित प्रोजेक्ट्स और असीमित machines शामिल हैं — कोई subscription नहीं। आप इसे अपने ही AI assistant के साथ इस्तेमाल करते हैं।

AI late-game content तक कैसे पहुँचता है?

उसे shortcuts दें: levels skip करने या items देने वाली debug keys, या उसे execute_game_script या set_game_node_property से सीधे state सेट करने दें। set_game_speed से गेम को fast-forward भी किया जा सकता है।

अपने AI से अपने Godot गेम का playtest करवाएँ

Godot MCP Pro, Claude Code, Cursor, Cline और अन्य AI assistants को Godot editor के लिए 190 tools देता है — जिनमें वे input, runtime और testing tools भी शामिल हैं जिनसे इस पेज के हर bug fix हुए। एक बार की खरीद, lifetime updates।

play_scene simulate_sequence get_game_screenshot capture_frames assert_node_state assert_screen_text get_editor_errors
Godot MCP Pro पाएँ — $15

pricing की पूरी जानकारी देखें · AI को गेम बनाते देखें