Send message and notification to Google Home like Disney - actions-on-google

I made a Google Action to play "Betrayal at House on the Hill"
In a nutshell:
People ask to play a game
Then decide to move from room A to room B to room C
They can perform actions throught a WebChat
The problem is that Google works on a request/response mechanism
There is no multiple message like "You see something" "Then you see an other thing"
There is no "notification" features when something happend "soouuund" so I made a kludge workaround with a PiZero that cast audio to the Home (works for only one user with an horrible beep)
Questions:
Is there a better way to perform multiple messages
Is there a better way to send notification
Disney did something like that but I can't figure how they stream audio and push multiple events. Is there some kind of API ETA ?
A little blog post on my experiement here.

Related

How to synchronize a 1v1 realtime action online mini game?

What I'm trying to make
Hi, game development newbie here. The game I am trying to make is fairly simple. It's almost exactly like the old FC game "Ballon Fight" except that I'm trying to make it online where players can go through a match making to find opponents.
BalloonFight:
What I Read
I have read some articles, and found most of them lead to two approaches:
Put all game logic on the client, and the client sends player inputs to server on every frame update. The server acts like a dispatcher which only makes sure player A's input is received by both client A and B. My understanding is that if we see the client in this case as a pure function, and if the two players' inputs are received by each other, the game should produce same results on both clients. Thus synchronization is achieved.
Put all game logic on the server, and let the server do the calculations and send back results to both clients. In this case, clients only worry about displaying.
My Fears
Solution 1 sounded like a simpler one to me, but immediately I realized when network problem is put into account, it becomes incredibly complicated. Losing player A's connection for a few seconds means all the input is lost in that period. What I can guess is, to counter that, the server has to detect whether player A is lagged out and accumulate input from player B until player A is back then feed all the accumulated input to player A's client. Player A's client then need to do a fast forward to catch up. This sounds like there's huge amount of infra work on both client side and server side.
Solution 2 on the other hand looks very daunting to me, since for now I have only written some games on the client side.
My questions
in order to make a simple online game like this, what is the most beginner friendly way to synchronize game state?
if I were to use solution 1 stated above, is there any framework that provides such infra so that I don't have to handle network issues all by myself?
In advance, thank you game dev gurus.

How to handle responses which take more then 5 seconds

For the google actions that i am developing some responses are complex and take more than 5 seconds to process.
Could someone please suggest how can this be handled.
Generally i would consider using loading dots and then replacing that message with the result but i don't see any Google Action API for it. Also is there any endpoint to which we could async send back the result later ?
Thanks
PS: I am using Conversation API.
We don't really have a good way to handle this right now, but we have a couple of approaches that sorta work based on your needs.
Notifications are currently available for the Assistant on smartphones, and they're coming for speakers. In some cases, it might make sense to say that you're working on the problem and you'll send a notification when you have it, and then resume the conversation from the notification.
Another approach is to use the Media Response to play a bit of "hold music". At the end of the segment of music, your webhook will get a notice that the music has completed. If you have the result available, you can report it at that time.

how to add progress message in google home dialogflow

In my conversation dialogflow, I would like to add some progress messages like hang in with me, I'm looking up for that data or similar in the conversation. Is there any guidance or best practice to do this?
Unfortunately, there is no good way to do this at this time. If your webhook takes longer than about 5 seconds, Dialogflow will return one of the default responses it is set with. If you're not using Dialogflow, the Action SDK will say your webhook isn't responding and will close the conversation.
There is currently no way to send a reply, and then send another reply without the user saying something first.
One workaround might be to have the default response be something like "I'm looking that information up. Ask me again in a few seconds." When your lookup finally completes, cache the information so when/if the user asks the question again, you can return it more quickly.
Depending how long it takes, you may also wish to register a dynamic reprompt. This will send an event to your webhook if the user doesn't say anything. In a situation like this, they may say nothing for a few seconds, but that may be long enough for you to have computed the reply. So after a few seconds of silence you can suddenly announce "I've figured it out, the answer you were looking for is..." or something similar. This has some limitations - you can only reprompt twice like this before Google sends you a final reprompt and closes the conversation.
Although the platform does support notifications, these are still in developer preview and don't work with all devices. They also don't quite continue the conversation (it doesn't just start talking) - they just send a notification to a phone that there is a message and that they can restart the conversation. Depending on your use case, this may be useful combined with the above.
Update
The Media Response includes a feature that we can take advantage of to handle this. Similar to the dynamic reprompt method above, you'll get a call automatically when the media you're playing ends. So you can play a short "hold music" and your webhook will be called when it is finished. You can then either give the result or say you're still working on it and play more hold music.

Can Google Home wait indefinitely for a response?

I'm pretty sure the answer to this is "no" but I figured I'd share the question anyway in case others have a clever workaround :)
I'm building a recipe action so the user could say "Let's make tortilla soup" and then say "next step" to move on to the next part of the recipe. Between each step there might be a long pause as the user is cutting vegetables, etc. Is it possible to have Home either indefinitely wait for a user response or wait for several minutes? Currently it'll wait a few seconds and say something like "Sorry I didn't understand that response" and eventually quit the action.
Forcing the user to go through the "OK, Google, let me talk to the Chef" action over and over is pretty annoying and, I assume, would require immediately ending the conversation after every step, otherwise the device will hang and say "Sorry I didn't understand".
Update
I've found a pretty hacky way of doing this by abusing SSML. There are two options, you can stack up <break/>s
assistant.ask(`<speak><break time="120s"/><break time="120s"/></speak>`);
This actually causes the Home to play a really weird droning noise. Something the devs might wanna look at :D
Another option (which avoids the drone) is to play a 2 minute silent audio clip. According to the docs, 2 minutes is the limit for <audio> but you can stack them up. I just verified that you can make it sit there for at least ten minutes.
assistant.ask(`<speak><audio src="https://.../pause.mp3">hello</audio><audio src="https://.../pause.mp3"></audio></speak>`)
You cannot speak directly to the agent while its paused like this but you can say "OK Google, [whatever command]" and that command will actually get passed to the agent.
There's not currently a way to have the Assistant wait indefinitely for a response.
While technically possible, an app using the suggested workaround to delay responding wouldn't pass the review process - the policies document mentions avoiding playing a silent sound file and communicating for a period in excess of 120 seconds.
A different approach could be to have your app remember the current position in a recipe, but end the conversation after each step. You could then use action invocation to allow the user to say something like "OK Google, ask [your app name] to continue the recipe", jumping back into the conversation and hearing the next step.
There is not, but there is a recently announced feature that might help you do what you're trying.
When answering, you can give the reply and play an audio file using the Media Control. This has several advantages over using the SSML approach you give:
You'll get an event when the audio finishes, so you can prompt again with the guide, or a tip, or a reminder that your action is still there... and then play more audio while you wait.
At any time, the user can say "Hey Google, next step" and your server will get the message and you can send the next step. Or they can say "hey Google, repeat that" and you'll get that message and can repeat the instructions.
They can also ask other questions of your Action that you can answer.

Tigase: MUG not implemented, what's next?

I'm starting the development of a multiplayer game for iPhone/iPad and i was thinking of using Tigase as XMMP server for the game server. However it seems like Tigase not yet implement MUG XEP. Anyway MUG is too complex for the simple task i'm trying to achieve so.
Here is the game basic:
Each Match may have up to 4 players.
Each player may perform at any moment a move and the only game rule is to forward a packet to each player in the match that tell the move the user mades and weither or not is is a good move or not.
Here is the way i want to implement it:
Reuse the MUC component to simulate the Multi-player room.
Each room will have a Bot member: all packet will me addressed to that BOT directly: the BOT will check the moves (which will be basic message packets) for validity and sent the appropriate message to all Player in the room.
I think this may work. If you think this is a viable solution:
What is the best way to write the BOT. Should i have one BOT per room? how can i detect when a new room is created so i can create the BOT?
Apparently, the most simple way to do this is to build a plug-in to the MUC component. The MUC and MUG components are very similar so it provide most of the mecanism a multiplayer game needs.