cm107 commited on
Commit
43b6a47
1 Parent(s): 1009dc4

Implemented buttons for switching between English and Japanese info pages.

Browse files
Files changed (5) hide show
  1. index.html +7 -121
  2. info_eng.html +119 -0
  3. info_jp.html +147 -0
  4. langNav.js +41 -0
  5. main.css +19 -4
index.html CHANGED
@@ -26,129 +26,15 @@
26
  </div>
27
  <div id="unity-fullscreen-button" style="display: none;"></div>
28
  </div>
29
- <div id="infoBox">
30
- <h1>Controls</h1>
31
- <div id="controls">
32
- <table>
33
- <th>Binding</th>
34
- <th>Description</th>
35
- <tr>
36
- <td>Right Mouse Click (Drag)</td>
37
- <td>
38
- Rotates the camera in the direction of the mouse drag.
39
- </td>
40
- </tr>
41
- <tr>
42
- <td>Left Mouse Click</td>
43
- <td>
44
- Sets the goal point to the location on the terrain where you clicked.
45
- </td>
46
- </tr>
47
- <tr>
48
- <td>W</td>
49
- <td>
50
- Move forward.
51
- </td>
52
- </tr>
53
- <tr>
54
- <td>S</td>
55
- <td>
56
- Move backward.
57
- </td>
58
- </tr>
59
- <tr>
60
- <td>A</td>
61
- <td>
62
- Move left.
63
- </td>
64
- </tr>
65
- <tr>
66
- <td>D</td>
67
- <td>
68
- Move right.
69
- </td>
70
- </tr>
71
- <tr>
72
- <td>E</td>
73
- <td>Move up.</td>
74
- </tr>
75
- <tr>
76
- <td>Q</td>
77
- <td>Move down.</td>
78
- </tr>
79
- <tr>
80
- <td>R</td>
81
- <td>
82
- Restart the episode.
83
- Note that the terrain does not change even if you are in random mode.
84
- Deformations to the terrain are preserved as well.
85
- </td>
86
- </tr>
87
- <tr>
88
- <td>1</td>
89
- <td>
90
- <div class="cellHeader">Terrain Mode: RANDOM</div>
91
- Restart with a random terrain shape (no perlin noise).
92
- </td>
93
- </tr>
94
- <tr>
95
- <td>2</td>
96
- <td>
97
- <div class="cellHeader">Terrain Mode: RANDOM_NOISE</div>
98
- Restart with a random terrain shape (with perlin noise).
99
- </td>
100
- </tr>
101
- <tr>
102
- <td>3</td>
103
- <td>
104
- <div class="cellHeader">Terrain Mode: GAUSSIAN_SLOPE</div>
105
- Restart with a gaussian slope shaped terrain.
106
- </td>
107
- </tr>
108
- <tr>
109
- <td>4</td>
110
- <td>
111
- <div class="cellHeader">Terrain Mode: POINTY_GAUSSIAN_SLOPE</div>
112
- Restart with a <i>pointy</i> gaussian slope shaped terrain.
113
- </td>
114
- </tr>
115
- <tr>
116
- <td>5</td>
117
- <td>
118
- <div class="cellHeader">Terrain Mode: TRAPEZOIDAL_HILL</div>
119
- Restart with a trapezoidal hill shaped terrain.
120
- </td>
121
- </tr>
122
- </table>
123
- </div>
124
- <h1>Disclaimer</h1>
125
- <div id="disclaimerBody">
126
- <p>
127
- <a target=”_blank”
128
- href="https://docs.unity3d.com/Packages/com.unity.ml-agents@2.2/manual/index.html#inference">
129
- Unfortunately, MLAgents doesn't support GPU inference for WebGL builds.
130
- </a><br>
131
- The excavator model was originally trained with a larger neural network and yielded good results, but the
132
- model
133
- was too large to run smoothly on the CPU.
134
- The current model was trained with a smaller model. Although it can run more smoothly on the CPU, the
135
- performance isn't as good as that of the larger model.
136
- </p>
137
- <p>
138
- If you would like to try out the larger model as well, refer to <a
139
- href="https://huggingface.co/spaces/cm107/excav_demo">excav_demo</a>.
140
- When using the larger model, it is recommended that you download the build corresponding to your specific
141
- target
142
- platform.
143
- </p>
144
- <p>
145
- For more information about WebGL performance considerations, refer to
146
- <a target=”_blank” href="https://docs.unity3d.com/Manual/webgl-performance.html">
147
- the unity documentation
148
- </a>.
149
- </p>
150
  </div>
 
151
  </div>
 
152
  </div>
153
  <script type="text/javascript" src="gameLoad.js"></script>
154
  </body>
 
26
  </div>
27
  <div id="unity-fullscreen-button" style="display: none;"></div>
28
  </div>
29
+ <div id="infoBoxContainer">
30
+ <div id="langNavigator">
31
+ <button class="activeLangBtn" id="langBtnEng" style="display:inline;">English</button>
32
+ <p style="display:inline;">/</p>
33
+ <button class="nonactiveLangBtn" id="langBtnJp" style="display:inline;">日本語</button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  </div>
35
+ <div id="infoBox"></div>
36
  </div>
37
+ <script type="text/javascript" src="langNav.js"></script>
38
  </div>
39
  <script type="text/javascript" src="gameLoad.js"></script>
40
  </body>
info_eng.html ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h1>Controls</h1>
2
+ <div id="controls">
3
+ <table>
4
+ <th>Binding</th>
5
+ <th>Description</th>
6
+ <tr>
7
+ <td>Right Mouse Click (Drag)</td>
8
+ <td>
9
+ Rotates the camera in the direction of the mouse drag.
10
+ </td>
11
+ </tr>
12
+ <tr>
13
+ <td>Left Mouse Click</td>
14
+ <td>
15
+ Sets the goal point to the location on the terrain where you clicked.
16
+ </td>
17
+ </tr>
18
+ <tr>
19
+ <td>W</td>
20
+ <td>
21
+ Move forward.
22
+ </td>
23
+ </tr>
24
+ <tr>
25
+ <td>S</td>
26
+ <td>
27
+ Move backward.
28
+ </td>
29
+ </tr>
30
+ <tr>
31
+ <td>A</td>
32
+ <td>
33
+ Move left.
34
+ </td>
35
+ </tr>
36
+ <tr>
37
+ <td>D</td>
38
+ <td>
39
+ Move right.
40
+ </td>
41
+ </tr>
42
+ <tr>
43
+ <td>E</td>
44
+ <td>Move up.</td>
45
+ </tr>
46
+ <tr>
47
+ <td>Q</td>
48
+ <td>Move down.</td>
49
+ </tr>
50
+ <tr>
51
+ <td>R</td>
52
+ <td>
53
+ Restart the episode.
54
+ Note that the terrain does not change even if you are in random mode.
55
+ Deformations to the terrain are preserved as well.
56
+ </td>
57
+ </tr>
58
+ <tr>
59
+ <td>1</td>
60
+ <td>
61
+ <div class="cellHeader">Terrain Mode: RANDOM</div>
62
+ Restart with a random terrain shape (no perlin noise).
63
+ </td>
64
+ </tr>
65
+ <tr>
66
+ <td>2</td>
67
+ <td>
68
+ <div class="cellHeader">Terrain Mode: RANDOM_NOISE</div>
69
+ Restart with a random terrain shape (with perlin noise).
70
+ </td>
71
+ </tr>
72
+ <tr>
73
+ <td>3</td>
74
+ <td>
75
+ <div class="cellHeader">Terrain Mode: GAUSSIAN_SLOPE</div>
76
+ Restart with a gaussian slope shaped terrain.
77
+ </td>
78
+ </tr>
79
+ <tr>
80
+ <td>4</td>
81
+ <td>
82
+ <div class="cellHeader">Terrain Mode: POINTY_GAUSSIAN_SLOPE</div>
83
+ Restart with a <i>pointy</i> gaussian slope shaped terrain.
84
+ </td>
85
+ </tr>
86
+ <tr>
87
+ <td>5</td>
88
+ <td>
89
+ <div class="cellHeader">Terrain Mode: TRAPEZOIDAL_HILL</div>
90
+ Restart with a trapezoidal hill shaped terrain.
91
+ </td>
92
+ </tr>
93
+ </table>
94
+ </div>
95
+ <h1>Disclaimer</h1>
96
+ <div id="disclaimerBody">
97
+ <p>
98
+ <a target=”_blank” href="https://docs.unity3d.com/Packages/com.unity.ml-agents@2.2/manual/index.html#inference">
99
+ Unfortunately, MLAgents doesn't support GPU inference for WebGL builds.
100
+ </a><br>
101
+ The excavator model was originally trained with a larger neural network and yielded good results, but the
102
+ model was too large to run smoothly on the CPU.
103
+ The current model was trained with a smaller model. Although it can run more smoothly on the CPU, the
104
+ performance isn't as good as that of the larger model.
105
+ </p>
106
+ <p>
107
+ If you would like to try out the larger model as well, refer to <a
108
+ href="https://huggingface.co/spaces/cm107/excav_demo">excav_demo</a>.
109
+ When using the larger model, it is recommended that you download the build corresponding to your specific
110
+ target
111
+ platform.
112
+ </p>
113
+ <p>
114
+ For more information about WebGL performance considerations, refer to
115
+ <a target=”_blank” href="https://docs.unity3d.com/Manual/webgl-performance.html">
116
+ the unity documentation
117
+ </a>.
118
+ </p>
119
+ </div>
info_jp.html ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h1>操作方法</h1>
2
+ <div id="controls">
3
+ <table>
4
+ <th>キーバインド</th>
5
+ <th>説明</th>
6
+ <tr>
7
+ <td>右クリック(ドラッグ)</td>
8
+ <td>
9
+ <!-- Rotates the camera in the direction of the mouse drag. -->
10
+ マウスでドラッグした方向にカメラを回転。
11
+ </td>
12
+ </tr>
13
+ <tr>
14
+ <td>左クリック</td>
15
+ <td>
16
+ <!-- Sets the goal point to the location on the terrain where you clicked. -->
17
+ クリックした地点を新たなゴールにする。
18
+ </td>
19
+ </tr>
20
+ <tr>
21
+ <td>W</td>
22
+ <td>
23
+ <!-- Move forward. -->
24
+ 前方に移動。
25
+ </td>
26
+ </tr>
27
+ <tr>
28
+ <td>S</td>
29
+ <td>
30
+ <!-- Move backward. -->
31
+ 後方に移動。
32
+ </td>
33
+ </tr>
34
+ <tr>
35
+ <td>A</td>
36
+ <td>
37
+ <!-- Move left. -->
38
+ 左に移動。
39
+ </td>
40
+ </tr>
41
+ <tr>
42
+ <td>D</td>
43
+ <td>
44
+ <!-- Move right. -->
45
+ 右に移動。
46
+ </td>
47
+ </tr>
48
+ <tr>
49
+ <td>E</td>
50
+ <td>
51
+ <!-- Move up. -->
52
+ 真上に移動。
53
+ </td>
54
+ </tr>
55
+ <tr>
56
+ <td>Q</td>
57
+ <td>
58
+ <!-- Move down. -->
59
+ 真下に移動。
60
+ </td>
61
+ </tr>
62
+ <tr>
63
+ <td>R</td>
64
+ <td>
65
+ <!-- Restart the episode.
66
+ Note that the terrain does not change even if you are in random mode.
67
+ Deformations to the terrain are preserved as well. -->
68
+ エピソードを再スタートする。
69
+ ランダムモードを使っているとしても、地形は変わりません。
70
+ 変形した地形は変わらない。
71
+ </td>
72
+ </tr>
73
+ <tr>
74
+ <td>1</td>
75
+ <td>
76
+ <div class="cellHeader">地形モード: RANDOM</div>
77
+ <!-- Restart with a random terrain shape (no perlin noise). -->
78
+ ランダムな地形で再スタート(パーリンノイズ無し)。
79
+ </td>
80
+ </tr>
81
+ <tr>
82
+ <td>2</td>
83
+ <td>
84
+ <div class="cellHeader">地形モード: RANDOM_NOISE</div>
85
+ <!-- Restart with a random terrain shape (with perlin noise). -->
86
+ ランダムな地形で再スタート(パーリンノイズ有り)。
87
+ </td>
88
+ </tr>
89
+ <tr>
90
+ <td>3</td>
91
+ <td>
92
+ <div class="cellHeader">地形モード: GAUSSIAN_SLOPE</div>
93
+ <!-- Restart with a gaussian slope shaped terrain. -->
94
+ ガウス勾配型の地形で再スタート。
95
+ </td>
96
+ </tr>
97
+ <tr>
98
+ <td>4</td>
99
+ <td>
100
+ <div class="cellHeader">地形モード: POINTY_GAUSSIAN_SLOPE</div>
101
+ <!-- Restart with a <i>pointy</i> gaussian slope shaped terrain. -->
102
+ <i>尖った</i>ガウス勾配型の地形で再スタート。
103
+ </td>
104
+ </tr>
105
+ <tr>
106
+ <td>5</td>
107
+ <td>
108
+ <div class="cellHeader">地形モード: TRAPEZOIDAL_HILL</div>
109
+ <!-- Restart with a trapezoidal hill shaped terrain. -->
110
+ 台形な地形で再スタート。
111
+ </td>
112
+ </tr>
113
+ </table>
114
+ </div>
115
+ <h1>注意事項</h1>
116
+ <div id="disclaimerBody">
117
+ <p>
118
+ <a target=”_blank” href="https://docs.unity3d.com/Packages/com.unity.ml-agents@2.2/manual/index.html#inference">
119
+ <!-- Unfortunately, MLAgents doesn't support GPU inference for WebGL builds. -->
120
+ 残念ながら、MLAgentsはWebGLビルドでのGPU推論を対応していません。
121
+ </a><br>
122
+ <!-- The excavator model was originally trained with a larger neural network and yielded good results, but the
123
+ model was too large to run smoothly on the CPU. -->
124
+ モデルは、もともと大きめのニューラルネットワークで学習させ、良い精度を出していたが、モデルが大きすぎて、CPUでスムーズに走らせませんでした。
125
+ <!-- The current model was trained with a smaller model. -->
126
+ 現在のモデルはもっと小さめのモデルです。
127
+ <!-- Although it can run more smoothly on the CPU, the performance isn't as good as that of the larger model. -->
128
+ スムーズにCPUで走らせるようになったものの、精度は大きめのモデルより劣っています。
129
+ </p>
130
+ <p>
131
+ <!-- If you would like to try out the larger model as well, refer to <a
132
+ href="https://huggingface.co/spaces/cm107/excav_demo">excav_demo</a>. -->
133
+ 大きめのモデルを試してみたい方は<a href="https://huggingface.co/spaces/cm107/excav_demo">excav_demo</a>を参照。
134
+ <!-- When using the larger model, it is recommended that you download the build corresponding to your specific
135
+ target platform. -->
136
+ 大きめのモデルを使う場合は、お使いになっている端末に該当するビルドをダウンロードすることをお勧めします。
137
+ </p>
138
+ <p>
139
+ <!-- For more information about WebGL performance considerations, refer to
140
+ <a target=”_blank” href="https://docs.unity3d.com/Manual/webgl-performance.html">
141
+ the unity documentation
142
+ </a>. -->
143
+ WebGL のパフォーマンスに関する考慮事項については、<a target=”_blank” href="https://docs.unity3d.com/Manual/webgl-performance.html">
144
+ ドキュメントを参照してください
145
+ </a>。
146
+ </p>
147
+ </div>
langNav.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const langNavMap = {
2
+ "langBtnEng": "info_eng.html",
3
+ "langBtnJp": "info_jp.html"
4
+ };
5
+
6
+ function load_info(path) {
7
+ fetch(path /*, options */)
8
+ .then((response) => {
9
+ return response.text();
10
+ }
11
+ )
12
+ .then((html) => {
13
+ document.getElementById("infoBox").innerHTML = html;
14
+ })
15
+ .catch((error) => {
16
+ console.warn(error);
17
+ });
18
+ }
19
+
20
+ var langNavigator = document.getElementById('langNavigator');
21
+ for (let ele of langNavigator.children) {
22
+ if (ele.tagName == "BUTTON") {
23
+ ele.addEventListener(
24
+ 'mouseup',
25
+ (e) => {
26
+ let path = langNavMap[ele.id];
27
+ console.log("Loading " + path);
28
+ load_info(path);
29
+ }
30
+ );
31
+ }
32
+ }
33
+
34
+ for (let ele of langNavigator.children) {
35
+ if (ele.tagName == "BUTTON" && ele.className == "activeLangBtn") {
36
+ let path = langNavMap[ele.id];
37
+ console.log("Loading " + path);
38
+ load_info(path);
39
+ break;
40
+ }
41
+ }
main.css CHANGED
@@ -1,10 +1,25 @@
1
- #infoBox {
2
- border: 5px solid darkblue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  flex: 30%;
4
  flex-direction: row;
5
  overflow: scroll;
6
  max-height: 100vh;
7
- width: 75%;
8
  margin-left: auto;
9
  margin-right: auto;
10
  }
@@ -54,7 +69,7 @@ td {
54
 
55
  #unity-container {
56
  flex: 50%;
57
- border: 5px solid green;
58
  position: relative;
59
  width: auto;
60
  height: 100vh;
 
1
+ #langNavigator * {
2
+ font-size: 16px;
3
+ font-family: 'Arial';
4
+ }
5
+
6
+ .activeLangBtn {
7
+ border: 3px solid red;
8
+ border-radius: 5px;
9
+ color: red;
10
+ }
11
+
12
+ .nonactiveLangBtn {
13
+ /* Doesn't really need any styling? */
14
+ border-radius: 5px;
15
+ }
16
+
17
+ #infoBoxContainer {
18
+ /* border: 5px solid darkblue; */
19
  flex: 30%;
20
  flex-direction: row;
21
  overflow: scroll;
22
  max-height: 100vh;
 
23
  margin-left: auto;
24
  margin-right: auto;
25
  }
 
69
 
70
  #unity-container {
71
  flex: 50%;
72
+ /* border: 5px solid green; */
73
  position: relative;
74
  width: auto;
75
  height: 100vh;