Amazon Developer Blogs Amazon Developer Blogs 2018-03-16T13:00:00+00:00 Apache Roller Weblogger /blogs/alexa/post/79bc6f74-cfef-47d0-a069-5ed7c0ee5722/taking-control-of-the-dialog-management-state-machine Taking Control of the Dialog Management State Machine Jennifer King 2018-03-16T13:00:00+00:00 2018-03-16T13:00:00+00:00 <p>Dialog management is a great way to collect the set of required slots that your intent needs to perform a task for your customers, since it greatly reduces the necessary coding required to reprompt for missing slot values. Learn how about how you can leverage the dialog management state machine.</p> <p>Dialog management is a great way to collect the set of required slots that your intent needs to perform a task for your customers, since it greatly reduces the necessary coding required to reprompt for missing slot values.</p> <p>From your interaction model, you mark which slots are required and provide a set of prompts and utterances for each required slot. From your backend, you delegate the collection of the slots to Alexa. If your customer didn't provide a required slot value, Alexa will use the provided prompts to ask the customer to fill the missing slot and the provided utterances to fill the slot with a value.</p> <p>I often get the question from Alexa developers, &quot;Can I override the prompts in code?&quot; One great benefit of using dialog management is that Alexa creates and manages a state machine for you. Your backend code can check the state and not only override prompts, but also perform complex logic that you might need to solve a particular edge case.</p> <p>Each interaction between the customer and Alexa during dialog management allows to you hook into the state machine and perform your own logic. The request includes the <strong>dialogState</strong> so you can update your code to function differently based upon the state.</p> <h2>Identifying Dialog Management State</h2> <p>Dialog management has three states, <strong>STARTED</strong>, <strong>IN_PROGRESS</strong>, and <strong>COMPLETED</strong>. When actively capturing required slots through dialog management, the JSON that is sent to your service will include <strong>dialogState</strong>. The snippet of JSON below includes <strong>dialogState,</strong> which indicates that we are in dialog management.</p> <pre> <code>{ ... &quot;request&quot;: { &quot;type&quot;: &quot;IntentRequest&quot;, &quot;requestId&quot;: &quot;amzn1.echo-api.request.&quot;, &quot;timestamp&quot;: &quot;2018-03-07T21:52:27Z&quot;, &quot;locale&quot;: &quot;en-US&quot;, &quot;intent&quot;: { &quot;name&quot;: &quot;PetMatchIntent&quot;, &quot;confirmationStatus&quot;: &quot;NONE&quot;, &quot;slots&quot;: { &quot;size&quot;: { &quot;name&quot;: &quot;size&quot;, &quot;confirmationStatus&quot;: &quot;NONE&quot; }, &quot;temperament&quot;: { &quot;name&quot;: &quot;temperament&quot;, &quot;confirmationStatus&quot;: &quot;NONE&quot; }, &quot;energy&quot;: { &quot;name&quot;: &quot;energy&quot;, &quot;confirmationStatus&quot;: &quot;NONE&quot; } } }, &quot;dialogState&quot;: &quot;STARTED&quot; } ... } </code></pre> <p>From your skill, you can check the <strong>dialogState</strong> and perform an action like setting default values, or preloading information from a web service. You can even inspect the slots that have been filled. You can check the <strong>dialogState</strong> by looking at the request, this.event.request.dialogState and access the slots through the request’s intent this.event.request.intent.slots.</p> <h2>Setting Default Values</h2> <p>Let's take a look at how you would set <strong>medium</strong> as the default value for <strong>size</strong>, and then ask the customer if the default is okay.</p> <pre> <code>function delegateSlotCollection() { if (this.event.request.dialogState == 'STARTED') { let size = this.event.request.intent.slots.size if (!size.value &amp;&amp; size.confirmationStatus !== 'CONFIRMED') { this.event.request.intent.slots.size.value = 'medium'; let speechOutput = 'You did not provide a value for size, so I chose medium. Is that ok?'; let reprompt = 'So you want a medium sized dog?' this.emit(':confirmSlot','size', speechOutput, reprompt); } else { this.emit(':delegate'); } } else if (this.event.request.dialogState !== 'COMPLETED') { this.emit(':delegate'); } else { return this.event.request.intent; } } </code></pre> <p>First, we are checking the <strong>dialogState</strong>. If it's <strong>STARTED</strong> and the <strong>size</strong> slot is empty and hasn't been confirmed, we then set the value to <strong>medium</strong>, our default, and emit <a href=""><strong>:confirmSlot</strong></a>. Alexa will then say to the customer, &quot;You did not select a size, so I chose medium. Is that okay?&quot; If the customer says, &quot;Yes&quot; the value will be confirmed. If the customer says &quot;No,&quot; <strong>size.confirmationStatus</strong> will become <strong>DENIED</strong>. If you do nothing else here, dialog management will continue prompting for each required slot in the order that you specified in your interaction model. You can change the order by clicking the up and down arrows or typing the number into the order box.</p> <p><img alt="" src="" /></p> <p>Pet match will ask for pet, size, temperament and energy in that order unless for example, the user provided a slot for pet and temperament. It will then ask for size followed by energy.</p> <h2>Overriding Prompts</h2> <p>If you wanted to override the prompt that you set in your interaction model, you can do so using <a href=""><strong>:elicitSlot</strong></a>.</p> <pre> <code>let speechOutput = &quot;There are dogs that are, tiny, small, medium, and large, which would you like?&quot;; let repromt = &quot;Say a size like tiny, small, medium, or large.&quot;; this.emit(':elicitSlot', 'size', speechOutput, reprompt);</code></pre> <p>Here we are simply telling <strong>elicitSlot</strong> to elicit the <strong>size</strong> slot. Alexa will use the <strong>speechOut</strong> to prompt the customer. If the customer takes longer than 8 seconds to reply, Alexa will ask again using <strong>reprompt</strong>. If you wanted to load your prompts from a database, or change them based on the information previously provided, the above example will be useful to you.</p> <h2>Pulling the Ripcord on Dialog Management</h2> <p>There may be times you want to jump out of dialog management early. For example, you have three slots, <strong>A</strong>, <strong>B,</strong> and <strong>C</strong> and you need A or B and C. Programmatically you could check which slots have been provided, and then jump out when the customer has provided either A or B and C. Once the condition has been met, you can set <strong>dialogState</strong> to <strong>COMPLETED</strong>. I’ll go into detail about how I solved this exact problem with dialog management in a future post.</p> <p>I hope this post has helped you understand how you can leverage dialog management to delegate the state management to Alexa. You're able to hook into it and override the default behavior. If you have any questions, let's continue you the discussion. You can contact me at <a href="" target="_blank">@sleepydeveloper</a> or seek me out at an <a href="">Alexa Dev Days</a> in your city.</p> <h2>More Resources on Dialog Management</h2> <ul> <li><a href="">Alexa Skill Teardown: Decoding Dialog Management with the Pet Match Skill</a></li> <li><a href="">Pet Match Dialog Management Tutorial</a></li> <li><a href="">Technical Documentation for Dialog Management</a></li> <li><a href="">Plan My Trip Dialog Management Tutorial</a></li> </ul> /blogs/alexa/post/954bdd49-e657-4059-930a-5658010d1234/how-to-create-smart-home-jp-skill-2 スマートホームスキルを作る (2) 各ディレクテイブを処理する Takuji Kawata 2018-03-16T07:56:08+00:00 2018-03-16T07:56:08+00:00 <p><img alt="" src="" style="height:311px; width:883px" /></p> <p>スマートホームスキルの作り方シリーズ第2回目です。今回はデバイス検出、デバイス操作、デバイス状態レポートの実装方法についてご説明します。</p> <p><img alt="" src="" /></p> <p>スマートホームスキルの作り方、シリーズ第2回目です。<br /> 第1回は次をご確認ください。<br /> 「<a href="" target="_blank">スマートホームスキルを作る (1) サンプルコードからスキルの基本要素を作る</a>」</p> <p>&nbsp;</p> <h1><strong>スマートホームスキル API の各ディレクティブを処理する</strong></h1> <p>Alexa からスキルへの各要求はディレクティブという形でスキルのエンドポイントLambda 関数に送られてきます。その主要なものは次の3つに分類でき、いずれも適切に処理される必要があります。</p> <ul> <li><strong>Discovery:</strong>スマートホームデバイスのリストを要求</li> <li><strong>デバイス操作:</strong>スマートホームデバイスの操作とその結果を要求</li> <li><strong>デバイス状態レポート:</strong>スマートホームデバイスの現在の状態のレポートを要求</li> </ul> <p>&nbsp;</p> <h2><strong>事前準備</strong></h2> <p>ここでは「<a href="" target="_blank">スマートホームスキルを作る (1) サンプルコードからスキルの基本要素を作る</a>」で作成した、サンプルコードを使って説明を進めていきます。先にこのサンプルコードが確認できる環境を用意しておいてください。</p> <p>&nbsp;</p> <h2><strong>Discoveryの処理</strong></h2> <p>ユーザーがスマートホームAPIスキルを有効にした後に、最初に行うのはデバイスの検出です。Alexaはこれを通して、特定のスキルが特定のユーザーに対して操作をすることができるデバイスの一覧を得ます。ユーザーがデバイスの検出を求めたら、Alexa はユーザーが有効にしている各スマートホームスキルに Alexa.Discovery インターフェースの Discover という要求をディレクティブとして送ります。</p> <p><a href="" target="_blank">前回</a>作成したサンプルプログラムでは次の箇所で Discover 要求に対する処理をしています</p> <pre> <code class="language-python">def handle_discovery_v3(request): endpoints = [] for appliance in SAMPLE_APPLIANCES: endpoints.append(get_endpoint_from_v2_appliance(appliance)) response = { &quot;event&quot;: { &quot;header&quot;: { &quot;namespace&quot;: &quot;Alexa.Discovery&quot;, &quot;name&quot;: &quot;Discover.Response&quot;, &quot;payloadVersion&quot;: &quot;3&quot;, &quot;messageId&quot;: get_uuid() }, &quot;payload&quot;: { &quot;endpoints&quot;: endpoints } } } return response</code></pre> <p>ここで確認してほしいのは endpoints オブジェクトです。これは endpoint オブジェクトをリストとして収めているもので、一つの endpoint オブジェクトは一つのスマートホームデバイスの情報を提供します。提供する情報は、デバイスの名前、デバイスが対応している機能、デバイスの表示カテゴリーなどです。これらの情報を得ることで、Alexaはユーザーごとにデバイスの呼び出し名(デバイス名)と利用できる機能とを識別し、ユーザーの要求に対して適切な処理ができるようにしています。サンプルプログラムでは SAMPLE_APPLIANCES で定義されているデバイスリストの一つ一つを get_endpoint_from_v2_appliance という関数で endpoint オブジェクトの形式に変換しています。get_endpoint_from_v2_appliance 関数は次のような内容です。</p> <pre> <code class="language-python">def get_endpoint_from_v2_appliance(appliance): endpoint = { &quot;endpointId&quot;: appliance[&quot;applianceId&quot;], &quot;manufacturerName&quot;: appliance[&quot;manufacturerName&quot;], &quot;friendlyName&quot;: appliance[&quot;friendlyName&quot;], &quot;description&quot;: appliance[&quot;friendlyDescription&quot;], &quot;displayCategories&quot;: [], &quot;cookie&quot;: appliance[&quot;additionalApplianceDetails&quot;], &quot;capabilities&quot;: [] } endpoint[&quot;displayCategories&quot;] = get_display_categories_from_v2_appliance(appliance) endpoint[&quot;capabilities&quot;] = get_capabilities_from_v2_appliance(appliance) return endpoint</code></pre> <p>endpoint オブジェクトの重要な要素を簡単に確認しましょう。</p> <ul> <li><strong>endpointId</strong>: ユーザーデバイスを識別するための文字列。この文字列によってユーザーの持つデバイスは全てユニークに識別できるようにする必要があります。また同じデバイスに対しては Discover 要求に対して常に同じ endpointId が与えられる必要があります。</li> <li><strong>manufactureName</strong>: スマートホームデバイスの製造会社を示す文字列。</li> <li><strong>friendlyName</strong>: デバイスの呼び名。Alexaはこの名前でユーザーがデバイスを呼べるようにします。「ライト」など適切な日本語である必要があります。名前の一部に数字を使いたいときは現状漢数字を使ってください「ライト三」や「三番目のライト」といった感じです。</li> <li><strong>description</strong>:デバイスを説明する文字列。どのスキルが提供しているデバイスかを識別できる文言を含めてください(Alexaアプリ上で各デバイスが列挙されたとき、どのスキルが提供したデバイスかわかりやすくなります)。</li> <li><strong>displayCategories</strong>: デバイスの表示カテゴリー。ここの内容によって Alexa アプリでのデバイスの表示のされ方が変わります。</li> <li><strong>capabilities</strong>:デバイスがサポートする機能を示します。</li> </ul> <p>displayCategories と capabilities はそれぞれ get_display_categories_from_v2_appliance、get_capabilities_from_v2_appliance という別の関数で内容を生成しています。これらの関数はそれぞれ SAMPLE_APPLIANCES で定義されている modelName の内容にしたがって典型的な設定が行われるようにしています。<a href="" target="_blank">前回</a>日本語環境で利用できる modelName を紹介しましたが、これは正確には modelName をもとに生成される displayCategories と capabilities の値でサポートされるものを紹介していました。 displayCategories に設定できる値は次の通りです。displayCategories は配列のため複数設定することもできますが、通常一デバイス一つを設定します。</p> <table border="1" cellpadding="1" cellspacing="1" style="width:750px"> <thead> <tr> <th scope="col">値</th> <th scope="col">内容</th> <th scope="col">日本語対応 (2018年3月12日時点)</th> </tr> </thead> <tbody> <tr> <td>ACTIVITY_TRIGGER</td> <td>シーン。特定の状態に遷移するために複数のデバイスが一定の順序で操作されるようなものを示します</td> <td style="text-align:center">○</td> </tr> <tr> <td>CAMERA</td> <td>カメラ</td> <td style="text-align:center">&times;</td> </tr> <tr> <td>DOOR</td> <td>ドア</td> <td style="text-align:center">○</td> </tr> <tr> <td>LIGHT</td> <td>照明器具</td> <td style="text-align:center">○</td> </tr> <tr> <td>OTHER</td> <td>既定のカテゴリーに該当しないデバイス</td> <td style="text-align:center">○</td> </tr> <tr> <td>SCENE_TRIGGER</td> <td>シーン。特定の状態に遷移するために複数のデバイスが操作されるようなものを示します。ACTIVITY_TRIGGERと異なり、それぞれの操作は常に一定の順序である必要はないものを示す。</td> <td style="text-align:center">○</td> </tr> <tr> <td>SMARTLOCK</td> <td>スマートロック</td> <td style="text-align:center">○</td> </tr> <tr> <td>SMARTPLUG</td> <td>スマートプラグ</td> <td style="text-align:center">○</td> </tr> <tr> <td>SPEAKERS</td> <td>スピーカー</td> <td style="text-align:center">&times;</td> </tr> <tr> <td>SWITCH</td> <td>スイッチ</td> <td style="text-align:center">○</td> </tr> <tr> <td>TEMPERATURE_SENSOR</td> <td>温度センサー</td> <td style="text-align:center">&times;</td> </tr> <tr> <td>THERMOSTAT</td> <td>サーモスタット</td> <td style="text-align:center">&times;</td> </tr> <tr> <td>TV</td> <td>テレビ</td> <td style="text-align:center">&times;</td> </tr> </tbody> </table> <p>capabilities には capability オブジェクトの配列を与えます。capability オブジェクトではデバイスが対応する機能を示します。capability オブジェクトの詳細は、次の仕様を確認してください。</p> <p><a href="" target="_blank"></a></p> <p>デバイスがどのようなユーザーの要求に応えることができるかは capability オブジェクトの interface の値で「機能インターフェース」として示します。現時点で日本語環境で正式に対応できている機能インターフェースは次の表1の通りです。</p> <p><strong><a id="list1">表1</a></strong></p> <table border="1" cellpadding="1" cellspacing="1" style="width:750px"> <thead> <tr> <th scope="col">カテゴリー</th> <th scope="col">機能</th> <th scope="col">インターフェース</th> </tr> </thead> <tbody> <tr> <td>電力制御</td> <td>オン/オフを切り替える</td> <td><a href="" target="_blank">Alexa.PowerController</a></td> </tr> <tr> <td>電力制御</td> <td>電力レベルを設定する</td> <td><a href="" target="_blank">Alexa.PowerLevelController</a></td> </tr> <tr> <td>照明制御</td> <td>照明の輝度をパーセンテージで変更するか、特定の値に変更する</td> <td><a href="" target="_blank">Alexa.BrightnessController</a></td> </tr> <tr> <td>照明制御</td> <td>照明の色を変更する</td> <td><a href="" target="_blank">Alexa.ColorController</a></td> </tr> <tr> <td>照明制御</td> <td>調整可能な照明の白の色調を変更する</td> <td><a href="" target="_blank">Alexa.ColorTemperatureController</a></td> </tr> <tr> <td>ドアロック制御</td> <td>ロック状態を取得または設定する</td> <td><a href="" target="_blank">Alexa.LockController</a></td> </tr> <tr> <td>パーセンテージ</td> <td>デバイスをパーセンテージで制御する</td> <td><a href="" target="_blank">Alexa.PercentageController</a></td> </tr> </tbody> </table> <p>(2018年3月12日時点で日本語に対応しているインターフェースだけを載せています。英語環境ではこれ以外にホームエンターテイメントデバイスの操作に関連したインターフェースなど様々なバリエーションがあります。これらは順次日本語にも対応していく予定です)</p> <p>endpoints オブジェクトを実際のスキルで構築するには、Discover を要求したユーザーを特定し、そのユーザーのデバイス一覧を得る必要があります。サンプルプログラムではユーザーを特定する部分は実装されていません。</p> <p>ユーザーの特定はアクセストークンを使って行います。アクセストークンの取得方法について次を確認してください。</p> <ul> <li><strong>アクセストークン:</strong> scope のtoken 値を利用。 token 値はアカウントリンクであなたのOAuth2.0サーバーが該当ユーザーに対して発行したアクセストークンの値です。サンプルコードでは request オブジェクトから次のようにして token値を取得することができます。</li> </ul> <pre> <code class="language-python">request[&quot;payload&quot;][&quot;scope&quot;][&quot;token&quot;] </code></pre> <p>以上、Discoveryの処理の重要なポイントを見てきました。詳細は次を確認してください。</p> <p><a href="" target="_blank"></a></p> <p>&nbsp;</p> <h2><strong>デバイス操作要求の処理</strong></h2> <p>Alexa からのスマートホームデバイスの操作要求は、ディレクティブとしてスキルのエンドポイントLambda 関数に送られます。デバイスごとに何が操作要求として送られてくるかは、先の Discovery への応答に依存します。逆にいうと Discovery の応答で明示的に対応できることを示した要求以外が特定のデバイスに対して要求されることはありません。例えば、明るさの指定をサポートすることを Discovery への応答で示さなかったデバイスに対して、明るさの指定のディレクティブが送られることはありません。</p> <p>スキルは要求を受け取ると、メッセージの内容から次を特定し、これに応じて対象デバイスを操作、その処理結果を応答メッセージとして Alexa に返す必要があります。</p> <ul> <li>操作要求の内容</li> <li>操作対象のユーザー</li> <li>操作対象のデバイス</li> </ul> <p><a href="" target="_blank">前回</a>作成した、サンプルプログラムでは次の部分がデバイス操作ディレクティブの処理を行い、結果応答のメッセージを作成しています。</p> <pre> <code class="language-python">def handle_non_discovery_v3(request): request_namespace = request[&quot;directive&quot;][&quot;header&quot;][&quot;namespace&quot;] request_name = request[&quot;directive&quot;][&quot;header&quot;][&quot;name&quot;] if request_namespace == &quot;Alexa.PowerController&quot;: if request_name == &quot;TurnOn&quot;: value = &quot;ON&quot; else: value = &quot;OFF&quot; response = { &quot;context&quot;: { &quot;properties&quot;: [ { &quot;namespace&quot;: &quot;Alexa.PowerController&quot;, &quot;name&quot;: &quot;powerState&quot;, &quot;value&quot;: value, &quot;timeOfSample&quot;: get_utc_timestamp(), &quot;uncertaintyInMilliseconds&quot;: 500 } ] }, &quot;event&quot;: { &quot;header&quot;: { &quot;namespace&quot;: &quot;Alexa&quot;, &quot;name&quot;: &quot;Response&quot;, &quot;payloadVersion&quot;: &quot;3&quot;, &quot;messageId&quot;: get_uuid(), &quot;correlationToken&quot;: request[&quot;directive&quot;][&quot;header&quot;][&quot;correlationToken&quot;] }, &quot;endpoint&quot;: { &quot;scope&quot;: { &quot;type&quot;: &quot;BearerToken&quot;, &quot;token&quot;: &quot;access-token-from-Amazon&quot; }, &quot;endpointId&quot;: request[&quot;directive&quot;][&quot;endpoint&quot;][&quot;endpointId&quot;] }, &quot;payload&quot;: {} } } return response</code></pre> <p>操作要求の内容はディレクティブの中の namespace と name を確認することでわかります。このコードの前半、以下の部分で、これらを判断しています。</p> <pre> <code class="language-python"> request_namespace = request[&quot;directive&quot;][&quot;header&quot;][&quot;namespace&quot;] request_name = request[&quot;directive&quot;][&quot;header&quot;][&quot;name&quot;] if request_namespace == &quot;Alexa.PowerController&quot;: if request_name == &quot;TurnOn&quot;: value = &quot;ON&quot; else: value = &quot;OFF&quot; </code></pre> <p>namespace は要求内容を判断する上で機能インターフェースに紐付きます。name はその機能インターフェースが提供する機能名の一つです。つまり、ユーザーは「namespace 機能インターフェースの name 機能を実行する」ことを要求していることになります。上記箇所 はAlexa.PowerController 機能インターフェースの TurnOn / TurnOff 操作要求について処理をしています。</p> <p>次に必要なのはユーザーと操作対象デバイスの特定です。この部分はサンプルコードでは簡略化のために省略されていますので、情報を得るためのヒントをお伝えします。</p> <ul> <li><strong>ユーザーの特定はアクセストークンで:</strong> scope のtoken値を参照します。 token 値はアカウントリンクであなたのOAuth2.0サーバーが該当ユーザーに対して発行したアクセストークンの値です。サンプルコードではrequestオブジェクトから次のようにして token値を取得することができます。</li> </ul> <pre> <code class="language-python">request[&quot;directive&quot;][&quot;endpoint&quot;][&quot;scope&quot;][&quot;token&quot;] </code></pre> <ul> <li><strong>操作対象のデバイスの特定は endpointIdで:</strong>endpointId は Discoveryに応答する際にデバイスごとに割り当てた識別値です。サンプルコードでは SAMPLE_APPLIANCES リストの各デバイスの applianceId の値がこれに対応します。サンプルコードでは request オブジェクトから次のようにして endpointId値を取得することができます。</li> </ul> <pre> <code class="language-python">request[&quot;directive&quot;][&quot;endpoint&quot;][&quot;endpointId&quot;] </code></pre> <p>ユーザーと操作対象デバイスが特定できたら、次に該当のデバイスを操作します。これは通常、デバイス操作クラウドのAPIを呼び出すことによって行います。その方法は様々ですし、どの方法が最適というわけでもないので、ここでは具体的な例は割愛しますが、通常守るべき重要なポイントは以下の通りです:</p> <ul> <li>デバイス操作は直ちに実行され、これが成功したかどうかはディレクティブに応答するまでにスキルロジック内で判断できている必要がある</li> <li>デバイス操作とそれが成功したかどうかの判断は約7秒(*1)以内に完了している必要がある</li> </ul> <p>ここで「通常」と書いたのは例外もあるからです。たとえば、スマートロックなどの鍵のロック処理が例外として挙げられます。ロック処理は、時間がかかる場合もあるという配慮から、非同期による遅延応答にも対応しているためです。遅延応答についてはここでは説明しませんが、興味がある方は<a href="" target="_blank">こちら</a>を確認してください。</p> <table border="1" cellpadding="1" cellspacing="1"> <tbody> <tr> <td>(*1) 仕様上の同期応答のタイムリミットは8秒です。しかし8秒以内に応答すれば大丈夫という考え方は適切ではありません。ユーザービリティーその他の条件も考慮し、ディレクティブの処理は全体で長くとも7秒程度に納めるべきです</td> </tr> </tbody> </table> <p>デバイスの操作が終わったらその結果を Alexa に応答メッセージとして返します。</p> <p>サンプルコードでは次の部分で応答用のオブジェクトを作成し、関数の戻り値として返しています。</p> <pre> <code class="language-python"> response = { &quot;context&quot;: { &quot;properties&quot;: [ { &quot;namespace&quot;: &quot;Alexa.PowerController&quot;, &quot;name&quot;: &quot;powerState&quot;, &quot;value&quot;: value, &quot;timeOfSample&quot;: get_utc_timestamp(), &quot;uncertaintyInMilliseconds&quot;: 500 } ] }, &quot;event&quot;: { &quot;header&quot;: { &quot;namespace&quot;: &quot;Alexa&quot;, &quot;name&quot;: &quot;Response&quot;, &quot;payloadVersion&quot;: &quot;3&quot;, &quot;messageId&quot;: get_uuid(), &quot;correlationToken&quot;: request[&quot;directive&quot;][&quot;header&quot;][&quot;correlationToken&quot;] }, &quot;endpoint&quot;: { &quot;scope&quot;: { &quot;type&quot;: &quot;BearerToken&quot;, &quot;token&quot;: &quot;access-token-from-Amazon&quot; }, &quot;endpointId&quot;: request[&quot;directive&quot;][&quot;endpoint&quot;][&quot;endpointId&quot;] }, &quot;payload&quot;: {} } } return response</code></pre> <p>これは Alexa.PowerController 機能インターフェースに対応する応答ですが、ほとんどの箇所が他の機能インターフェースの場合も共通です。違いが出てくるのは properties の中身で、ここに何を与えるかは各機能インターフェースの仕様を確認する必要があります。</p> <p>サンプルプログラムでは、この後、生成された応答メッセージのデータの整合性(不正な文字列が入っていないかなど)を確認したのち、Alexa に応答します。</p> <p>以上がディレクティブを処理し、応答するまでの一連の流れです。</p> <p>ここで見てきたのは Alexa.PowerController 機能インターフェースの場合の例でした。明るさの変更など、要求内容によっては特定のパラメータ値を持つものもあります。どのような機能インターフェースがあり、それぞれがどのようなユーザー要求に対応し、どのようにスキルに伝えられ、またどのようにスキルから Alexa に応答すべきかについて詳細は既出の<a>表1</a>を確認してください。</p> <p>&nbsp;</p> <h2><strong>デバイス状態レポートの処理</strong></h2> <p>スマートホームスキルAPIによって実現される機能は声によるスマートホームデバイスのコントロールだけではありません。スマートホームデバイスの現在のステータスを Alexa に通知する仕組みがあり、これにより Alexa は現在のデバイスの状態を把握します。デバイスの状態は様々な形で使われます。その代表的なものの一つが Alexaアプリでのデバイスのステータスの表示です。 Alexa アプリはデバイスの状態に応じて表示を切り替えます。</p> <p>例:Alexa アプリでのデバイスのステータスの確認</p> <p>スイッチデバイスは ON 状態</p> <p><img alt="alexaguijp_20180304_1.gif" src="" /></p> <p>スイッチデバイスは OFF 状態</p> <p><img alt="alexaguijp_20180304_2.gif" src="" /></p> <p>Alexa は最新のデバイスの状態が必要な時、これを次のいずれかの方法で判定します。</p> <ul> <li>最後の操作ディレクティブの結果から</li> <li>デバイス状態レポートをディレクティブとして送りその結果から</li> <li>変更通知イベントから</li> </ul> <p>ここでは2番目の「デバイス状態レポートをディレクティブとして送りその結果から」に対応するためのスキルの実装方法について説明します。3番目の「変更通知イベントから」につては、非常に重要な項目ですので、次回詳しくご説明いたします。</p> <p>デバイス状態レポート(ReportState)要求はデバイスの現在の状況をAlexaが必要としている時に Alexa から発行されるディレクティブです。スキルはこれに適切に応答する必要があります。ReportState では該当デバイスが対応している全ての属性情報について最新の状態をレポートする必要があります。</p> <p>サンプルプログラムにはこの ReportState に対応するコードが含まれていません。先に出てきた Alexa.PowerController 機能インターフェースにのみ対応したデバイスに対しての ReportState への応答を handle_non_discovery_v3 関数の中に追加する場合は、例えば以下のように書くことができます。ここでは常にデバイスはオンライン状態にあり、常に ON の状態であると返しています。</p> <pre> <code class="language-python"> elif request_namespace == &quot;Alexa&quot;: if request_name == &quot;ReportState&quot; : responses = { &quot;context&quot;: { &quot;properties&quot;: [ { &quot;namespace&quot;: &quot;Alexa.EndpointHealth&quot;, &quot;name&quot;: &quot;connectivity&quot;, &quot;value&quot;: { &quot;value&quot;: &quot;OK&quot; }, &quot;timeOfSample&quot;: get_utc_timestamp(), &quot;uncertaintyInMilliseconds&quot;: 200 }, { &quot;name&quot;: &quot;powerState&quot;, &quot;namespace&quot;: &quot;Alexa.PowerController&quot;, &quot;value&quot;: &quot;ON&quot;, &quot;timeOfSample&quot;: get_utc_timestamp(), &quot;uncertaintyInMilliseconds&quot;: 200 } ] }, &quot;event&quot;: { &quot;payload&quot;: {}, &quot;header&quot;: { &quot;namespace&quot;: &quot;Alexa&quot;, &quot;name&quot;: &quot;StateReport&quot;, &quot;payloadVersion&quot;: &quot;3&quot;, &quot;messageId&quot;: get_uuid(), &quot;correlationToken&quot;: request[&quot;directive&quot;][&quot;header&quot;][&quot;correlationToken&quot;] }, &quot;endpoint&quot;: { &quot;endpointId&quot;: request[&quot;directive&quot;][&quot;endpoint&quot;][&quot;endpointId&quot;] } } } return responses</code></pre> <p>デバイス状態レポート(ReportState)要求について詳細は、次を確認してください。</p> <p><a href="" target="_blank"></a></p> <p>&nbsp;</p> <p>今回はここまでです。</p> <p>次回は変更通知イベントとエラー状態の扱い方、スキルを公開するまでの流れについてご説明する予定です。</p> /blogs/alexa/post/1dde34e2-c763-45ae-99cf-7c72f41b502e/alexa-skills-challenge-offers-250-000-in-prizes-for-the-best-life-hack-skills Alexa Skills Challenge Offers $250,000 in Prizes for the Best Life Hack Skills Brian Crum 2018-03-15T19:05:19+00:00 2018-03-15T19:05:19+00:00 <p><img alt="" src="" style="height:240px; width:954px" /></p> <p>We’re thrilled to announce the&nbsp;<a href="" target="_blank">Alexa Skills Challenge: Life Hacks</a>&nbsp;with Devpost, an opportunity for you to publish a stellar Alexa skill that customers will love for a chance to win your share of cash and prizes up to $250,000.</p> <p><img alt="" src="" style="height:240px; width:954px" /></p> <p>We’re thrilled to announce the <a href="" target="_blank">Alexa Skills Challenge: Life Hacks</a> with Devpost, an opportunity for you to publish a stellar Alexa skill that customers will love for a chance to win your share of cash and prizes up to $250,000. The Life Hacks Challenge invites you to build Alexa skills that make everyday tasks faster, easier, and more delightful. We are looking for skills that can reduce workload, streamline tasks, support self-improvement, or improve lifestyle and health. Life hack skills can be in any category, as long as they improve an element of a customer's life. And submissions to the Life Hacks Challenge can be an update to an existing skill, or an entirely new skill.</p> <h2>What Is a Life Hack?</h2> <p>In one sense, Alexa skills are life hacks already. By enabling hands-free, voice-enabled access to information, products, services, and so much more, customers can simplify daily tasks and improve their overall productivity. Alexa defines a life hack as any trick, shortcut, skill, or novelty method that increases productivity and efficiency, in all walks of life. This can range from skills that help customers get a better night’s sleep, save money, drink more water, or cultivate a healthier mindset, to MacGyver-style expedient solutions to everyday problems, and more. And while many skills available today already meet this definition, the Life Hacks Challenge is about raising the bar. It's about making existing skills even better, and building new skills that customers simply can’t live without.</p> <h2>9 Different Ways to Win</h2> <p>Everyone who completes an eligible content submission package and publishes a life hack skill will receive a limited-edition Echo Dot. In addition:</p> <ul> <li><strong>10 Finalist Prizes:</strong>&nbsp;The ten finalists will receive $5,000 each and have their skill promoted by Amazon across multiple channels including email and social media promotion, and dedicated merchandising on Amazon-owned properties.&nbsp;</li> <li> <p><strong>Grand Prize:</strong> The winner for the overall best Alexa life hack skill will be chosen from the finalists and will receive $20,000 in addition to their $5,000 finalist prize, for a total of $25,000 in cash. The grand prize winner will also get a cool trophy to show off to their family, friends, and fellow students/co-workers.</p> </li> <li> <p><strong>Bonus Prize – Best New Life Hack Skill Designed for Echo Show &amp; Echo Spot</strong> (chosen from <em><u>new skills</u></em> submitted during the contest period)<strong>:</strong> The winner of this bonus prize will receive $5,000 and need not be a finalist.</p> </li> <li> <p><strong>Bonus Prize – Best Updated Life Hack Skill Designed for Echo Show &amp; Echo Spot </strong>(chosen from <em><u>existing skills</u></em>&nbsp;updated during the contest period)<strong>:</strong> The winner of this bonus prize will receive $5,000 and need not be a finalist.</p> </li> <li> <p><strong>Bonus Prize – Best Life Hack Skill by High School Students: </strong>The winning individual or team members must be age 13-18, and currently enrolled in a high school in the US or Canada. The winner of this bonus prize will receive $5,000 and need not be a finalist.</p> </li> <li> <p><strong>Bonus Prize – Best Life Hack Skill by University Students: </strong>The winning individual or team members must be currently enrolled in an accredited university. The winner of this bonus prize will receive $5,000 and need not be a finalist.</p> </li> <li> <p><strong>Bonus Prize – Best Work-from-Home Hack:</strong> This prize is intended for the best Alexa skill that seeks to boost productivity, focus, or overall effectiveness in a work-from-home scenario. The winner of this prize will receive $5,000 and need not be a finalist.</p> </li> <li> <p><strong>Bonus Prize – Best Health &amp; Wellness-Hack Skill:</strong> This prize is intended for the best Alexa skill that seeks to improve physical health, strength or flexibility, nutrition, or emotional well-being. The winner of this bonus prize will receive $5,000 and need not be a finalist.</p> </li> </ul> <p>These prizes are split between team members, or hoarded if the winning skill was built by just one person. To be eligible, skills must be submitted in English for the US Alexa Skills Store, and accompanied by a complete submission package to the&nbsp;<a href="" target="_blank">Alexa Skills Challenge: Life Hacks</a> with Devpost.&nbsp;</p> <h2>What Are We Looking For?</h2> <p>Your skill will be judged on:</p> <ul> <li> <p><strong>Novelty and quality of the idea,</strong>including creativity and originality, and the extent to which the skill provides a convenience, saves time, or improves an everyday task.</p> </li> <li> <p><strong>Implementation of the idea,</strong> including the user experience such as its ease-of-use, whether it performs as expected, includes fresh content, and more.</p> </li> <li> <p><strong>Potential impact of the idea,</strong> including the extent to which the skill is widely useful, might be customizable, might be extended to other scenarios, and more.</p> </li> <li> <p><strong>Quality of the submission package,</strong> including the description, video demo, and any other materials submitted to Devpost.</p> </li> <li> <p><strong>Customer engagement (to evaluate finalists only), </strong>including a variety of factors such as type and duration of usage, the number of new and recurring customers, customer ratings, and more.</p> </li> </ul> <h2>Your Time Begins Now</h2> <p>If you’re interested in participating—and we hope that you are—we recommend that you register for our upcoming webinar: <a href="" target="_blank">Tips for Building Voice-First Life Hacks with Alexa</a>. We'll share tips and best practices for building skills that help improve customer's productivity.<br /> <br /> Round 1 of the Life Hacks Challenge begins now. You have 7 weeks to build and submit your skill for certification and provide your submission package to Devpost by April 30. Submit sooner and take advantage of more time to get customer ratings and feedback to improve your skill as needed. On May 31, we’ll announce the 12 finalists. In round 2, we will promote the 12 finalists’ skills and customer engagement will become part of the judging criteria. On July 3, we’ll announce the winners.</p> <p>Enter the <a href="" target="_blank">Alexa Skills Challenge: Life Hacks</a> now.</p> <p>We look forward to seeing the engaging and productive skills you build!</p> /blogs/appstore/post/6f274f74-7bee-4fc7-8dab-b1f66fdb2682/how-non-artists-can-use-free-software-to-create-basic-sprites-and-models-for-their-games How Non-Artists Can Use Free Software to Create Basic Sprites and Models Emily Esposito Fulkerson 2018-03-15T16:33:10+00:00 2018-03-15T16:33:10+00:00 <p><img alt="Image10-nonartists-pixelArt_stepsCharacter.png" src="" style="display:block; margin-left:auto; margin-right:auto" />There are more freely available game assets than ever, but sometimes you want (or need) something custom. Not to worry! It's quite easy to get decent looking art using free software and minimal art skills.</p> <p>&nbsp;</p> <p style="text-align:justify"><img alt="Image10-nonartists-pixelArt_stepsCharacter.png" src="" style="display:block; margin-left:auto; margin-right:auto" />First impressions are important and to make your game stand out from the crowd, decent visuals are a must. There are more freely available game assets than ever, but sometimes you want (or need) something custom. Not to worry! It's quite easy to get decent looking art using free software and minimal art skills.</p> <p>In this post, I'll show you how to create a few basic vector sprites, pixel art drawings, and even some 3D modeling. We'll only use free software available for all operating systems. Let's get started!</p> <h2>Colors</h2> <p>No matter which of the available art styles or tools you’ll be using, you need a proper color palette. Creating one without inspiration or a sample can be really difficult, especially if you’re less artistically talented.</p> <p>Luckily, there are some great websites like <a href="" target="_blank">Flat UI Colors</a>, which is often used for web design, but also works for game art. If you’d like a more retro selection of colors, check out <a href="" target="_blank">Lospec’s palette list</a>. I’ve crafted my own color palette below, which you’re free to use in your own projects:<br /> &nbsp;</p> <div> <img alt="Image1-NonArtists-colors.png" src="" style="display:block; margin-left:auto; margin-right:auto" /> <br /> &nbsp; </div> <h2>Vector art</h2> <p style="text-align:justify">The main advantage of using vector art as opposed to bitmap art is that it scales up indefinitely. If you’d like to support retina displays or larger DPI displays in the future, vector can save a lot of time. <a href="" target="_blank">Inkscape</a> is free software that allows you to do just that. Its workflow is similar to software used by professionals and it's a great tool to get started with.</p> <p>Open up Inkscape and you'll be greeted by a blank canvas. On the left, you'll see a range of tools including a rectangle tool, a circle tool, pen, and text tools. Let's start by creating a basic character for our game!</p> <p><u><strong>Character</strong></u></p> <p style="text-align:justify">In order to keep things simple, we're not going to worry about limbs, posing, or animation. A slime character is good choice to start with. Select the circle tool, hold <em>CTRL / CMD</em>, and click and drag to create a perfectly round circle. In the menu bar select &quot;Path&quot; and then &quot;Object to Path&quot; to change the circle object to an editable shape, this way we can change the circle to have a flat bottom.</p> <p>Select the node select tool, click the circle, and drag the bottom handle up (hold <em>CTRL / CMD</em> to move only on a single axis). While you've got the circle selected, click any color on the bottom to change its color, in this case we'll go for a green color.<br /> &nbsp;</p> <p><img alt="Image2-nonartists-slimecharacter.png" src="" style="display:block; margin-left:auto; margin-right:auto" /></p> <p style="text-align:center"><em>Using the “node select tool” you can easily change shapes</em></p> <div> &nbsp; </div> <div> Click the circle tool again and create a new, smaller circle. Make the circle white and move it over the shape we created before, not perfectly in the middle, but slightly shifted to the right. Create a new circle again (even smaller), make it brown, and drag it into the white circle. Now we've got an eye! Select both the pupil and eye ball, copy and paste it, and move it to the left. Make sure to drag the pupil of the copied eye to the right to give it a cute, cross-eyed look. </div> <div> &nbsp; </div> <div> <img alt="Image3-nonartists-slimeCharacter_step2.png" src="" style="display:block; margin-left:auto; margin-right:auto" /> </div> <div style="text-align:center"> <em>Creating multiple circles and combine them to create eyes.</em> </div> <div> &nbsp; </div> <div> <div> Create a new circle and change it to an editable shape. Using the node select tool, move the upper handle down to create a laughing mouth shape. Move the mouth between the eyes and then down a bit. Add details to the sprite by adding randomly placed lighter colored spheres. If you'd like even more detail, you can add teeth or lighting to the top of the sprite. </div> <div> &nbsp; </div> <div> <img alt="Image4-nonartists-slimeCharacter_step3.png" src="" style="display:block; margin-left:auto; margin-right:auto" /> </div> <div style="text-align:center"> <em>Add a highlight by copying the original slime shape, arrange it behind and move up.</em> </div> </div> <div> &nbsp; </div> <div> <u><strong>Tiles</strong></u> </div> <div> &nbsp; </div> <div> <p style="text-align:justify">It's important that tile textures loop seamlessly. If they're placed next to each other, players may have difficulty realizing that it’s the same tile being repeated.</p> <p>In this case, it'll be easier to work using a grid. Click &quot;View&quot; and select &quot;Page Grid&quot; (or press #). Now if you hover over grid lines, Inkscape will let you know when you're working on the grid. Click the rectangle tool, hold <em>CTRL / CMD,</em> and create a square. Select the created square and change the color to brown.</p> <p>Select the curves/lines tool. Make a zig-zag pattern on the square by clicking on the far left, then a bit to the left and top, then back down again etc. Once you're done, select both the newly created line and the square, then click &quot;Path&quot; and select &quot;Division.” Now you can select a different color for the top part - select green to make it look like grass.<br /> &nbsp;</p> <p><img alt="Image5-nonartists-vectorTile_step1.png" src="" style="display:block; margin-left:auto; margin-right:auto" /></p> <p style="text-align:center"><em>Create a zig-zag wave, make sure it loops horizontally.</em><br /> &nbsp;</p> <p>Using the above mentioned tools, you’ll be able to add a highlight on top, create another zig-zag wave under the grass part for shadows, and even add some dirt texture using randomly placed circles. Experiment!</p> <p><img alt="Image6-nonartists-vectorTile_step2.png" src="" style="display:block; margin-left:auto; margin-right:auto" /></p> <p style="text-align:center"><em>Add a highlight on top, shadows under the grass, and random circles for detail.</em><br /> &nbsp;</p> <div> <u><strong>Background</strong></u> </div> <div> &nbsp; </div> <div> <p style="text-align:justify">Adding a background to your game can give a good feeling of depth. Start by creating a large rectangle and giving it a light blue color. Select the curves/lines tool again, click once (on the left side of the rectangle), and create a zig-zag pattern like before. Unlike before, click and drag on each point you place to create a smooth curve. Once you reach the far end of the rectangle, make sure you stop at the same height as you started to create a seamless background.</p> <p style="text-align:justify">Once done, select both the background rectangle and the new wavy line, and click &quot;Path&quot; and then &quot;Division.” Make the lower part of the rectangle a slightly darker color than the top part. Presto! Now you've got wavy hills.<br /> &nbsp;</p> <p style="text-align:justify"><img alt="Image7-nonartists-vectorBackground_part1.png" src="" style="display:block; margin-left:auto; margin-right:auto" /></p> <p style="text-align:center"><em>You can also add multiple wavy lines which are different in height for more layers.</em><br /> &nbsp;</p> <p>Using the circle and rectangle tool, you can create really basic tree shapes and a sun. Try to experiment using these basic shapes. Backgrounds don’t require a lot of detail.<br /> &nbsp;</p> <p><img alt="Image8-nonartists-vectorBackground_part2.png" src="" style="display:block; margin-left:auto; margin-right:auto" /></p> <p style="text-align:center"><em>Instead of trees, you add triangles (pyramids) and cacti for a desert scene.</em></p> <h2>Pixel art&nbsp;</h2> <p style="text-align:justify">There's a whole range of free software that allows for pixel art drawing. Some of my favorites are MS Paint (included with older versions of Windows),, GIMP, and the in-browser pixel editor by <a href="" target="_blank">Loscpec</a>. The best one depends on your personal preference, try them all and see which one you like best.</p> <p style="text-align:justify">It's often thought that pixel art is the easiest of all the options for visual art. It might be easy to get started, but it's incredibly hard to master.</p> <p style="text-align:justify"><u><strong>Tile</strong></u></p> <p style="text-align:justify">Larger sprites mean more work to get proper results, so let’s start out small. Draw a small 16 &times; 16 rectangle and apply a brown color. Place several random pixels within the rectangle in both a slightly lighter and a slightly darker color. Try some 2 &times; 2 squares too!</p> <p style="text-align:justify"><img alt="Image9-nonartists-pixelArt_steps.png" src="" style="display:block; margin-left:auto; margin-right:auto" /></p> <p style="text-align:center"><em>Rectangle, dots, grass layer, shadows and highlight detail on top.</em><br /> &nbsp;</p> <div> Like before, add a zig-zag pattern among the top for grass. Add some pixels below the zig-zag and above (in their respective darker colors) to add a bit of shading. Try to experiment with various types of shading. To finish, add a highlight on top and some random pixels in the grass area. </div> <div> &nbsp; </div> <div> <u><strong>Character</strong></u> </div> <div> &nbsp; </div> <div> Let's keep things basic and create a similar character as we did in vector art. Start with an outline and make sure to always place each pixel by hand, without dragging (free drawing) lines. Free drawing won’t give you as much control over each pixel and you’ll end up with crooked, dirty lines. </div> <div> &nbsp; </div> <div> <img alt="Image10-nonartists-pixelArt_stepsCharacter.png" src="" style="display:block; margin-left:auto; margin-right:auto" /> </div> <div style="text-align:center"> <em>Slime character sprite (two frame animation).</em> </div> <div style="text-align:center"> &nbsp; </div> <div> <p>Fill the shape and add a couple of eyes (try cross-eyed to add a cute effect). Add shading similar to the grass tile and a couple of random dots for texture. You can stretch the sprite a bit to add a second frame of animation for walking or jumping.</p> <p>Try to create additional frames, or create a coin for the user to pick-up using similar shading and drawing techniques.</p> <h2>3D models</h2> <p style="text-align:justify">You have probably already heard of <a href="" target="_blank">Blender</a>, a free and open source tool for 3D modeling. I would like to introduce you to a different piece of software though: <a href="" target="_blank">SketchUp</a> has recently added an in-browser version which is free and requires no installation. The downside is that the free version doesn’t allow exporting to file formats other than SKP (SKP files are compatible with Unity Engine (2017.3+) however).</p> <p>Head over to <a href="" target="_blank"></a>and create a (free) account to save models you’ve created. Creating a house is a great way to start, so let’s begin!</p> <p><u><strong>House</strong></u></p> <p>First, we’ll need a main shape for the building and we’ll start adding details. Select the “Rectangle” tool and click and drag in the scene view to create a new flat rectangle. While dragging, SketchUp will tell you when the shape is a perfect square.<br /> &nbsp;</p> <p><img alt="Image11-nonartists-modelHouse_step1.png" src="" style="display:block; margin-left:auto; margin-right:auto" /></p> <p style="text-align:center"><em>Create a flat shape first, then extrude.</em><br /> &nbsp;</p> <p>Next, select the “Push/Pull” tool. Click and drag on the flat rectangle to extrude the shape and create a cube. Use the “Line” tool to draw a line on top of the cube, dividing it in two.</p> <p style="text-align:justify">Select the “Move” tool, click the line and then move up. Now you’ve got a roof shape! Using these few tools, you’ll be able to add more details to the roof later on (like an overhang), but let’s keep it simple for now.</p> <p style="text-align:justify"><img alt="Image12-nonartists-modelHouse_step2.png" src="" style="display:block; margin-left:auto; margin-right:auto" /></p> <p style="text-align:center"><em>If we were playing Monopoly, this would be enough to convey a house.</em><br /> &nbsp;</p> <p>Adding doors and windows is just as easy. Select the “Rectangle” tool again and click on the side of the house to draw a door and window shape. Select the “Push/Pull” tool, which we used to create the cube before. Click inside the door and window(s), then push in by moving your mouse inwards. You’ll (hopefully) end up with a house similar to the one on the left.<br /> &nbsp;</p> <p><img alt="image13-nonartists-modelHouse_step3.png" src="" style="display:block; margin-left:auto; margin-right:auto" /></p> <p style="text-align:center"><em>Use the tools you’ve learned to add even more details!</em><br /> &nbsp;</p> <p>Using these few basic tools, you can add more details like a border, overhang, and even a chimney. Experiment with alignment and what the tools do. You’ll also find tools to create circles and arcs - try adding some columns!</p> <p><u><strong>Vehicle</strong></u></p> <p style="text-align:justify">Similarly to creating the house, we’ll start with a long rectangle. Use the “Push/Pull” tool to extrude the shape and create a box to sculpt our vehicle out of.</p> <p>Use the “Line” tool to draw (click and drag to place a line) a crude car shape on the side. Select the “Push/Pull” tool again and push away the top part, leaving only the shape of the vehicle. Select the whole vehicle (<em>CTRL / CMD + A</em>) and then hit G to create a component. This will make sure that if we add wheels, they won’t be merged with the body of the vehicle.<br /> &nbsp;</p> <p><img alt="image14-nonartists-modelVehicle_step1.png" src="" style="display:block; margin-left:auto; margin-right:auto" /></p> <p style="text-align:center"><em>Click and drag using the “Push/Pull” tool to remove the top shape.</em><br /> &nbsp;</p> <p>Next, we’ll create wheels. Select the “Rectangle” tool again and you’ll notice it opens a few different options including a “Circle” tool. Select the tool, click the side of the vehicle, move your mouse, and click again to create a circle. Use the “Push/Pull” tool to extrude the circle and create a wheel shape.<br /> &nbsp;</p> <p><img alt="image15-nonartists-modelVehicle_step2.png" src="" style="display:block; margin-left:auto; margin-right:auto" /></p> <p style="text-align:center"><em>You can copy and paste any shape, but components won’t merge with other planes.</em><br /> &nbsp;</p> <p>Select the wheel and press G to create a component. Now you can copy and paste the wheel along the sides of the car. You can use the “Move” tool to rotate wheels, too. Select a wheel and hover over it to reveal red crosses on each side. Click a red cross to rotate the wheel on the given axis.<br /> &nbsp;</p> <div> <img alt="image16-nonartists-modelVehicle_step3.png" src="" style="display:block; margin-left:auto; margin-right:auto" /> </div> <div style="text-align:center"> &nbsp; </div> <div style="text-align:center"> <em>Final car (on the left), learn about coloring in the next chapter.</em> </div> <div> &nbsp; </div> <p>You can use the “Offset” tool to easily create windows and hubcaps. Select the tool (hidden under the “Push/Pull” tool) and click any edge to create an offset edge on the inside or outside of the shape.</p> <p><u><strong>Trees</strong></u></p> </div> <div> <p style="text-align:justify">As a final example, let's create a tree. Start off with the “Circle” tool, click on the axis origin point, and create a circle shape on the floor similar to how we created rectangle shapes before. Extrude it upward so you’ll get a trunk.</p> <p style="text-align:justify">Select the whole top of the cylinder by double clicking the top. Then press S to scale the shape, hold CTRL (CMD), and click and drag one of the corners in. This will shape the trunk so it’s narrow on the top and wide on the bottom.</p> <p style="text-align:justify"><img alt="image17-nonartists-modelTree_step1.png" src="" style="display:block; margin-left:auto; margin-right:auto" /></p> <p style="text-align:center"><em>Select the top, press S and scale to narrow the shape.</em><br /> &nbsp;</p> <p>Select the trunk and press G to create a component. Using the “Polygon” tool click on the top part and create a flat polygon shape, use the extrude tool and narrow the top to create a similar shape as to the trunk.<br /> &nbsp;</p> <p><img alt="image18-nonartists-modelTree_step2.png" src="" style="display:block; margin-left:auto; margin-right:auto" /></p> <p style="text-align:center"><em>Starting to look like a tree.</em><br /> &nbsp;</p> <div> <p>Use the “Push/Pull” tool on the bottom of the newly created shape, then select the bottom and scale it down again (shown on the right in the image above).</p> <p>What’s a tree without colors? Select the “Paint” tool,choose a green color, and click the tree while holding SHIFT to color it. Then, double click on the trunk, select a brown color, and click while holding SHIFT again to color just the trunk.</p> <p><img alt="image19-nonartists-modelTree_step3.png" src="" style="display:block; margin-left:auto; margin-right:auto" /></p> <p style="text-align:center"><em>Final tree model, try to experiment with various shapes and sizes.</em></p> <h2>Final words</h2> <p>Creating art for games is all about experimenting, getting inspired, and messing around. Take your time to get familiar with various tools and choose the one that feels right. There’s no mistakes, just happy little accidents.</p> <p>&nbsp;</p> <div> &nbsp; </div> </div> <div> <img alt="Kenney-author-bio.png" src="" style="display:block; margin-left:auto; margin-right:auto" /> <br /> &nbsp; </div> <div style="text-align:center"> <em>Kenney Vleugels is an artist from the Netherlands who shares game assets (sprites, models, audio, fonts and more) with game developers.&nbsp;Recently, he founded <a href="" target="_blank">Pixeland </a>which is a physical community hub where every game developer in the world is welcome to learn, teach, meet, work, and play.</em> </div> <div> &nbsp; </div> </div> <div> &nbsp; </div> <div> &nbsp; </div> &nbsp; <div> &nbsp; </div> <div> &nbsp; </div> </div> <div> &nbsp; </div> <div> &nbsp; </div> </div> /blogs/alexa/post/bbdf8956-982b-4838-b171-d828e9f8fe05/announcing-the-winners-of-the-alexa-and-arduino-smart-home-challenge Announcing the Winners of the Alexa and Arduino Smart Home Challenge Glenn Cameron 2018-03-15T15:00:00+00:00 2018-03-15T15:00:00+00:00 <p>Now, after much deliberation, we are excited to announce the winners of the Alexa and Arduino Smart Home Challenge. Each winner will receive prizes designed to help them kick-start their prototype device into production.</p> <div> Last year we launched a <a href="" target="_blank">competition </a>with over $59,000 in prizes that invited makers to create the smart home gadgets of the future. Since then, Hackster's community has been busy inventing innovative smart home gadgets. The community used Arduino boards and Alexa to create a wide range of new and open-source devices with custom Alexa skills, from a glove that converts sign language into Alexa commands, to a mobile robot that feeds fish, to so <a href="" target="_blank">much more.</a> </div> <div> &nbsp; </div> <div> The entrants impressed us with their projects. To win, participants needed to build, document, and demo their skills and gadgets. A panel of judges scored the projects on a diverse set of criteria. Now, after much deliberation, we are excited to share the winning projects. Each winner will receive prizes designed to help them kick-start their prototype device into production. </div> <div> &nbsp; </div> <h2>Best Overall Skill + Gadget: <a href="" target="_blank">Wise Chameleon</a></h2> <div> <em>By Koray Kirli and Jeremy Johnson in Boston, Massachusetts</em> </div> <div> &nbsp; </div> <div> Wise Chameleon is a modular solution that allows you to turn anything into a smart home device. The demo shows the device being used to open Venetian blinds and a dog feeder. </div> <div> &nbsp; </div> <div> <iframe allowfullscreen="" frameborder="0" height="315" src="" width="560"></iframe> </div> <div> &nbsp; </div> <h2>Best Indoor Skill + Gadget: <a href="" target="_blank">Scent-terrific Smart Candle</a></h2> <div> <em>By Darian Johnson in Dallas, Texas</em> </div> <div> &nbsp; </div> <div> Scent-terrific turns traditional wax candles into smart lights that you can smell! Darian's invention is a very creative, and well-documented, use of mixing old with new smart home technology. </div> <div> &nbsp; </div> <div> <iframe allowfullscreen="" frameborder="0" height="315" src="" width="560"></iframe> </div> <div> &nbsp; </div> <h2>Best Outdoor Skill + Gadget: <a href="" target="_blank">Feed the Birds</a></h2> <div> <em>By Anastasiya Tyshko in Kiev, Ukraine</em> </div> <div> &nbsp; </div> <div> Feed the birds is an outdoor, solar-powered, voice-controlled bird feeder. Anastasiya's use of solar for power and GSM for connectivity is beneficial and an excellent example of IoT in the wild. </div> <div> &nbsp; </div> <div> <iframe allowfullscreen="" frameborder="0" height="315" src="" width="560"></iframe> </div> <div> &nbsp; </div> <h2>Best Wildcard Skill + Gadget: <a href="" target="_blank">Virtual Breadboard Smart Home Alexa Skill + Edge: Bit Gadget</a></h2> <div> <em>By James Caska in Breda, Netherlands</em> </div> <div> &nbsp; </div> <div> Drag and drop Alexa 'aware' controls in a virtual breadboard. James' product has an impressive service and seems very useful to those prototyping ideas. </div> <div> &nbsp; </div> <div> <iframe allowfullscreen="" frameborder="0" height="315" src="" width="560"></iframe> </div> <div> &nbsp; </div> <h2>Best Alexa Voice Service Integration: <a href="" target="_blank">Walle - Home Assistant</a></h2> <div> <em>By Dawid Liberda in Krakow, Poland</em> </div> <div> &nbsp; </div> <div> Walle is a complete home automation system with Alexa built in. It's an innovative approach to a traditional smart home control panel. </div> <div> &nbsp; </div> <div> <img alt="walle AVS" src="" style="height:510px; width:334px" /> </div> <div> &nbsp; </div> <div> Thanks to everyone who participated in the Alexa and Arduino Smart Home Challenge, and congrats to the winners! <a href="">Learn more about smart home development for Alexa</a> or visit the <a href="" target="_blank">contest project gallery</a> to see how each project was created. </div> <div> &nbsp; </div> /blogs/alexa/post/51eb71ea-1711-4719-8d67-ddb38df5dc0b/certification-jp-4th Alexaスキル認定へのヒント : スマートホームスキル編 Nahoko Hirabayashi 2018-03-15T05:45:51+00:00 2018-03-15T05:45:51+00:00 <p>スマートホームスキルの審査でよく見られる問題と回避するためのヒントをご紹介します。</p> <p><img alt="" src="" style="height:371px; width:1280px" /></p> <p><img alt="" src="" style="height:371px; width:1280px" /></p> <p>今回はスマートホームスキルAPIを使用して実装されたスキルの要件と、よくある問題と回避するためのヒントをご紹介します。</p> <p>スマートホームスキルの詳しい認定要件については、<a href="">スマートホームスキル公開のガイド</a>を参照してください。</p> <p>&nbsp;</p> <h3><strong>スマートホームスキルによくある問題を回避しましょう</strong></h3> <p>審査でよく見られる問題と回避するためのヒントをご紹介します。</p> <p>&nbsp;</p> <ul> <li>対象言語によってユーザーエクスペリエンスが異なる</li> </ul> <p>多言語に対応するスキルは、各言語で同じユーザーエクスペリエンスを提供する必要があります。多言語に対応するスキルを開発している場合は、すべての言語でスキルの各機能が適切に動作するか事前にテストしてください。</p> <p>&nbsp;</p> <ul> <li>テスト手順でテストアカウントの情報を提供していない</li> </ul> <p>審査に必要なテスト手順は、開発者コンソールの「公開情報」の「テスト手順」に記載していただく必要があります。こちらにテストアカウントの情報(Emailアドレスやパスワード)が記載されていないとテストを行うことができません。またテストの際にデバイスが検出されない場合がありますので、審査部門がテストを終え、お手元に審査結果が届くまでデバイスを検出できる状態にしておいてください。</p> <p>&nbsp;</p> <ul> <li>プライバシーポリシーにリンクが記載されていない</li> </ul> <p>開発者コンソールの「プライバシーとコンプライアンス」の「プライバシーポリシー URL」に、該当のスキルに適用するプライバシーポリシーのリンクを記載してください。「利用規約 URL」には、スキルの利用規約のリンクを記載してください。また事前にリンクにアクセスできるか確認してください。</p> <p>&nbsp;</p> <ul> <li>詳細な説明やサンプルフレーズがユーザーガイダンスに沿っていない</li> </ul> <p>スキルの詳細な説明は、ユーザーがスキルを知るために重要です。日本語スキルを開発する場合は、日本語で明記し、文法上誤りがないか確認してください。これはサンプルフレーズにも当てはまります。</p> <p>&nbsp;</p> <p>詳細説明についてのガイダンスは、<a href="">こちら</a>を参照してください。</p> <p>サンプルフレーズに関するガイダンスは<a href="">こちら</a>を参照してください。</p> <p>&nbsp;</p> <p><strong>スキル認定に関する関連記事</strong></p> <p><a href="">Alexaスキル認定へのヒント集</a></p> <p><a href="">Alexaスキル認定へのヒント:サンプルフレーズ編 </a></p> <p><a href="">Alexaスキル内の広告について</a></p> <p>&nbsp;</p> <p>皆様からのフィードバックは、私たちにとってとても貴重なものです。スキルの認定に関するご意見がありましたら、<a href=";sc_channel=website&amp;sc_publisher=devportal&amp;sc_campaign=Conversion_Contact-Us&amp;sc_assettype=conversion&amp;sc_team=us&amp;sc_traffictype=organic&amp;sc_country=united-states&amp;">お問い合わせフォーム</a>からいつでもお送りください。</p> <p>また、 スキル開発時に分からないことがあれば、<a href="">Alexa開発者フォーラム</a>もご利用ください。フォーラム上でいただいたご質問に、担当がお答えいたします。</p> /blogs/alexa/post/9b2f4685-3ce9-4ab1-8b1e-e5ae8ff6d230/amazon-alexa-is-coming-to-gdc-2018 Amazon Alexa Is Coming to GDC 2018! Karen Yue 2018-03-14T21:51:23+00:00 2018-03-14T21:51:23+00:00 <p style="margin-left:0in; margin-right:0in"><img alt="GDC" src="" style="height:240px; width:954px" /></p> <p>Calling all game developers! GDC is next week, and we want to invite you to join us in San Francisco for some exciting learning opportunities about building voice-first gaming experiences.</p> <p style="margin-left:0in; margin-right:0in"><a href=""><img alt="GDC" src="" style="height:240px; width:954px" /></a></p> <p style="margin-left:0in; margin-right:0in">Calling all game developers! GDC is next week, and we want to invite you to join us in San Francisco for some exciting learning opportunities. Held annually, GDC is the world's largest professional game industry event where programmers, artists, producers, game designers, and others involved in the development of interactive games and virtual reality gather to exchange ideas and shape the future of the industry.</p> <p>This year, Alexa is joining other teams across Amazon to deliver content that is organized around <a href="" target="_blank">five key opportunities for game developers</a>: Build Fast, Stay Ahead, Ship Your Game, Pay Your Bills, and Keep It Going. Join us for <a href="" target="_blank">two full days of educational sessions</a> located at Moscone West, as well as <a href="" target="_blank">classroom sessions</a> offered at the Amazon Booth 1001. You will hear from Amazon experts across AWS, Twitch, Lumberyard, and Alexa&nbsp;as they address topics that include the future of mobile gaming and competitive gameplay, cloud-connected features, multiplayer infrastructure, and building voice-first games for Alexa.</p> <h2>Attend Alexa Educational Sessions</h2> <p><strong>An Introduction to Building Voice-First Games on Alexa</strong></p> <p>Voices have always been in the game. What they do next is up to you. In this session, we will talk about bringing your IP to Alexa and engaging with players on tens of millions of Echo devices. The Alexa team will show how voice was used to reinterpret the classic Hasbro board game <em>Trivial Pursuit</em>, and create <em>Trivial Pursuit Tap</em> for Alexa players. Walk out of this session with everything you need to start developing Alexa games, and how to integrate with gaming-friendly Alexa Gadgets like Echo Buttons.</p> <p><em>Date: Tuesday, March 20<br /> Time: 4–5 pm<br /> Location: Room 3001/3003 (Moscone West)</em></p> <p><strong>Building Games for Amazon Echo Buttons </strong></p> <p>We will demonstrate how to build fun, interactive games for Amazon Alexa and Echo Buttons. Create games for individuals, friends, and families that enable players to buzz in, follow the sequence of LED lights, and more.</p> <p><em>Date: Wednesday, March 21<br /> Time: 1–1:30 pm<br /> Location: Amazon, Booth 1001 (Moscone South)</em></p> <h2>Stop by the Alexa Game Rooms to Learn About Echo Buttons and Destiny 2</h2> <p>Swing by the soundproof rooms at Amazon Booth 1001 to learn how to build games for Alexa, or integrate Alexa into live video game experiences. &nbsp;</p> <p><strong>Build an Alexa Game for Echo Buttons</strong></p> <p>Meet members from the Alexa team that introduced fun gaming experiences for Echo Buttons – the first Alexa Gadget in a new category of connected products and developer tools. Learn how to start developing your own Alexa games, and how to integrate with gaming-friendly Alexa Gadgets like Echo Buttons.</p> <p><strong>Destiny 2, and How to Incorporate Alexa into Your Game Design</strong></p> <p>Meet members from the Activision, AKQA, and Alexa teams, who introduced one of Alexa’s most innovative and integrated skills to date for a live video game: Destiny 2. This Alexa skill connects the world of Destiny 2 with compatible Amazon Alexa devices via real-time voice commands, and offers an exciting new way for gamers to interact with the Destiny 2 game on PS4, Xbox One or PC. It’s the first of its kind to integrate across multiple gameplay features of a video game, connecting gamers to the massive, exciting world of Destiny 2 in real life.</p> <p><em>Date: Wednesday, March 21 – Friday, March 23<br /> Location: Amazon, Booth 1001 (Moscone South)</em></p> <p>We look forward to connecting with you in San Francisco at one of our educational sessions and during the GDC Expo at Booth 1001!</p> /blogs/alexa/post/38054d02-9b98-49d9-9447-036e067e8d86/alexa-skills-kit-et-alexa-voice-service-arrivent-en-france Alexa Skills Kit Expands to France, Alexa Voice Service in Developer Preview | Alexa Skills Kit et Alexa Voice Service Arrivent en France Noemie Cornu 2018-03-13T07:17:07+00:00 2018-03-13T07:25:21+00:00 <p><img alt="" src=" Size: 17571 bytes, 954 x 240 pixels" style="height:240px; width:954px" /></p> <p>Today, we’re excited to announce that developers can start building experiences for customers in France using the Alexa Skills Kit. Skills that developers create now will be available for customers when Alexa launches in France later this year.</p> <p><img alt="" src=" Size: 17571 bytes, 954 x 240 pixels" style="height:240px; width:954px" /></p> <h2>Alexa Skills Kit Expands to France, Alexa Voice Service in Developer Preview</h2> <p>Today, we’re excited to announce that developers can start building voice experiences for customers in France using the Alexa Skills Kit. Skills that developers create now will be available for customers when Alexa launches in France later this year. Commercial hardware manufacturers developing Alexa-enabled products for French customers can request early access to the invite-only Alexa Voice Service developer preview.</p> <hr /> <h2>Alexa Skills Kit Arrive en France, Alexa Voice Service en Preview pour D&eacute;veloppeur</h2> <p>Nous sommes ravis d'annoncer que les d&eacute;veloppeurs peuvent d&egrave;s &agrave; pr&eacute;sent commencer &agrave; cr&eacute;er des exp&eacute;riences pour les clients en France en utilisant Alexa Skills Kit. Les skills que les d&eacute;veloppeurs cr&eacute;ent maintenant seront disponibles pour les clients lorsque Alexa se lancera en France plus tard cette ann&eacute;e. Les fabricants de mat&eacute;riel disponibles dans le commerce d&eacute;veloppant des appareils avec Alexa int&eacute;gr&eacute; pour les clients fran&ccedil;ais peuvent demander un acc&egrave;s anticip&eacute; &agrave; la preview pour d&eacute;veloppeur Alexa Voice Service disponible sur invitation.</p> <h2>Cr&eacute;er de Nouvelles Skills pour Alexa avec Alexa Skills Kit</h2> <p><a href="">Alexa Skills Kit (ASK)</a> est un ensemble d'API et d'outils en libre-service qui permettent aux d&eacute;veloppeurs de d&eacute;velopper rapidement de nouvelles capacit&eacute;s vocales, ou skills, pour Alexa. Les d&eacute;veloppeurs n'ont pas besoin d’&ecirc;tre des experts en reconnaissance de la parole ou en compr&eacute;hension du langage naturel. Alexa fait tout le travail pour entendre, comprendre et traiter la requ&ecirc;te orale du client afin que les d&eacute;veloppeurs n'aient pas &agrave; le faire.</p> <h2>Comment D&eacute;velopper une Skill Alexa</h2> <p>Il est facile de commencer &agrave; cr&eacute;er des exp&eacute;riences vocales pour Alexa. Explorez nos <a href="">tutoriels</a>, regardez nos <a href="">webinars &agrave; la demande</a> ou <a href="">assistez &agrave; un &eacute;v&eacute;nement</a> pr&egrave;s de chez vous pour apprendre &agrave; d&eacute;velopper rapidement une skill. Si vous voulez construire une skill Alexa multilingue, lisez notre <a href="">documentation technique</a> pour apprendre &agrave; cr&eacute;er une skill dans tous les mod&egrave;les de langue, y compris le fran&ccedil;ais, l'anglais pour les &Eacute;tats-Unis, l'Inde, le Royaume-Uni, le Canada et l'Australie, ainsi que l’allemand, et le japonais.</p> <h2>Mettez &agrave; jour votre Skill Existante et Touchez de Nouveaux Clients</h2> <p>Si vous &ecirc;tes d&eacute;j&agrave; un d&eacute;veloppeur Alexa et que vous souhaitez adresser de nouveaux clients en France, vous pouvez optimiser votre skill existante en ajoutant le nouveau mod&egrave;le de langue en fran&ccedil;ais en suivant ces <a href="">&eacute;tapes simples</a><strong>.</strong></p> <h2>Int&eacute;grez Alexa &agrave; Vos Appareils avec Alexa Voice Service</h2> <p><a href="">Alexa Voice Service (AVS)</a> permet aux d&eacute;veloppeurs d'int&eacute;grer Alexa directement dans leurs produits, apportant la commodit&eacute; du contr&ocirc;le vocal &agrave; tout appareil connect&eacute;. AVS fournit une suite de ressources, notamment des API, des kits de d&eacute;veloppement hardware, des kits de d&eacute;veloppement software et de la documentation. Plus tard cette ann&eacute;e, les fabricants d'appareils pourront tirer parti de ces ressources pour lancer des appareils avec Alexa int&eacute;gr&eacute; en France avec un acc&egrave;s au mod&egrave;le de langue fran&ccedil;aise et &agrave; des services r&eacute;gionaux comme Alexa skills. Les fabricants d'appareils disponibles dans le commerce peuvent demander un acc&egrave;s anticip&eacute; &agrave; notre <a href="">preview pour d&eacute;veloppeur</a> sur invitation.</p> <h2>Commencez &agrave; D&eacute;velopper des Skills Aujourd'hui</h2> <p>Besoin d'aide pour d&eacute;marrer ? Connectez-vous avec la communaut&eacute; Alexa sur nos <a href="">forums d&eacute;veloppeurs</a>. Nous avons h&acirc;te de voir ce que vous d&eacute;veloppez.</p> <h2>Obtenez de l'Aide Technique aupr&egrave;s de l'&eacute;quipe Alexa</h2> <p>Assistez &agrave; nos &eacute;v&eacute;nements dans les prochaines semaines. Ces sessions sont l'occasion pour vous d’apprendre &agrave; d&eacute;velopper rapidement une skill et d'obtenir des r&eacute;ponses &agrave; vos questions aupr&egrave;s d'un &eacute;vang&eacute;liste ou d'un solutions architect Alexa.</p> <h2>Webinar</h2> <p>Bonjour Alexa: Introduction &agrave; Alexa Skills Kit (ASK) - <strong>Mardi 27 mars &agrave; 14h30</strong> - <a href="">Inscrivez-vous maintenant</a></p> <h2>Workshops</h2> <p>Une formation pratique pour en apprendre davantage sur la conception de la voix et rencontrer d'autres d&eacute;veloppeurs&nbsp;: Alexa Skills Workshop (Beginner) - <strong>Paris, 4 Avril 2018</strong> - <a href="">Inscrivez-vous maintenant</a></p> <h2>Office Hours</h2> <p>Un expert r&eacute;pondra &agrave; vos questions - Alexa Office Hours hebdomadaires - <strong>30 Mars 2018</strong>&nbsp;- <a href="">Inscrivez-vous maintenant</a></p> <h2>Publiez une Skill, Gagnez des goodies</h2> <p>Nous offrons un <a href="">t-shirt Alexa en &eacute;dition limit&eacute;e</a> aux d&eacute;veloppeurs qui publient une skill Alexa pour la France. Commencez rapidement en utilisant nos <a href="">templates et tutoriels</a></p> /blogs/alexa/post/eaad8183-585e-4e6c-897d-8710d94b121f/how-to-update-your-skills-for-france How to Update Your Alexa Skills for France Noemie Cornu 2018-03-13T07:16:41+00:00 2018-03-13T07:16:41+00:00 <p>Today, we announced that Amazon Alexa and Alexa-enabled devices are coming to France later this year. You can start using the <a href="">Alexa Skills Kit (ASK)</a> to build skills for customers in France using the new French language model.</p> <p>Today, we announced that Amazon Alexa and Alexa-enabled devices are coming to France later this year. You can start using the <a href="">Alexa Skills Kit (ASK)</a> to build skills for customers in France with the new French language model.</p> <p>If you are new to skill development, check out this <a href="" target="_blank">detailed walkthrough</a> to get started.</p> <p>If you’re an experienced Alexa developer, you can enhance your existing skill by extending it to support the new language model for France. This tutorial will show you how you can add support for the French model for your existing skills. It will also show you how you can use the Alexa Skills Kit to have Alexa respond based on locales, and how to update your AWS Lambda function so your skill delivers the right content to your customers in each of the supported regions—all from a single code base.</p> <h2>Part 1: Add the New Language Model for Your Skill</h2> <p>1. Navigate to your existing skill on the <a href="">Amazon developer portal</a>. If the Portal lets you select between the old version and the new version, select the new version.</p> <p style="margin-left:36.0pt"><img src="" style="height:83px; width:601px" /></p> <p>2. Click on the language dropdown on the top right of the screen and select the last option: “Language Settings.” In this example, the skill already has language models for English (US), English (UK), English (India), English (Canada), and English (Australia).</p> <p style="margin-left:36.0pt"><img src="" style="height:182px; width:268px" /></p> <p>3. Follow the steps below to complete the Skill Information tab to make the French language as an option in the language dropdown:</p> <p><br /> <img src="" style="height:227px; width:440px" /><br /> &nbsp;</p> <ul> <li>Click <strong>“+ Add New Language</strong>”</li> <li>Select “<strong>French</strong>”</li> <li>Click <strong>Save</strong></li> </ul> <p style="margin-left:72.0pt"><img src="" style="height:185px; width:210px" /></p> <p>4. Provide the interaction model for the French version. Copy the interaction model from one of the English versions of our skill, and translate the sample utterances and slot values and synonyms. Switch to the US version by clicking on the language dropdown in the skill builder, and choose English (US).<br /> <br /> <img src="" style="height:183px; width:212px" /><br /> &nbsp;</p> <p>5. Click on <strong>Code Editor</strong> on the left side bar. This displays the complete interaction model for the skill in JSON format.<br /> <br /> <img src="" style="height:275px; width:376px" /></p> <p>6. Select and copy all of the JSON in the code window.</p> <p>7. Switch back to <strong>French</strong> using the dropdown from Step 4.</p> <p>8. Click on <strong>Code Editor</strong> again, and paste the JSON into the code window, replacing the existing JSON.</p> <p>9. Translate all sample utterances, slot values, and slot synonyms.</p> <p>10. Click on the <strong>Save Model</strong> button.</p> <p>11. Click on the <strong>Build Model</strong> button.</p> <p><img src="" style="height:139px; width:365px" /></p> <p>We now have the language model built for <strong>French</strong>. In real development workflow, you will probably build the skill voice interaction model JSON document programmatically, based on different files you have with sample utterances and slot values.</p> <p>If your interaction model uses any <a href="">built-in slot types</a>, you may need to make changes to ensure that the types are supported in the locale. For example, the AMAZON.US_FIRST_NAME is supported in English (US), English (UK), English (Canada), and German. An equivalent first name slot type, AMAZON.FirstName, is available for French, English (India), English (Australia), and Japanese. See the <a href="">Slot Type Reference</a> for a list of slot types for each supported locale.</p> <p>Once you have finished updating your interaction model for French, you need to customize the responses your skill returns for the different locales that you support. You can do this by updating your lambda function.</p> <h2>Part 2: Update the Lambda Function</h2> <p>Now that your skill is ready to support multiple regions, you may want to update your lambda function to ensure that your skill provides responses tailored to each supported region.</p> <p>At the very least, translate the strings the skill is sending to Alexa to French to render with the voice of Alexa. You can also use this technique to use different strings for different variations of English. For instance, you may want to greet your customers with “G’day” in Australia, “Hello” in Canada and the UK, “Namaste,” in India, &quot;Hi&quot; in the US, and “Bienvenue” in France. The Alexa Skills Kit makes that really simple. Here is an example of how you would do this with the <a href="" target="_blank">Alexa Skills Kit SDK for Node.js</a>. For brevity, in this example, all English-based languages are sharing the same set of strings.</p> <p><strong>Step 1: Set the Language Strings for Each Region</strong></p> <p>To do this, we define all user-facing language strings in the following format:</p> <pre> <code class="language-javascript">const EnglishStrings = { &quot;WELCOME_MSG&quot;: &quot;Welcome to {{ skillName }}&quot;, &quot;HELP_MSG&quot;: &quot;Welcome to {{ skillName }}. You can play, stop, resume listening. How can I help you ?&quot;, &quot;UNHANDLED_MSG&quot; : &quot;Sorry, I could not understand what you've just said.&quot;, &quot;RESUME_MSG&quot; : &quot;Resuming {{ skillName }}&quot;, &quot;STOP_MSG&quot; : &quot;Goodbye.&quot; }; const FrenchStrings = { &quot;WELCOME_MSG&quot;: &quot;Bienvenue sur {{ skillName }}&quot;, &quot;HELP_MSG&quot;: &quot;Bienvenue sur {{ skillName }}. Vous pouvez d&eacute;marrer, arr&ecirc;ter ou reprendre. Que souhaitez-vous faire ?&quot;, &quot;UNHANDLED_MSG&quot; : &quot;D&eacute;sol&eacute;, je n'ai pas compris ce que vous avez dit.&quot;, &quot;RESUME_MSG&quot; : &quot;Je red&eacute;marre {{ skillName }}&quot;, &quot;STOP_MSG&quot; : &quot;au revoir !&quot; }; const languageString = { &quot;en-GB&quot;: { &quot;translation&quot;: EnglishStrings }, &quot;en-US&quot;: { &quot;translation&quot;: EnglishStrings }, &quot;en-IN&quot;: { &quot;translation&quot;: EnglishStrings }, &quot;en-CA&quot;: { &quot;translation&quot;: EnglishStrings }, &quot;en-AU&quot;: { &quot;translation&quot;: EnglishStrings }, &quot;fr-FR&quot;: { &quot;translation&quot;: FrenchStrings } };</code></pre> <p>As you can see, languageStrings object contains six objects, one for each supported English language (en-CA, en-US, en-GB, en-IN, and en-AU) and one for French. The object names are identical to the value of the locale property that is passed to our skill when it is invoked by Alexa. This tells us the language model the user’s device is configured to use so that Alexa can respond with the appropriate language. If you wanted to support German and Japanese, you would add additional objects for 'de-DE' and 'ja-JP' with appropriate translations.</p> <p>You can see this in action by looking at the JSON request sent to your skill through the Service Simulator. When testing in the simulator, be sure to select the tab for the language you want to test. In our example, when testing from the French language, the request sent to the skill includes the fr-FR locale:</p> <p><img src="" style="height:267px; width:531px" /></p> <p>Each language has a translations object within languageStrings. This is where we specify any properties that are different for each language. For our example, we have WELCOME_MESSAGE and SKILL_NAME as part of the language strings. You can add more strings as you find relevant.</p> <p><strong>Step 2: Enable Internationalization for Your Skill Using the Alexa Skills Kit SDK</strong></p> <p>To enable string internationalization&nbsp;features in alexa-sdk, we set resources to the languageStrings object we created above:</p> <pre> <code class="language-javascript">exports.handler = (event, context, callback) =&gt; { var skill = alexa.handler(event, context, callback); skill.appId = constants.appId; // To enable string internationalization (i18n) features, // set a resources object. skill.resources = languageStrings; skill.registerHandlers( handler ); skill.execute(); }; </code></pre> <p><strong>Step 3: Access the Language Strings in Your Code</strong></p> <p>Once you are done defining and enabling language strings, you can access these strings using the this.t()<strong> </strong>function. Strings will be rendered in the language that matches the locale of the incoming request.</p> <p>This handler for the LaunchRequest retrieves the localized strings for the welcome message and skill greeting, then assembles a complete welcome message for the skill. For a customer using an English (US) device, this would return the speech output: &quot;Welcome to Maxi 80&quot; while for a customer using a French device, this same code would return the speech output “Bienvenue sur Maxi 80”.</p> <pre> <code class="language-javascript">'LaunchRequest': function () { this.response .speak(this.t('WELCOME_MSG')) .listen(this.t('HELP_MSG')); this.emit(':responseReady'); }</code></pre> <p>That’s all that it takes to update your skill to be available for customers in France. We are excited that Alexa is available in France, and we can't wait to see what you build.</p> <p>Check out our documentation on <a href="">developing skills in multiple languages</a> to learn more about how you can use the Alexa Skills Kit to create multi-language skills.</p> <h2>Learn More</h2> <ul> <li>Alexa Skill Templates and Sample Code on <a href=";q=skill&amp;type=&amp;language=" target="_blank">GitHub</a></li> <li><a href="" target="_blank">Alexa Cookbook</a></li> <li><a href="" target="_blank">Alexa Skill Development Courses on Codecademy</a></li> <li><a href="">Alexa Skills Kit Training Resources</a></li> <li><a href="">Alexa Developer Forums</a></li> <li><a href="">Alexa Developer Blog</a></li> </ul> <h2>Useful Blog Posts</h2> <ul> <li><a href="">Tips for a Successful Alexa Skill Certification</a></li> <li><a href="">Why console.log() Is Your Friend</a></li> <li><a href="">Export Your Amazon Lex Bot Schema to Use in Your Alexa Skill</a></li> <li><a href="">Getting Started with the Alexa Skill Management API and the Alexa Skills Kit Command-line Interface</a></li> <li><a href="">Publishing Your Skill Code to Lambda via the Command Line Interface</a></li> <li><a href="">Alexa Account Linking: 5 Steps to Seamlessly Link Your Alexa Skill with Login with Amazon</a></li> </ul> <h2>SDKs</h2> <ul> <li><a href="" target="_blank">Node.js</a></li> <li><a href="" target="_blank">Java</a></li> </ul> /blogs/alexa/post/37e732b7-48fa-4940-9f12-9ffde7eeeaf8/alexa-skill-recipe-randomize-your-responses-to-add-variety-to-your-skill Alexa Skill Recipe: Randomize Your Responses to Add Variety to Your Skill Jennifer King 2018-03-13T06:00:00+00:00 2018-03-13T15:19:42+00:00 <p>Make the interactions of your skill feel more conversational and memorable by adding variety to your responses. Check out our favorite code snippets you can use to surprise and delight your customers with voice.</p> <p><em>Creating an Alexa skill is a lot like cooking a delicious meal. There are several ingredients, and recipes based on your taste and preferences. The </em><a href="" target="_blank"><em>Alexa Skill Building Cookbook</em></a><em> on GitHub gives you the ingredients and recipes to build engaging Alexa skills, using short code samples and guidance for adding features to your skill. With each installment of the Alexa skill recipe series, we’ll introduce you to a new recipe that can help you improve your skill design and user engagement. You’re the chef. Let’s get cooking!</em></p> <p>When <a href="" target="_blank">designing engaging Alexa skills</a>, one of the things we recommend you always aim for is to add a bit of variety to your responses to surprise and delight your customers. If you think about it, this is actually in stark contrast with how we are used to doing things with mobile and web design.</p> <p>With mobile and web design, it’s important to provide a consistent customer experience every time. Layout, color schemes, and names always stay the same so users don’t have to relearn the user interface (UI) with each visit. But with voice, it’s important to have variety. People may not mind scanning the same web page times over time, but no one wants to have the same conversation time and again.</p> <p>One way to add variety to your skill is have your skill choose a random word or phrase from a list of welcome greetings, re-prompts, confirmations, etc. For example, think of the many different ways Alexa can say “Hello” (think: &quot;howdy&quot;, “hi”, “good day”), or the many ways Alexa can say “OK” (think: “Got it,” “Thanks,” “Sounds good,” “Great,” and so on). You can use these opportunities to inject variety, color, and humor to your skill. You can even prepare clever responses to customers’ requests for features your skill doesn’t yet support.</p> <p>By seizing these opportunities, you can make your interactions feel more natural, conversational, and even memorable.</p> <p>With this skill recipe, I’ll walk you through some code snippets you can use to add variety to your responses, which will help your skill surprise and delight your customers.</p> <h2>Randomize Your Welcome Greetings and Confirmation Messages</h2> <p>A welcome message is what your skill responds back with when the user first launches your skill (LaunchRequest), or comes back to it (IntentRequest). It can be tempting to hardcode your welcome message, and be done with it. This, however can be monotonous and even annoying for the users. The design recommendation here is to add a bit of personalization and variety to your welcome messages.</p> <p>Another way to add variety to your skill’s welcome messages is to go a step further and personalize the message based on usage patterns. If the user launches the skill for the first time, they might get a more guided welcome message, like “Welcome to Recipe Fu. I can help you find quick and delicious recipes. Let’s start with your cuisine preferences. You can say Mexican, Thai, Italian, French, or Indian. What cuisine are you in the mood for?”</p> <p>Compare this to a more personalized response when the user comes back to the skill – “Welcome back. What cuisine are you in the mood for?” Check out <a href="">How to Adapt Your Skill's Responses Based on Usage Patterns</a> for more guidance.</p> <p>The same holds true for confirmation messages and re-prompts. Instead of responding with “sorry, I didn’t get that,” respond with some variety.</p> <p>Here’s how you can start randomizing your greetings and confirmation messages:</p> <p><strong>Step 1:</strong> Create a list of phrases you would like to use as your welcome greeting.</p> <pre> <code>const welcomeGreetings = ['hello','howdy','hi', 'good day']; // Array of items for welcome greetings const confirmations = [‘ok’,’got it’,’roger that', ’sounds good’, ‘great']; // Array of items for confirmations</code></pre> <p>If you’re using Node.js, you would typically place this at the start of your index.js file, as shown in the image below:</p> <p><img alt="" src="" /></p> <p><strong>Step 2:</strong> Create the randomPhrase() function which will be used to pick a random item from the list we created in Step 1.</p> <pre> <code>function randomPhrase(myData) { // the argument is an array [] of words or phrases var i = 0; i = Math.floor(Math.random() * myData.length); return(myData[i]); }</code></pre> <p>Here’s a screenshot showing the placement of this function in your index.js file.</p> <p><img alt="" src="" /></p> <p><strong>Step 3:</strong> Call the randomPhrase() function from the intent handlers.</p> <p>Finally, we are ready to call our randomPhrase function from our intent handlers. To do that, use the following emit statement:</p> <pre> <code>this.response.speak(“Here’s your random welcome greeting, “ + randomPhrase(welcomeGreetings)) //or this.response.speak(“Here’s your random confirmation message, “ + randomPhrase(confirmations))</code></pre> <p>Here’s a screenshot showing the entire handler for our welcomeIntent.</p> <p><em><img alt="" src="" /></em></p> <p>The welcome response from your skill would be different each time the customer launches your skill, thereby adding a bit of variety and personality to your skill. You could potentially use the same trick to randomize speechcons, and also the recently announced <a href="">Alexa Skills Kit (ASK) sound library</a>.</p> <h2>Randomizing Speechcons</h2> <p>Speechcons are special words and phrases that are pronounced more expressively by Alexa. Speechcons are available for the <a href="">US</a>, <a href="">UK</a>, <a href="">DE</a>, <a href="">IN</a>, <a href="">AU</a>, <a href="">CA</a> and <a href="">JP</a> languages. Speechcons are a great way to add the element of surprise and delight for your customers. You can take it a step further by adding variety to your speechcons by using the same randomize function.</p> <p><strong>Step 1: </strong>Create a list of speechcons you would like to use.<strong> </strong></p> <p>For example, here's a list of “correct&quot; and “incorrect&quot; speechcons that our <a href="" target="_blank">Quiz Skill template</a> uses when a user gets a correct answer.</p> <pre> <code>const speechConsCorrect = [&quot;Booya&quot;, &quot;All righty&quot;, &quot;Bam&quot;, &quot;Bazinga&quot;, &quot;Bingo&quot;, &quot;Boom&quot;, &quot;Bravo&quot;, &quot;Cha Ching&quot;, &quot;Cheers&quot;, &quot;Dynomite&quot;, &quot;Hip hip hooray&quot;, &quot;Hurrah&quot;, &quot;Hurray&quot;, &quot;Huzzah&quot;, &quot;Oh dear. Just kidding. Hurray&quot;, &quot;Kaboom&quot;, &quot;Kaching&quot;, &quot;Oh snap&quot;, &quot;Phew&quot;, &quot;Righto&quot;, &quot;Way to go&quot;, &quot;Well done&quot;, &quot;Whee&quot;, &quot;Woo hoo&quot;, &quot;Yay&quot;, &quot;Wowza&quot;, &quot;Yowsa”]; const speechConsWrong = [&quot;Argh&quot;, &quot;Aw man&quot;, &quot;Blarg&quot;, &quot;Blast&quot;, &quot;Boo&quot;, &quot;Bummer&quot;, &quot;Darn&quot;, &quot;D'oh&quot;, &quot;Dun dun dun&quot;, &quot;Eek&quot;, &quot;Honk&quot;, &quot;Le sigh”, &quot;Mamma mia&quot;, &quot;Oh boy&quot;, &quot;Oh dear&quot;, &quot;Oof&quot;, &quot;Ouch&quot;, &quot;Ruh roh&quot;, &quot;Shucks&quot;, &quot;Uh oh&quot;, &quot;Wah wah&quot;, &quot;Whoops a daisy&quot;, &quot;Yikes&quot;]; </code></pre> <p><strong>Step 2</strong>: We will use our randomPhrase() function we defined earlier to pick a random Speechcon from this list, like so:</p> <pre> <code>this.response.speak(randomPhrase(speechConsCorrect) ‘, that is correct!')</code></pre> <h2>Randomizing Sounds from the ASK Sound Library</h2> <p>You can also do the same for sounds from the ASK sound library, which provides hundreds of built-in audio clips that you can add to your Alexa skills. You can choose the library sounds from several categories including, cartoon, home, human, nature, and transportation, among others. Here’s a <a href="" target="_blank">full list</a> of audio clips available through the sound library.</p> <pre> <code>const soundlibraryURL = &quot;; const natureSounds =['nature/amzn_sfx_earthquake_rumble_01.mp3','nature/amzn_sfx_earthquake_rumble_02.mp3','nature/amzn_sfx_lightning_strike_01.mp3','nature/amzn_sfx_lightning_strike_02.mp3','nature/amzn_sfx_oars_splashing_rowboat_01.mp3','nature/amzn_sfx_ocean_wave_1x_01.mp3','nature/amzn_sfx_ocean_wave_1x_02.mp3','nature/amzn_sfx_ocean_wave_on_rocks_1x_01.mp3'] const faucetDrip = ['home/amzn_sfx_faucet_drip_01.mp3','home/amzn_sfx_faucet_drip_02.mp3','amzn_sfx_faucet_drip_03.mp3’] </code></pre> <p>To pick a random speechcon from this list, you would call the same function, like so:</p> <pre> <code>const speechOutput = &quot;There was no one in the kitchen, but the water was dripping.&lt;audio src='&quot; + soundlibraryURL + randomPhrase(faucetDrip) + &quot;'/&gt;” </code></pre> <p>As you can see, you can use the randomPhrase() recipe to randomize welcome greetings, confirmation messages, speechcons, sounds from the sound library, and any other list of items you’d like to randomly cycle through to add variety to your skill responses. Using the randomPhrase() recipe, you can introduce variety throughout your skill to keep the interaction fresh and delightful for your customers.</p> <p>For more recipes, visit the <a href="" target="_blank">Alexa Skill Building Cookbook</a> on GitHub.</p> <h2>More Resources</h2> <p>Here are some more resources on how you can add variety and personalization to keep your skill content fresh:</p> <ul> <li><a href="" target="_blank">Alexa Voice Design Guide</a></li> <li><a href="" target="_blank">7 Tips for Building Standout Skills Your Customers Will Love</a></li> <li><a href="">Set Clear Expectations on What Your Alexa Skill Can Do</a></li> <li><a href="">How to Adapt Your Skill's Responses Based on Usage Patterns</a></li> <li><a href="">Add Dynamic Content to Your Skill to Keep Users Engaged over Time</a></li> </ul>