<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Learn GS2 by building an adventure game on Game Server Services | Docs</title><link>/en/get_start/adventure/</link><description>Recent content in Learn GS2 by building an adventure game on Game Server Services | Docs</description><generator>Hugo</generator><language>en</language><atom:link href="/en/get_start/adventure/index.xml" rel="self" type="application/rss+xml"/><item><title>Prepare your development environment</title><link>/en/get_start/adventure/start/setup/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/en/get_start/adventure/start/setup/</guid><description>&lt;p&gt;Prepare a GS2 tutorial project and an empty Unity scene. The GS2 account created here is a developer account for managing game settings.&lt;/p&gt;&#10;&lt;p&gt;Screenshots show the Japanese interface. The steps below use English interface labels.&lt;/p&gt;&#10;&lt;h2 id="1-register-with-gs2"&gt;1. Register with GS2&lt;a class="td-heading-self-link" href="#1-register-with-gs2" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Register a developer account on the &lt;a href="https://gs2.io" target="_blank" rel="noopener"&gt;GS2 website (new tab)&lt;/a&gt;. Verify your email address using the link you receive, then log in to the &lt;a href="https://app.gs2.io" target="_blank" rel="noopener"&gt;management console (new tab)&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h2 id="2-create-a-tutorial-project"&gt;2. Create a tutorial project&lt;a class="td-heading-self-link" href="#2-create-a-tutorial-project" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;&#10;&lt;li&gt;Open &lt;strong&gt;Project → Project list → Create project&lt;/strong&gt;.&lt;/li&gt;&#10;&lt;li&gt;Enter &lt;code&gt;adventure&lt;/code&gt; as the name and “Adventure game practice” as the description.&lt;/li&gt;&#10;&lt;li&gt;Select &lt;strong&gt;Tokyo&lt;/strong&gt; as the first region to enable. The tutorial code also connects to Tokyo (&lt;code&gt;ap-northeast-1&lt;/code&gt;).&lt;/li&gt;&#10;&lt;li&gt;Review the plan and other details, then click &lt;strong&gt;Create&lt;/strong&gt;.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;&lt;img src="/images/adventure/create-project.png" alt="Project creation screen: name at the top left and initial region on the left"&gt;&lt;/p&gt;</description></item><item><title>1. Create an account and log in</title><link>/en/get_start/adventure/lessons/01-login/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/en/get_start/adventure/lessons/01-login/</guid><description>&lt;p&gt;Start by making it possible to log in to the game. Display the logged-in player’s ID, and make sure you can return to the same account after stopping Play Mode in Unity.&lt;/p&gt;&#10;&lt;p&gt;On the first run, create an account and save its player ID and password. On later runs, log in with those saved credentials. The access token returned after login expires, so log in again each time the app starts.&lt;/p&gt;</description></item><item><title>2. Add a quest and display the quest list</title><link>/en/get_start/adventure/lessons/02-quests/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/en/get_start/adventure/lessons/02-quests/</guid><description>&lt;p&gt;Now that login works, let’s add a list of adventures. Your first adventure will be &lt;strong&gt;Forest exploration&lt;/strong&gt;. GS2 calls these adventures &lt;em&gt;quests&lt;/em&gt; and organizes them into quest groups. Register this one as &lt;code&gt;forest&lt;/code&gt; in the &lt;code&gt;main&lt;/code&gt; quest group, then display its name in the game.&lt;/p&gt;&#10;&lt;h2 id="prepare-the-game-settings"&gt;Prepare the game settings&lt;a class="td-heading-self-link" href="#prepare-the-game-settings" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Settings that you define, such as quest names and rewards, are called &lt;em&gt;master data&lt;/em&gt;. A player’s coin balance and current quest progress are &lt;em&gt;user data&lt;/em&gt;. Start by creating the master data for the quest list.&lt;/p&gt;</description></item><item><title>3. Start a quest and receive rewards</title><link>/en/get_start/adventure/lessons/03-rewards/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/en/get_start/adventure/lessons/03-rewards/</guid><description>&lt;p&gt;Let’s make &lt;strong&gt;Forest exploration&lt;/strong&gt; playable. Click &lt;strong&gt;Start&lt;/strong&gt; to begin and &lt;strong&gt;Complete&lt;/strong&gt; to return with 10 coins. Every clear gives the same reward; this chapter does not add a first-clear bonus.&lt;/p&gt;&#10;&lt;h2 id="configure-clear-rewards-in-gs2"&gt;Configure clear rewards in GS2&lt;a class="td-heading-self-link" href="#configure-clear-rewards-in-gs2" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Set the reward amount in the GS2 quest settings. With a normal clear reward of 10 free coins, GS2 adds the coins when Unity reports a clear. Unity updates the display when the balance changes.&lt;/p&gt;</description></item><item><title>4. Restart and continue playing</title><link>/en/get_start/adventure/lessons/04-resume/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/en/get_start/adventure/lessons/04-resume/</guid><description>&lt;p&gt;Restart the game you built through chapter 3 to check that your coins and active quest are still there. This chapter needs no code or server-setting changes.&lt;/p&gt;&#10;&lt;h2 id="check-that-your-coins-are-saved"&gt;Check that your coins are saved&lt;a class="td-heading-self-link" href="#check-that-your-coins-are-saved" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;&#10;&lt;li&gt;Clear a quest and collect at least 10 coins. Once the reward appears, note the player ID and coin balance.&lt;/li&gt;&#10;&lt;li&gt;Stop and restart Play Mode. Studio logs in automatically; with the SDK, click &lt;strong&gt;Log in&lt;/strong&gt;. Use this login method each time you restart during this chapter.&lt;/li&gt;&#10;&lt;li&gt;Compare the player ID and balance with the values you noted. They should match, with no quest in progress.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;Coins and quest progress are stored in GS2. In chapter 1, you saved the credentials for the same account on the device. On restart, the game logs in with that account, and chapter 3’s display code fetches its data from GS2.&lt;/p&gt;</description></item><item><title>5. Spend stamina when starting a quest</title><link>/en/get_start/adventure/lessons/05-stamina/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/en/get_start/adventure/lessons/05-stamina/</guid><description>&lt;p&gt;Let’s make quests cost stamina. Starting Forest exploration costs 5; if you have less, you must wait for it to recover.&lt;/p&gt;&#10;&lt;h2 id="before-you-start"&gt;Before you start&lt;a class="td-heading-self-link" href="#before-you-start" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Complete any active quest before adding the stamina settings.&lt;/p&gt;&#10;&lt;h2 id="settings-to-add"&gt;Settings to add&lt;a class="td-heading-self-link" href="#settings-to-add" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Name the stamina setting &lt;code&gt;stamina&lt;/code&gt;. Both its initial value and normal recovery limit are 20. Spent stamina recovers naturally by 1 every 300 seconds.&lt;/p&gt;&#10;&lt;h2 id="steps"&gt;Steps&lt;a class="td-heading-self-link" href="#steps" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&#10;&#10;&#10;&#10;&#10;&lt;ul class="nav nav-tabs" id="tabs-0" role="tablist"&gt;&#10; &lt;li class="nav-item"&gt;&#10; &lt;button class="nav-link active"&#10; id="tabs-00-00-tab" data-bs-toggle="tab" data-bs-target="#tabs-00-00" role="tab"&#10; data-td-tp-persist="studio" aria-controls="tabs-00-00" aria-selected="true"&gt;&#10; Studio&#10; &lt;/button&gt;&#10; &lt;/li&gt;&lt;li class="nav-item"&gt;&#10; &lt;button class="nav-link"&#10; id="tabs-00-01-tab" data-bs-toggle="tab" data-bs-target="#tabs-00-01" role="tab"&#10; data-td-tp-persist="sdk (unity)" aria-controls="tabs-00-01" aria-selected="false"&gt;&#10; SDK (Unity)&#10; &lt;/button&gt;&#10; &lt;/li&gt;&#10;&lt;/ul&gt;&#10;&#10;&lt;div class="tab-content" id="tabs-0-content"&gt;&#10; &lt;div class="tab-body tab-pane fade show active"&#10; id="tabs-00-00" role="tabpanel" aria-labelled-by="tabs-00-00-tab" tabindex="0"&gt;&#10; &lt;h3 id="create-the-stamina-table"&gt;Create the stamina table&lt;a class="td-heading-self-link" href="#create-the-stamina-table" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Add &lt;strong&gt;Stamina&lt;/strong&gt; under &lt;strong&gt;Add features&lt;/strong&gt;, then create the following row in &lt;strong&gt;Tables → Stamina (Energy)&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>6. Restore stamina with coins</title><link>/en/get_start/adventure/lessons/06-shop/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/en/get_start/adventure/lessons/06-shop/</guid><description>&lt;p&gt;Let’s spend the coins earned from quests. Create a product named &lt;code&gt;refill&lt;/code&gt; that restores 10 stamina for 20 coins. Players can buy it with the free coins received as quest rewards.&lt;/p&gt;&#10;&lt;h2 id="process-payment-and-recovery-together"&gt;Process payment and recovery together&lt;a class="td-heading-self-link" href="#process-payment-and-recovery-together" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Combine the coin payment and stamina recovery into one transaction. If the player has too few coins, the purchase must fail without restoring stamina.&lt;/p&gt;&#10;&lt;h2 id="steps"&gt;Steps&lt;a class="td-heading-self-link" href="#steps" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&#10;&#10;&#10;&#10;&#10;&lt;ul class="nav nav-tabs" id="tabs-0" role="tablist"&gt;&#10; &lt;li class="nav-item"&gt;&#10; &lt;button class="nav-link active"&#10; id="tabs-00-00-tab" data-bs-toggle="tab" data-bs-target="#tabs-00-00" role="tab"&#10; data-td-tp-persist="studio" aria-controls="tabs-00-00" aria-selected="true"&gt;&#10; Studio&#10; &lt;/button&gt;&#10; &lt;/li&gt;&lt;li class="nav-item"&gt;&#10; &lt;button class="nav-link"&#10; id="tabs-00-01-tab" data-bs-toggle="tab" data-bs-target="#tabs-00-01" role="tab"&#10; data-td-tp-persist="sdk (unity)" aria-controls="tabs-00-01" aria-selected="false"&gt;&#10; SDK (Unity)&#10; &lt;/button&gt;&#10; &lt;/li&gt;&#10;&lt;/ul&gt;&#10;&#10;&lt;div class="tab-content" id="tabs-0-content"&gt;&#10; &lt;div class="tab-body tab-pane fade show active"&#10; id="tabs-00-00" role="tabpanel" aria-labelled-by="tabs-00-00-tab" tabindex="0"&gt;&#10; &lt;h3 id="create-the-product-table"&gt;Create the product table&lt;a class="td-heading-self-link" href="#create-the-product-table" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Add &lt;strong&gt;Stamina Shop&lt;/strong&gt; under &lt;strong&gt;Add features&lt;/strong&gt;, then create the following row in &lt;strong&gt;Tables → Stamina product (EnergyProduct)&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>7. Change settings and apply them to the game</title><link>/en/get_start/adventure/lessons/07-update/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/en/get_start/adventure/lessons/07-update/</guid><description>&lt;p&gt;With the basic game working, let’s change its content. Increase Forest exploration’s reward from 10 to 15 coins and add &lt;strong&gt;Cave exploration&lt;/strong&gt;. Check how the settings affect the display and the rewards you receive.&lt;/p&gt;&#10;&lt;h2 id="before-you-start"&gt;Before you start&lt;a class="td-heading-self-link" href="#before-you-start" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Clear any active quest and wait for purchases or other operations to finish before changing settings.&lt;/p&gt;&#10;&lt;h2 id="changes-to-make"&gt;Changes to make&lt;a class="td-heading-self-link" href="#changes-to-make" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;table&gt;&#10;&#9;&lt;thead&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Quest&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Stamina cost&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Normal reward&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;First-clear reward&lt;/th&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/thead&gt;&#10;&#9;&lt;tbody&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;forest&lt;/code&gt; Forest exploration&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;5&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;15 coins&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;None&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;cave&lt;/code&gt; Cave exploration&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;8&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;20 coins&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;None&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;h2 id="steps"&gt;Steps&lt;a class="td-heading-self-link" href="#steps" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&#10;&#10;&#10;&#10;&#10;&lt;ul class="nav nav-tabs" id="tabs-0" role="tablist"&gt;&#10; &lt;li class="nav-item"&gt;&#10; &lt;button class="nav-link active"&#10; id="tabs-00-00-tab" data-bs-toggle="tab" data-bs-target="#tabs-00-00" role="tab"&#10; data-td-tp-persist="studio" aria-controls="tabs-00-00" aria-selected="true"&gt;&#10; Studio&#10; &lt;/button&gt;&#10; &lt;/li&gt;&lt;li class="nav-item"&gt;&#10; &lt;button class="nav-link"&#10; id="tabs-00-01-tab" data-bs-toggle="tab" data-bs-target="#tabs-00-01" role="tab"&#10; data-td-tp-persist="sdk (unity)" aria-controls="tabs-00-01" aria-selected="false"&gt;&#10; SDK (Unity)&#10; &lt;/button&gt;&#10; &lt;/li&gt;&#10;&lt;/ul&gt;&#10;&#10;&lt;div class="tab-content" id="tabs-0-content"&gt;&#10; &lt;div class="tab-body tab-pane fade show active"&#10; id="tabs-00-00" role="tabpanel" aria-labelled-by="tabs-00-00-tab" tabindex="0"&gt;&#10; &lt;h3 id="edit-the-existing-row-and-add-a-new-one"&gt;Edit the existing row and add a new one&lt;a class="td-heading-self-link" href="#edit-the-existing-row-and-add-a-new-one" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Open &lt;strong&gt;Tables → Quest (Quest)&lt;/strong&gt; and make these edits.&lt;/p&gt;</description></item><item><title>8. Handle network errors and repeated clicks</title><link>/en/get_start/adventure/lessons/08-failures/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/en/get_start/adventure/lessons/08-failures/</guid><description>&lt;p&gt;Try clicking the purchase button repeatedly and disconnecting the network. Continue with the same player you have been using.&lt;/p&gt;&#10;&lt;h2 id="click-again-while-a-purchase-is-processing"&gt;Click again while a purchase is processing&lt;a class="td-heading-self-link" href="#click-again-while-a-purchase-is-processing" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;&#10;&lt;li&gt;Prepare at least 20 coins. Clear quests to earn more if needed.&lt;/li&gt;&#10;&lt;li&gt;Click &lt;strong&gt;Restore 10 stamina for 20 coins&lt;/strong&gt;, then immediately click again.&lt;/li&gt;&#10;&lt;li&gt;Check that the button is disabled during processing and cannot start another purchase.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;The code sets &lt;code&gt;busy&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt; when an operation starts and resets it to &lt;code&gt;false&lt;/code&gt; in &lt;code&gt;finally&lt;/code&gt;. In addition to disabling buttons, Studio’s &lt;code&gt;Run()&lt;/code&gt; and the SDK’s &lt;code&gt;RunWrite()&lt;/code&gt; reject calls while busy.&lt;/p&gt;</description></item></channel></rss>