Game Center से online खेल के लिए players मिलाएँ
किसी एजेंट को बताएँ कि आपके गेम के players को online कैसे मिलाया जाए। वह Game Center matchmaking queue और rules सेट करता है, उन्हें काल्पनिक players से test करता है, और गेम को उनसे जोड़ता है।
जब कोई player online गेम शुरू करता है, तो Game Center उसके लिए दूसरे players ढूँढता है। matchmaking rules से आप तय कर सकते हैं कि कौन किसके साथ खेले, जैसे वे players जिन्होंने एक ही mode चुना हो या जिनकी skill मिलती-जुलती हो। Apple का GameKit लेख setup समझाता है। rules एक rule set में रखे जाते हैं और rule set एक queue से जुड़ा होता है। match माँगते समय गेम उस queue का नाम देता है, और Game Center rules से सबसे अच्छे matches ढूँढता है। लेख यह real-time games के लिए बताता है, जिनमें players एक ही समय पर खेलते हैं। देखें Finding players using matchmaking rules ↗।
rules ज़रूरी नहीं हैं। backward compatibility पर Apple का लेख कहता है कि जो match requests किसी queue का नाम नहीं देतीं, वे एक default queue में जाती हैं, जिसे Apple classic matchmaking कहता है। rules की ज़रूरत तभी है जब आप तय करना चाहें कि कौन किसके साथ खेले।
शुरू करने से पहले
- गेम का अपना code Game Center matchmaking इस्तेमाल करे। queue और उसके rules तब तक कुछ नहीं करते जब तक गेम उसे match requests न भेजे।
- गेम में Game Center चालू हो, App Store Connect record हो और आपका Apple Developer अकाउंट हो। देखें Game Center leaderboards और achievements जोड़ें। free Apple ID से sign किए गए install में Game Center नहीं होता, इसलिए उसमें online खेल काम नहीं करेगा।
अगर आपके गेम में अभी online खेल नहीं है, तो पहले अपने एजेंट से उसे जोड़ने को कहें, जैसे:
Add online races against up to 3 other players, using Game Center matchmaking to find them.बताएँ कि players कैसे मिलाए जाएँ
प्रोजेक्ट की चैट में बताएँ कि कितने लोग साथ खेलते हैं और क्या तय करता है कि कौन किसके साथ खेले, जैसे:
Set up Game Center matchmaking for Fox Run: 2 to 4 players per race. Only match players who picked the same track, and put players with similar best scores together. If someone waits more than 20 seconds, allow a bigger score gap.rules सिर्फ़ वही इस्तेमाल कर सकते हैं जो गेम हर match request के साथ भेजता है। ऐसी चीज़ें बताएँ जो गेम जानता है, जैसे player का चुना हुआ mode, track या level, या कोई score जो वह रखता है।
- एजेंट
asc game-center matchmaking rule-sets createसे एक rule set बनाता है, जिसमें हर match के कम से कम और ज़्यादा से ज़्यादा players होते हैं। - आपने जो बताया, उसे वह
asc game-center matchmaking rules createसे rules में बदलता है। हर rule का एक प्रकार होता है, नीचे की table से, और एक expression जिसे Game Center match requests पर जाँचता है। - अगर players teams में खेलते हैं, तो वह
asc game-center matchmaking teams createसे teams जोड़ता है, हर एक के कम से कम और ज़्यादा से ज़्यादा players के साथ। - वह
asc game-center matchmaking queues createसे rule set के लिए queue बनाता है। गेम का code queue को उसके reference name से ढूँढता है। - वह काल्पनिक players से rules test करता है। नीचे “Rules test करें” देखें।
- वह गेम का code बदलता है ताकि हर match request queue का नाम दे और वह भेजे जो rules जाँचते हैं, जैसे track और best score।
- वह चैट में बताता है कि उसने क्या बनाया। इसे कभी भी फिर देखने के लिए, पूछें “गेम में कौन-सी matchmaking queues और rules हैं?”। एजेंट उन्हें
asc game-center matchmaking queues listऔरasc game-center matchmaking rules listसे पढ़ता है।
Apple queue और rule set के ऐसे नाम माँगता है जो आपके organization में unique हों, जैसे com.example.mygame.GameSettingsQueue। asc queues और rule sets पूरी Apple team के लिए दिखाता है, एक गेम के लिए नहीं, इसलिए गेम के नाम वाले नाम उन्हें अलग रखते हैं।
Rules के प्रकार
Apple का Matchmaking rules ↗ लेख चार प्रकार बताता है। Game Center उन्हें इस क्रम में लागू करता है:
| प्रकार | यह क्या जाँचता है | Apple का उदाहरण |
|---|---|---|
COMPATIBLE |
दो match requests साथ खेल सकती हैं या नहीं: हाँ या नहीं। | गेम का version 2.0 या उसके बाद का है। |
DISTANCE |
दो requests कितनी मिलती-जुलती हैं, 0.0 (सबसे ज़्यादा मिलती) से 1.0 (सबसे कम मिलती) तक। सबसे ज़्यादा मिलती-जुलती पहले साथ रखी जाती हैं। | players के बीच कम network delay। |
MATCH |
संभावित match की अनुमति है या नहीं: हाँ या नहीं। | 0 और 5 के बीच skill range। |
TEAM |
संभावित match की teams कोई शर्त पूरी करती हैं या नहीं: हाँ या नहीं। | teams के बीच कुल skill का अंतर 1 से कम। |
players जितना ज़्यादा इंतज़ार करें, rule को उतना ढीला करने के लिए एजेंट उसे ऐसे MATCH rule के रूप में लिखता है जिसकी value इस पर बदलती है कि request कितनी देर से इंतज़ार कर रही है। Apple का Finding players using matchmaking rules ↗ बताता है कि कैसे।
क्या तय करें
अगर आपकी कोई पसंद है, तो इन्हें अपने अनुरोध में बताएँ।
| विकल्प | यह क्या है |
|---|---|
| हर match में players | कम से कम और ज़्यादा से ज़्यादा। Apple का लेख कहता है कि Game Center पहले सबसे ज़्यादा players वाले matches ढूँढता है। |
| कौन किसके साथ खेले | एक match के players के लिए क्या एक जैसा, या क़रीब, होना चाहिए। |
| इंतज़ार | player जितना ज़्यादा इंतज़ार करे, rules ढीले होते हैं या नहीं, और कितनी देर बाद। |
| Teams | कितनी teams, और हर team में कम से कम और ज़्यादा से ज़्यादा players। |
Rules test करें
players के rules इस्तेमाल करने से पहले, एजेंट से उन्हें आज़माने को कहें, जैसे:
Test the matchmaking rules with six made-up players: four on the forest track with close scores, and two on the desert track.एजेंट काल्पनिक match requests एक फ़ाइल में लिखता है और asc game-center matchmaking rule-set-tests create --file चलाता है। Apple का API reference कहता है कि rule set test, rule set को sample match requests पर लागू करता है। देखें Test a Rule Set ↗। जवाब दिखाता है कि कौन-सी requests साथ रखी गईं, और किस team में। एजेंट बताता है कि यह वैसा ही है या नहीं जैसा आपने बताया था।
असली match आज़माने के लिए:
- अपने एजेंट से बदलाव वाला build upload करवाएँ। देखें TestFlight से बीटा शेयर करें।
- उसे TestFlight से किसी ऐसे डिवाइस पर install करें जिस पर आपका गेम चलता है, जैसे iPhone, iPad या Mac, और इतने testers invite करें कि हर match के कम से कम players पूरे हो जाएँ। देखें TestFlight से बीटा शेयर करें।
- लगभग एक ही समय पर online खेल शुरू करें, हर कोई Game Center में sign in हो।
अगर players उस तरह साथ नहीं रखे जाते जैसी आपको उम्मीद थी, तो एजेंट को बताएँ कि किसने खेला, हर एक ने क्या चुना, और क्या हुआ।
Ship करें
- queue, rule set और rules App Review में नहीं जाते। वे उन items में नहीं हैं जिन्हें
asc review items addsubmission में डाल सकता है। Apple का लेख rules को Game Center server पर upload करने के बारे में बताता है। - गेम का वह code जो इन्हें इस्तेमाल करता है, नए version के साथ players तक पहुँचता है। देखें अपने ऐप का अपडेट ship करें। अगर यह Game Center के साथ गेम का पहला अपडेट है, तो version में भी Game Center चालू होना चाहिए: देखें Game Center leaderboards और achievements जोड़ें।
देखें matching कैसी चल रही है
उदाहरण के लिए पूछें:
How many match requests found a match this week, and how many gave up or expired?एजेंट asc game-center matchmaking metrics queue-requests इस्तेमाल करता है, जो queue की requests को नतीजे के हिसाब से गिनता है: MATCHED, CANCELED या EXPIRED। किसी एक rule के लिए, वह asc game-center matchmaking metrics rule-errors जैसे rule metrics ला सकता है। अगर बहुत सी requests expire होती हैं, तो आप एजेंट से rules ढीले करने को कह सकते हैं।
Rules बदलें या हटाएँ
बताएँ कि क्या बदलना है। एजेंट इस्तेमाल करता है:
| इसके लिए | Command |
|---|---|
| हर match के कम से कम या ज़्यादा से ज़्यादा players बदलें | asc game-center matchmaking rule-sets update |
| कोई rule क्या जाँचता है, या उसका विवरण बदलें | asc game-center matchmaking rules update |
| कोई rule जोड़ें या हटाएँ | asc game-center matchmaking rules create या delete |
| किसी team में कितने players हैं, यह बदलें | asc game-center matchmaking teams update |
| queue के लिए दूसरा rule set इस्तेमाल करें | asc game-center matchmaking queues update --rule-set-id |
rules updateकिसी rule का प्रकार नहीं बदल सकता। उसके लिए एजेंट rule मिटाकर नया बनाता है।ascकिसी queue का नाम नहीं बदल सकता, और गेम का code queue का नाम इस्तेमाल करता है।- जो rule कुछ नया जाँचता है, वह तभी काम करता है जब गेम उसे भेजे, जिसके लिए गेम का नया version चाहिए।
- queue, rule set, rule या team मिटाने के लिए
--confirmचाहिए, इसलिए एजेंट पहले आपसे पूछता है।ascमें मिटाई गई चीज़ वापस लाने का कोई command नहीं है।
सवाल
मैंने rules सेट किए, लेकिन players उनके हिसाब से नहीं मिलाए जाते।
क्या गेम के अलग-अलग versions वाले players साथ खेल सकते हैं?
asc इसे दिखा सकता है (asc game-center app-versions compatibility list) लेकिन सेट नहीं कर सकता। Apple का Add multiplayer compatibility ↗ देखें।मेरे गेम में पहले से बिना rules के online खेल था। क्या पुराने और नए versions आपस में खेल सकते हैं?
asc game-center matchmaking queues update --classic-bundle-ids से जोड़ने को कहें। Apple का Creating matchmaking rules for backward compatibility ↗ देखें।