-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
950 lines (866 loc) · 30.5 KB
/
index.html
File metadata and controls
950 lines (866 loc) · 30.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>Act Instruction Format</title>
<script src='https://www.w3.org/Tools/respec/respec-w3c' class='remove' async></script>
<script class='remove'>
let respecConfig = {
localBiblio: {
"ISO-639": {
title: "ISO-639",
href: "https://www.iso.org/standard/22109.html",
publisher: "International Organization for Standardization"
},
"BML": {
title: "BML",
href: "http://www.mindmakers.org/projects/bml-1-0/wiki",
publisher: "BML 1.0 Standard"
},
"DCMP": {
title: "DCMP",
href: "https://www.3playmedia.com/resources/popular-topics/closed-captioning/",
publisher: "3PlayMedia"
}
},
wg: "Conversational Interfaces Working Group",
wgURI: "https://www.w3.org/community/conv/",
wgPublicList: "public-conv",
specStatus: "CG-DRAFT",
shortName: "dmpl",
editors: [{
name: "Nishant Shukla",
url: "https://shukla.io",
w3cid: 112944
}, {
name: "Nawar Rajab",
url: "https://nawarrajab.com"
}, {
name: "Nelson Solano",
url: "https://www.linkedin.com/in/nelson-solano-24a935126/",
w3cid: 113168
}],
edDraftURI: "https://github.com/conversational-interfaces/act",
addSectionLinks: true,
isPreview: true,
lint: {
"check-punctuation": true
}
};
</script>
</head>
<body>
<section id='abstract'>
<p>
This specification defines the syntax and semantics of a behavior definition language.
A service may send instructions encoded in this format for clients such as 3D game engines to realize.
These messages include instructions about positioning objects, activating or deactivating systems,
changing scenes or contexts, controlling visual properties, animating characters, and playing audio.
</p>
</section>
<section id='sotd'></section>
<section id="conformance"></section>
<section>
<h2>Introduction</h2>
<p>
The message format outlined in this specification allows for fine-control execution
of agents in a virtual or live environment.
<a href="https://www.json.org/">JSON</a> may be one possible vessel for these types of messages.
</p>
<section>
<h2>Scope</h2>
<i>This section is informative.</i>
<p>In progress...</p>
</section>
<section>
<h2>Goals and Motivation</h2>
<i>This section is informative.</i>
<p>In progress...</p>
</section>
</section>
<section>
<h2>Message Format</h2>
<i>This section is normative.</i>
<section data-dfn-for="Behavior" data-link-for="Behavior">
<h2><dfn>Behavior</dfn> Interface</h2>
The atomic unit that can be immediately realized by a client is called a <a>behavior</a>.
Consider the sentence, "The boy says hello."
By analyzing the grammar, we find the subject is "boy", the verb is "says", and the direct-object is "hello".
The intuition behind the <a>behavior</a> interface is to represent a similar structure.
<pre class="idl">
[Exposed]
interface Behavior {
attribute long id;
attribute DOMString subject;
attribute DOMString action;
attribute Params params;
attribute double delay;
attribute Dictionary start;
attribute SequenceOfStrings cc;
};
</pre>
<pre class="idl">
typedef sequence<DOMString> SequenceOfStrings;
</pre>
<section>
<h3><dfn>id</dfn> attribute</h3>
<p>
The <a>id</a> specifies the unique identifier. Note that
<a>id</a>'s are non unique across different blocks.
</p>
</section>
<section>
<h3><dfn>subject</dfn> attribute</h3>
<p>
The <a>subject</a> attribute is the name of the agent that is performing an action. In grammar, this is often
called the <i>subject</i> of a verb.
Examples include:
</p>
<pre class="example">
"boy"
</pre>
<p>
And even abstract nouns such as the following.
</p>
<pre class="example">
"system"
</pre>
</section>
<section>
<h3><dfn>action</dfn> attribute</h3>
<p>
Each <a>subject</a> affords a set of actions. The <a>action</a> attribute specifies one of those available
actions.
For example, if the subject is "boy", a possible action may look as follows.
</p>
<pre class="example">
"say"
</pre>
<p>
And if the subject is "system", a possible action may be an abstract concept as follows.
</p>
<pre class="example">
"initialize"
</pre>
</section>
<section>
<h3><dfn>params</dfn> attribute</h3>
<p>
The <a>Params</a> attribute specifies the data-structure containing all data to be received and manipulated
by the client. See <a>Params</a> below.
</p>
<pre class="idl">
[Exposed]
interface Params {
attribute String intent;
attribute String ssml;
attribute String name;
attribute String url;
attribute Phonemes phonemes;
attribute String language;
attribute Dictionary context;
};
</pre>
<section>
<h3><dfn>intent</dfn> attribute</h3>
<p>
The <a>intent</a> attribute specifies what a user is trying to accomplish. An <a>intent</a> is specified
within a <a>String</a> data type.
</p>
<pre class="example">
"statement.i-can-help"
</pre>
</section>
<section>
<h3><dfn>ssml</dfn> attribute</h3>
<p>
The <a>ssml</a> attribute specifies the speech synthesis markup language for the specified intent. The
<a>ssml</a> is specified within a <a>String</a> data type.
</p>
<pre class="example">
"I can help you with that!"
</pre>
</section>
<section>
<h2><dfn>name</dfn> attribute</h2>
<p>
The <a>name</a> attribute specifies the name of the audio file to be played.
</p>
<pre class="example">
"GO_0020"
</pre>
</section>
<section>
<h2><dfn>url</dfn> attribute</h2>
<p>
The <a>url</a> attribute specifies the source location of the audio file to be played. The <a>url</a>
attribute is specified within a <a>String</a> data type.
</p>
<pre class="example">
"http://audioURL..."
</pre>
</section>
<section>
<h3><dfn>language</dfn> attribute</h3>
<p>
The <a>language</a> attribute specifies the tongue in which any text, or audio will be communicated in. The
language is specified by the three letter codec abiding
<code><dfn data-cite="!ISO-639#">ISO-639.</dfn></code>
The following example shows the three letter codec for the English language.
</p>
<pre class="example">
"eng"
</pre>
</section>
<section>
<h3><dfn>phonemes</dfn> attribute</h3>
<p>
The <a>phonemes</a> attribute is an object containing the phonetic translation and
total
number of frames belonging to the corresponding <a>ssml</a> text. See <a>Phonemes</a> below.
</p>
<pre class="example">
{
"segments": [
{
"phonemeLabel": "IY",
"startFrame": 3
}
],
"framecount": 202
}
</pre>
<pre class="idl">
typedef sequence< Dictionary > dictionarySequence;
[Exposed]
interface Phonemes {
attribute dictionarySequence segments;
attribute long framecount;
};
</pre>
<section>
<h3><dfn>segments</dfn> attribute</h3>
<p>
A custom <a>typedef</a> was defined such that a <a>sequence</a> of <a>Dictionary</a>'s corresponds to a
<a>dictionarySequence</a>. Each <a>Dictionary</a> object within the <a>segments</a> attribute is a
<a>Dictionary</a> containing a pair of <code>key:value</code> attributes. The first item in each nested
<a>Dictionary</a> is specified by a <code><a>String</a>:<a>String</a></code> pairing denoting a phonetic
label. The second <a>Dictionary</a> item corresponds to a
<code><a>String</a> : <a>double</a></code> pairing
corresponding to the start frame of the phonetic label.
</p>
<pre class="example">
{
"phonemeLabel": "IY",
"startFrame": 3
}
</pre>
</section>
<section>
<h3><dfn>framecount</dfn> attribute</h3>
<p>
The <a>framecount</a> attribute specifies the total number of feature frames of the transcribed ssml
text.
</p>
<pre class="example">
202
</pre>
</section>
</section>
</section>
<section>
<h3><dfn>context</dfn> attribute</h3>
<p>
The <a>context</a> attribute specifies a
<code><dfn data-cite="!WebIDL-1/#dfn-dictionary">Dictionary</dfn></code> as defined
in [[WebIDL-1]]. The dictionary members are specified in <code>key:value</code> pairs where both
<code>key</code> and <code>value</code> of of type <a>String</a>.
</p>
<pre class="example">
{
"category": "colors",
"gamestate" : "1",
"target" : "blue"
}
</pre>
</section>
<section>
<h3><dfn>delay</dfn> attribute</h3>
<p>
The <a>delay</a> attribute specifies the number of seconds to wait to perform a corresponding action through a
<code><dfn data-cite="!WebIDL-1/#idl-double">double</dfn></code> data type.
</p>
<pre class="example">
0.0
</pre>
</section>
<section>
<h3><dfn>start</dfn> attribute</h3>
<p>
The <a>start</a> attribute is an optional <a>Dictionary</a> argument that specifies when the <a>Behavior</a>
should begin
its execution, specified by a <code>trigger</code> and an <code>id</code>.
</p>
<section>
<h3><dfn>trigger</dfn> key</h3>
<p>
The <b>trigger</b> attribute specifies the point at which the <a>Behavior</a> corresponding to the
specified <a>id</a> should begin its execution. The trigger value may be <code>"start"</code> or <code>"end"</code>.
</p>
</section>
<section>
<h3><a>id</a> key</h3>
<p>
The <b>id</b> key specifies the <a>Behavior</a> that will be affected by the corresponding
<a>trigger</a> value.
</p>
<pre class="example">
0
</pre>
<pre class="example">
{
"trigger" : "end",
"id": 0
}
</pre>
</section>
</section>
<section>
<h3><dfn>cc</dfn> attribute</h3>
<p>
In defining the <a>cc</a> attribute, a custom
<code><a>typedef</a></code> was used such that a <a>sequence</a> of the <a>String</a>'s corresponds to a
<a>SequenceOfStrings</a> data type. The <dfn data-cite="!WebIDL-1/#idl-DOMString">String</dfn> data type
defined in [[WebIDL-1]] is used. The <a>cc</a> attribute is then specified by a
<a>sequence</a> of
<code><dfn data-cite="!DCMP#">DCMP</dfn></code> standard abiding <a>String</a>'s, containing the textual
representation of any corresponding events within the message.
</p>
<!--https://www.captioningkey.org/speaker_identification.html-->
<!--https://www.captioningkey.org/sound_effects.html-->
<p>
The following example describes the closed captioning for the event where a character named Frog excitedly
says 'Hi there!'.
</p>
<pre class="example">
[
"[Frog excited]",
"Hi there!"
]
</pre>
<p>
The following example describes the closed captioning for the event where a character named Pig says
'Welcome back!' in a Southern Accent.
</p>
<pre class="example">
[
"[Pig Southern Accent]",
"Welcome back!"
]
</pre>
<p>
The following example shows the closed captioning for the event where three characters are simultaneously
cheering.
</p>
<pre class="example">
"[Frog, Pig, Goose cheering]"
</pre>
<p>
The following example shows the closed captioning for the event where a Cow is Mooing.
</p>
<pre class="example">
"[Cow moo's]"
</pre>
</section>
</section>
</section>
<section>
<h2>Blocks</h2>
<i>This section is informative.</i>
<p>
In order to synchronize behavior (especially the "say" and "animate" actions), we propose to use the
"message block". A message block is an ordered <a>sequence</a> of <a>Behavior</a> objects, where each object
conforms to the
<a>Behavior</a> message format specified within this document. The server sends sequences of blocks, and the
client (e.g. Unity)
must fully process one block of <a>Behavior</a> before reading the next block. While processing a single
block of <a>Behavior</a>s,
the client should schedule <a>Behavior</a>s by putting them on "tracks"(every action of every object has a
track),
then all the tracks start simultaneously.
</p>
<section>
<h2>Examples</h2>
<i>This section is informative.</i>
<p>
Suppose a humanoid agent named <code>goose</code> stands near a landmark labelled <code>Landmark_1</code>.
</p>
<p><i>Goose walks towards a landmark named <code>Landmark_1</code></i>.</p>
<pre class="example" title="Walk towards an object">
[
{
"subject": "goose",
"action": "do",
"params": {
"name": "walk",
"context": ["Landmark_1"]
}
}
]
</pre>
<p><i>Goose points at a landmark named <code>Landmark_1</code>.</i></p>
<pre class="example" title="Point at an object indefinitely">
[
{
"object": "goose",
"action": "do",
"params": {
"name": "point",
"context": ["Landmark_1", "enabled"]
}
}
]
</pre>
<p><i>Goose points at a landmark named <code>Landmark_1</code>, and stops after 2 seconds.</i></p>
<pre class="example" title="Point for 2 seconds">
[
{
"object": "goose",
"action": "do",
"params": {
"name": "point",
"context": ["Landmark_1", "enable"]
}
},
{
"object": "goose",
"action": "do",
"params": {
"name": "point",
"context": ["Landmark_1", "disable"]
},
"delay": 2.0
}
]
</pre>
<p><i>Goose looks at a landmark named <code>Landmark_1</code>.</i></p>
<pre class="example" title="Look at an object indefinitely">
[
{
"object": "goose",
"action": "do",
"params": {
"name": "look",
"context": ["Landmark_1", "enable"]
}
}
]
</pre>
<p><i>Goose looks at a landmark named <code>Landmark_1</code>, and stops after 2 seconds.</i></p>
<pre class="example" title="Look for 2 seconds">
[
{
"object": "goose",
"action": "do",
"params": {
"name": "look",
"context": ["Landmark_1", "enable"]
}
},
{
"object": "goose",
"action": "do",
"params": {
"name": "look",
"context": ["Landmark_1", "disable"]
},
"delay": 2.0
}
]
</pre>
<p><i>Goose turns body to a landmark named <code>Landmark_1</code>.</i></p>
<pre class="example" title="Turn to an object">
[
{
"object": "goose",
"action": "do",
"params": {
"name": "turn",
"context": ["Landmark_1"]
}
}
]
</pre>
<p><i>Goose walks towards a landmark named <code>Landmark_1</code> while pointing at it.</i></p>
<pre class="example" title="Point and walk">
[
{
"object": "goose",
"action": "do",
"params": {
"name": "point",
"context": ["Landmark_1", "enable"]
}
},
{
"object": "goose",
"action": "walk",
"params": {
"name": "point",
"context": ["Landmark_1"]
}
}
]
</pre>
<p><i>Goose walks towards a landmark named <code>Landmark_1</code> while pointing at it, then stops
pointing.</i></p>
<pre class="example" title="Point and walk">
[
{
"object": "goose",
"action": "do",
"params": {
"name": "point",
"context": ["Landmark_1", "enable"]
}
},
{
"object": "goose",
"action": "walk",
"params": {
"name": "point",
"context": ["Landmark_1"]
}
}
]
[
{
"object": "goose",
"action": "do",
"params": {
"name": "point",
"context": ["Landmark_1", "disable"]
}
}
]
</pre>
<p>
In the following example we examine events A and B: we want to enforce that event B can't start
until event A has started.
</p>
<p><i>Right when Goose starts speaking, Fox jumps.</i></p>
<pre class="example" title="Start-to-Start">
[
{
"subject": "goose",
"action": "say",
"params": {"name": "GO_0020" , "ssml": "I can help you with that!"}
},
{
"subject": "fox",
"action": "animate",
"params": {"name": "FX_Jump"}
}
]
</pre>
<p>
In this example we want to run the statements in a particular sequence. Specifically, B can't start until
A has finished. In order to achieve the desired order, we place each behavior in a separate block.
</p>
<i>Only when Goose is done speaking, is the Fox able to jump.</i>
<pre class="example" title="Finish-to-Start">
[
{
"subject": "goose",
"action": "say",
"params": {"name": "GO_0020" ,"intent": "statement.i-can-help","ssml": "I can help you with that!"}
}
]
[
{
"subject": "fox",
"action": "animate",
"params": {"name": "FX_Jump"}
}
]
</pre>
<p>
In this example we show how to sequence actions together.
</p>
<i>Goose waves hands as it starts speaking. After hand-waving animation completes, sound effect plays.</i>
<pre class="example" title="Sequencing Actions">
[
{"id": "0", "subject": "goose", "action": "animate", "params": {"name": "wave-hands"}},
{"subject": "goose", "action": "say", "params": {"name": "GO_0020" ,"intent": "greeting"}},
{"subject": "sound", "action": "play", "params": {"name": "sfx.boom" ,"intent": "sfx.boom"}, "start": {"trigger" : "end", "id":0}}
]
</pre>
</section>
<p>
In this example we show how to sequence actions together.
</p>
<i>Goose waves hands as it starts speaking. After audio of utterances completes, then the sound effect plays.</i>
<pre class="example" title="Sequencing Actions">
[
{"subject": "goose", "action": "animate", "params": {"name": "wave-hands"}},
{"subject": "goose", "action": "say", "params": {"name": "GO_0020" ,"intent": "greeting"}},
{"subject": "sound", "action": "play", "params": {"name": "sfx.boom"}, "start": {"trigger" : "end", "id":1}}
]
</pre>
<p>
In this example we show how to control different subjects in parallel.
</p>
<i>Goose and fox cheer "yay!", together at the same time.</i>
<pre class="example" title="Parallel Actions">
[
{"subject": "goose", "action": "say", "params": {"name": "GO_0020","intent": "yay"}},
{"subject": "fox", "action": "say", "params": {"name": "FX_0020","intent": "yay"}}
]
</pre>
<p>
In this example we show how to control different subjects in parallel.
</p>
<i>Goose and fox cheer together, and then jump together.</i>
<pre class="example" title="Parallel Actions">
[
{"subject": "goose", "action": "say", "params": {"name": "GO_0020" ,"intent": "yay"}},
{"subject": "fox", "action": "say", "params": {"name": "FX_0020" ,"intent": "yay"}}
]
[
{"subject": "goose", "action": "animate", "params": {"name": "jump"}},
{"subject": "fox", "action": "animate", "params": {"name": "jump"}}
]
</pre>
<p>
In the following examples we show how to control different objects in parallel.
</p>
<i>Goose and fox cheer together (goose finishes before fox). Goose's jump animation starts right after cheering.
Same for Fox.</i>
<pre class="example" title="Parallel Actions">
[
{"id": "0", "subject": "goose", "action": "say", "params": {"name": "GO_0020" ,"intent": "yay"}},
{"id": "1", "subject": "fox", "action": "say", "params": {"name": "FX_0020" ,"intent": "yay"}},
{"subject": "goose", "action": "animate", "params": {"name": "jump"}, "start": {"trigger" : "end", "id":0}},
{"subject": "fox", "action": "animate", "params": {"name": "jump"}, "start": {"trigger" : "end", "id":1}}
]
</pre>
<i>The Goose says 'hello' and waves hand at the Fox. The Fox says 'hi' back (without interrupting the goose's
utterance.</i>
<pre class="example">
[
{"subject": "goose", "action": "say", "params": {"name": "GO_0020" ,"intent": "greeting"}},
{"subject": "goose", "action": "animate", "params": {"name": "wave-hands"}},
{"subject": "fox", "action": "say", "params": {"name": "FX_0020" ,"intent": "greeting"}, "start": {"trigger" : "start", "id":1}, "delay": 0.5}
]
</pre>
</section>
<section>
<h2>More Examples</h2>
<i>This section is normative.</i>
<p>
The following are examples of objects and their associated behaviors. Note that the specified parameters
for each of the following actions are <i>normative</i>.
</p>
<section>
<h2><code><dfn>Animate</dfn></code></h2>
<p>
An <a>animate</a> payload specifies an object to be animated by the client.
</p>
<pre class="example" title="Animate Message Payload">
{
"subject": "goose",
"action": "animate",
"delay": 0,
"params": { "name": "FR_Maracas_1" }
}
</pre>
</section>
<section>
<h2><code><dfn>Say</dfn></code></h2>
<p>A <a>say</a> payload specifies what the desired subject should say.</p>
<pre class="example" title="Say Message Payload">
{
"subject": "frog",
"action": "say",
"delay": 0,
"params": {
"intent": "statement.i-can-help",
"ssml": "I can help you with that!",
"name": "GO_0020",
"url": "http://audioURL...",
"phonemes": {
"segments": [
{
"phonemeLabel": "IY",
"startFrame": 3
}
],
"framecount": 202
}
}
}
</pre>
</section>
<section>
<h2><code><dfn>Do</dfn></code></h2>
<p>A <a>do</a> payload specifies the name of the action the specified target should perform.</p>
<pre class="example" title="Do Message Payload">
{
"subject": "goose",
"action": "do",
"delay": 0,
"params": { "name": "walk", "context" : ["pig"]}
}
</pre>
</section>
<section>
<h2><code><dfn>Play</dfn></code></h2>
<p>A <a>play</a> payload specifies the audio clip the client should play.</p>
<pre class="example" title="Play Message Payload">
{
"subject": "sound",
"action": "play",
"delay": 0,
"params": { "name": "sxf.bonusround.wav" }
}
</pre>
</section>
<section>
<h2><code><dfn>Spawn</dfn></code></h2>
<p>A <a>spawn</a> payload notifies the client to display the specified object.</p>
<pre class="example" title="Spawn Message Payload">
{
"subject": "system",
"action": "spawn",
"delay": 0,
"params": {"name": "frog", "context": ["character2"]}
}
</pre>
</section>
<section>
<h2><code><dfn>Destroy</dfn></code></h2>
<p>A <a>destroy</a> payload notifies the client to remove the specified object.</p>
<pre class="example" title="Destroy Message Payload">
{
"subject": "system",
"action": "destroy",
"delay": 0,
"params": {"name": "frog"}
}
</pre>
</section>
<section>
<h2>Interruption handling</h2>
<p>
The client may store blocks in a queue and realize the behaviors at its own pace.
In the following example, the queue is cleared by calling <code>clear</code> action on a <code>system</code> subject.
</p>
<pre class="example">
{
"subject": "system",
"action": "clear"
}
</pre>
<p>
Clearing the queue only removes future actions, but doesn't interrupt the current actions.
The following example shows how to immediately terminte actions that are currently being performed.
The <code>params.ignore</code> field is a list of subjects to ignore/skip, if desired.
</p>
<pre class="example">
{
"subject": "system",
"action": "interrupt",
"params": {
"ignore": ["music"]
}
}
</pre>
<p>
Clearing the queue and interrupting current actions are two behaviors that tend to be performed together.
The following block shows how to send both behaviors at once.
</p>
<pre class="example">
[
{
"subject": "system",
"action": "clear"
},
{
"subject": "system",
"action": "interrupt",
"params": {
"ignore": ["music"]
}
}
]
</pre>
</section>
</section>
<section>
<h2>Related Technologies</h2>
<i>This section is informative.</i>
<section>
<h2><a href="http://www.mindmakers.org/projects/bml-1-0/wiki">BML</a></h2>
<p>
The following <code><dfn data-cite="!BML#">BML</dfn></code> snippet simultaneously starts an
animation and a speech utterance.
</p>
<pre class="example">
<bml character="Alice">
<pointing target="blueBox" mode="RIGHT_HAND" start="speech1:start"/>
<speech id="speech1">
<text>Look there!</text>
</speech>
</bml>
</pre>
</section>
<p>The equivalent behavior can be represented as follows.</p>
<pre class="example">
[
{"subject": "Alice", "action": "do", "params": {"name": "point", "context": ["blueBox", "mode": "RIGHT_HAND"]}},
{"subject": "Alice", "action": "say", "params": {"intent": "look"}}
]
</pre>
<p><a>BML</a> documentation recommends using <code><wait></code> to align behavior with a condition or an
event.</p>
<pre class="example">
<bml character="Alice">
<gesture id=”g1” type=”point” target=”object1”/>
<body id=”b1” posture=”sit”/>
<wait id=”w1” condition=”g1:end AND b1:end”/>
<gaze target=”object2” start=”w1:end”/>
</bml>
</pre>
<p>The <code><wait></code> is unnecessary since we can synchronize
behaviors by placing them in different blocks.</p>
<pre class="example">
[
{"subject": "Alice", "action": "do", "params": {"name": "point", "context": ["object1"]}},
{"subject": "Alice", "action": "do", "params": {"name": "body", "context": ["sit"]}}
]
[
{"subject": "Alice", "action": "animate", "params": {"name": "gaze"}}
]
</pre>
<p>
Multi-party behavior synchronization is limited.
It's non-trivial to have two characters say something at the same time as <a>BML</a>.
</p>
<pre class="example">
<bml character="Alice">
<speech><text>Yay!</text></speech>
</bml>
<bml character="Bob">
<speech><text>Yay!</text></speech>
</bml>
</pre>
<p>Act message format allows fine-control of multi-party behaviors, with a natural syntax.</p>
<pre class="example">
[
{"subject": "Alice", "action": "say", "params": {"intent": "yay"}},
{"subject": "Bob", "action": "say", "params": {"intent": "yay"}}
]
</pre>
</section>
</body>
</html>