You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-18Lines changed: 30 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,8 @@ Like the Dance Party repo, it is a standalone repo that is published as an [NPM
9
9
10
10
**AI for Oceans** was produced for the Hour of Code in 2019. This module provides the student experience for the 5 interactive levels in the **AI for Oceans** script at https://studio.code.org/s/oceans.
11
11
12
+
We have measured over one million unique [completions](https://twitter.com/codeorg/status/1385266661700288513) of the script.
@@ -19,7 +21,7 @@ These 5 levels are invoked with a "mode" (stored internally as `appMode`) parame
19
21
20
22
### `fishvtrash`
21
23
22
-
The user trains the AI to differentiate between fish versus trash, and then examine the results.
24
+
The user trains the AI to differentiate between fish and trash, and then examines the results.
23
25
24
26
### `creaturesvtrashdemo`
25
27
@@ -35,7 +37,7 @@ In this mode, the user chooses from one of six adjectives and then categorizes f
35
37
36
38
### `long`
37
39
38
-
In this mode, the user chooses from one of fifteen adjectives. With more subjectivity in this list, the user can explore more subtle implications of training and recognition.
40
+
In this mode, the user chooses from one of fifteen adjectives. With more subjectivity in this list, the user can explore more subtle implications of training and categorization.
39
41
40
42
## ML technology
41
43
@@ -47,24 +49,23 @@ Adapted from content at https://code.org/oceans:
47
49
48
50
## Scenes
49
51
50
-
The **AI for Oceans** script presents a linear narrative structure. The app is designed to deliver the interactive levels for this script, one mode at a time, with no need to persist data to the browser or server between each level.
52
+
The **AI for Oceans** script presents a linear narrative structure. This app is designed to deliver the interactive levels for this script, one mode at a time, with no need to persist data to the browser or server between each level.
51
53
52
-
The app itself contains a variety of "scenes", with each mode using a different subset. The scenes (known as `currentMode` internally) are as follows:
54
+
The app itself presents a variety of "scenes", with each mode using a different subset. The scenes (known as `currentMode` internally) are as follows:
The user shows the results of the predictions. The user can toggle between the matching & non-matching sets. In short & long, the user can click each item to view additional information about the AI's recognition.
88
+
The user is shown the result of the predictions. The user can toggle between the matching & non-matching sets.
88
89
89
90
In the `short` and `long` modes, the pond also has a metapanel which can show general information about the ML processing, or, when a fish is selected, specific information about that fish's categorization:
90
91
@@ -94,27 +95,27 @@ In the `short` and `long` modes, the pond also has a metapanel which can show ge
94
95
95
96
## Graphics & UI
96
97
97
-
The app uses two layers in the DOM. Underneath, a canvas provides the background and all the sprites. On top, a regular DOM uses HTML elements to provide the user interface. The HTML interface is implemented in React.
98
+
The app uses three layers in the DOM. Underneath, one canvas contains the scene's background image, while another canvas contains all the sprites. On top, the app uses React to render HTML elements for the user interface, implemented [here](https://github.com/code-dot-org/ml-activities/blob/c9d24c4b7a20ea12d5dc7a094094c5ef4dfbbde3/src/oceans/ui.jsx).
98
99
99
-
The app is fully responsive by scaling the canvas and also scaling the size of the HTML elements correspondingly. The UI simply shrinks to match the underlying canvas.
100
+
The app is fully responsive by scaling the canvases and also scaling the size of the HTML elements correspondingly. This way, the UI simply shrinks to match the underlying canvases.
100
101
101
102
## Animation
102
103
103
104
The animation is designed to be be smooth and frame-rate independent.
104
105
105
-
The prediction screen notably renders the progression based on the concept of a "current offset in time", making it possible to pause, and even reverse the animation, as well as adjust its the speed.
106
+
The prediction screen notably renders the progression based on the concept of a "current offset in time", making it possible to pause, and even reverse the animation, as well as adjust its speed.
107
+
108
+
All items have simple "bobbing" animations, using offsets cycling in a sine loop, such as [here](https://github.com/code-dot-org/ml-activities/blob/f8a438628f9f5a0dba4a602f8ae0bbffb714ce35/src/oceans/renderer.js#L615-L618).
106
109
107
-
All items have a simple "bobbing" animation, using out of sync X and Y offsets cycling in a sine loop.
110
+
The fish pause under the scanner using a simple S-curve adjustment to their movement, implemented [here](https://github.com/code-dot-org/ml-activities/blob/f8a438628f9f5a0dba4a602f8ae0bbffb714ce35/src/oceans/renderer.js#L258).
108
111
109
112
## The Guide
110
113
111
-
After initial playtests, we identified a need to slow the pacing of the tutorial and tell a clear story. The solution we adapted was pop-up text boxes with "typing" text, reminiscent of old-school computer games.
114
+
After initial playtests, we identified a need to slow the pacing of the tutorial and tell a clear story. The solution we adopted was text boxes with "typing" text, reminiscent of old-school computer games.
112
115
113
116
"The Guide" is the implementation of this solution, and was designed to be a simple but flexible system that allowed us to add a variety of text for every step and situation encountered in the tutorial.
114
117
115
-
Each piece of Guide text is declared, along with the app state needed for it to show, which can even include code for more expressiveness.
116
-
117
-
See the implementation at https://github.com/code-dot-org/ml-activities/blob/main/src/oceans/models/guide.js
118
+
Each piece of Guide text is declared, along with the app state needed for it to show (which can even include code for more expressiveness), [here](https://github.com/code-dot-org/ml-activities/blob/main/src/oceans/models/guide.js).
118
119
119
120
This simple system enabled the team to add a detailed narrative voice to the script, and allowed a variety of team members to contribute text.
120
121
@@ -124,16 +125,27 @@ This simple system enabled the team to add a detailed narrative voice to the scr
124
125
125
126
## Popups
126
127
127
-
We also use popups to give extra information.
128
+
We also use modal popups to give extra information.
The app's runtime state is stored in a very simple module [here](https://github.com/code-dot-org/ml-activities/blob/c9d24c4b7a20ea12d5dc7a094094c5ef4dfbbde3/src/oceans/state.js). Updates to state trigger a React render, unless deliberately skipped.
135
+
136
+
## Host interface
137
+
138
+
The full functionality of this app is enabled when hosted by https://studio.code.org. The main repo loads this app via code [here](https://github.com/code-dot-org/code-dot-org/tree/c3325655902e82479d0a85d5adc73049810e5b66/apps/src/fish). Specific parameters passed in during initialization, [here](https://github.com/code-dot-org/code-dot-org/blob/c3325655902e82479d0a85d5adc73049810e5b66/apps/src/fish/Fish.js#L127-L136), include a foreground and background canvas, the `appMode`, a callback when the user continues to the next level, callbacks for loading & playing sound effects, and localized strings.
139
+
140
+
## Analytics
141
+
142
+
If Google Analytics is available on the page, the app generates a synthetic page view for each scene, allowing for an understanding of usage and duration of each scene in the script.
131
143
132
144
# Additional information
133
145
134
146
## Common operations
135
147
136
-
The documentation for common operations for AI Lab is comprehensive and should apply to this project too: https://github.com/code-dot-org/ml-playground#common-operations
148
+
The documentation for common operations for **AI Lab** is comprehensive and should apply to this project too: https://github.com/code-dot-org/ml-playground#common-operations
0 commit comments