aws-samples / amazon-sumerian-hosts

Amazon Sumerian Hosts (Hosts) is an experimental open source project that aims to make it easy to create interactive animated 3D characters for Babylon.js, three.js, and other web 3D frameworks. It leverages AWS services including Amazon Polly (text-to-speech) and Amazon Lex (chatbot).
MIT No Attribution
174 stars 80 forks source link

Host API usability improvements (Babylon) #88

Closed Krxtopher closed 2 years ago

Krxtopher commented 2 years ago

Issue # SUMERIAN-11037

Description of changes:

Scope

The focus of this pull request is to encapsulate the ~350 lines of boilerplate code required to instantiate a host in BabylonJS (as demonstrated in our old example HTML file) to improve ease of use for users of the Hosts library. That boilerplate code is now encapsulated in a new module called HostUtils which exposes a simple createHost() function and a getCharacterConfig() function.

The old example app has been removed and two new examples have been added. These are the "hello-world-demo" and "gesture-demo" examples found under /packages/amazon-sumerian-hosts-babylon/examples.

Out of Scope

Files to review

You can ignore many of the auto-generated files. The files to review explicitly are:

How to test

Prerequisites: You must have a Cognito Identity Pool created in your AWS account. The unauthenticated IAM role for the pool (usually ending in the suffix "Unauth_Role") must have the following managed policies assigned to it:

  • AmazonPollyReadOnlyAccess
  • (optional) AmazonLexRunBotsOnly (optional for this PR)

Check out the repository.

In a terminal, cd to the repository's root directory.

Run npm install.

Update the following file to reflect your Cognito Identity Pool ID: /packages/amazon-sumerian-hosts-babylon/examples/common/demo-credentials.js

Run npm run babylon-examples-serve from the root of the repo. This will automatically start a web server and open a web browser to a listing of the available demos. Click either of the demos to test. If the hosts work properly, then the code is working!

How to review API doc updates

Open the following file in a browser: /docs/index.html

Use the left-hand nav to navigate to "Namespaces > babylonjs/HostUtils".

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

PR Update 1:

runpiw commented 2 years ago

We should probably also update Readme to reflect the new script to run babylon example

Krxtopher commented 2 years ago

We should probably also update Readme to reflect the new script to run babylon example

There are lots of updates needed for the README. There's a whole epic devoted to updating documentation, so this will happen as part of that epic.