Okay, so what on earth is Battle Cry?
So what feels like an incredibly long time ago (okay, I just looked it up - 2017 - so it was a long time ago!) I wrote a few skills to try and better understand this Alexa thing I'd started working on. My first ever published skill, Which One, still gets regular usage today because it did one thing very easily.
At this point I felt I understood the basics, so I do what I normally do - attempt something far too adventurous and then learn by trying to understand how I can bridge the gap between where I want to be and where I actually managed to get to. In terms of Alexa Skill Development this came in the form of Battle Cry - a voice based game for two people.
The problem? I was building this to understand more complicated concepts like multi-turn dialog and state management, not to write a good game. So the result was...poor. It passed certification after a few attempts but I was focused on the code.
For context, I was just beginning to put together what would become Alexa.NET.StateManagement, I had no idea how much I would enjoy learning voice functionality or how important Alexa support for .NET would become to me. At this stage I was learning something new that had sparked an interest - that's all.
I'm not going to spend a huge amount of time on the game itself, but the idea of these posts is to improve the skill without changing its core functionality, so I at least need to explain how it works.
Playing the game
So the idea is you start a "battle" between yourself and someone else. When you start a battle you pick three attack moves, and three defence - top, middle or bottom. The opponent does the same. Alexa then matches up your attack to their defence and vice versa to generate a play by play of your battle against one another, and see who scored most hits - the most hits wins!
Now for the game to work you can't both be playing on same device, you'd hear one another, so the game has the concept of "share codes".
Everyone is given a unique code which they can share, so others can send them a battle to play. A code is a colour, an animal and a four digit number - so once you've picked your moves Alexa asks you for your opponent's code to send them a notification, an example would be
"Blue rhino 1234"
Originally Battle Cry was going to be a templated setup so I could create more of these games with the same core gameplay but different scenarios (troll guarding a bridge for kids, soccer or hockey for sports fans etc. etc.) and a single share code for each
So now we understand the basics of the game - what are we going to try and achieve with the revamp? What does a good result look like? When I wrote this skill Alexa.NET was an isolated NuGet package and skills had limited functionality. There's a lot we can do. So here's my wishlist
These days I don't write any Alexa skills without Alexa.NET.RequestHandlers. Isolating the logic into their own classes as well as isolating them from the lambda setup is a must for easier refactoring - so this will be the first thing I delve to.
I can't imagine what I'm going to find when I look at the intent setup the skill has right now - but I would imagine it's heavy on the "happy path". So I want to improve the current intent setup - take advantage of the recently announced multi value slots for player moves, allow for changes or repeats, just make it as comfortable as I can within the time I want to spend on it.
Future Interaction: Although it's not something I want to work on as a first pass, recently announced Alexa Conversations sound like an ideal feature for Battle Cry and once the revamp is done I really want to look at taking advantage of it.
New voice profile based functionality
With multiple people potentially using the same device in a house, I want to update the skill to pay attention to the profile information (selfishly this would allow myself and my daughter to play Battle Cry against one another in different rooms of the house). When I have a user set up for a share code, but not the person talking I want to confirm I'm giving out the right code.
APL / APLA
The biggest change since I created the game is that we have the visual language of APL. I think we might have had body templates back then but certainly nothing as flexible as APL.
Now one of the reasons I enjoy voice so much is that I have no artistic talent, I struggle with pretty. So although I wish I could draw the battle and animate it with APL I think it would look....well, awful. But that doesn't mean I can't use royalty free clipart and some APL understanding to generate a simple visual interface - buttons to select moves, to give a summary of the battle they're listening to, that sort of thing.
As an added bonus, with APL for Audio I might be able to find some free sounds and soundbank effects that mean I can really enhance the "battle" when I'm playing it back to the user - that's a nice to have, but definitely something I'll be looking into.
Stretch Goal - Share Codes as Custom Tasks
As I said I always hoped that eventually I'd have several skills that were able to take advantage of Share Codes to play games between one another. Although that didn't happen I still like the concept, the code is a quick and easy way to link to one another without worrying about account linking or sharing personal information outside of the Alexa environment.
So although there's only one skill that uses it now - I want to remove Share Codes from Battle Cry, and create them as a set of Skill Connections
This will allow me to alter both Battle Cry and Share Codes without risking unexpected changes to the other, plus it would mean if this revamp makes it easier for me to create the skills I never did - I don't have to worry about maintaining shared code in all the skills.
Stretch Goal - Play against the computer
As much as I do like Share Codes, it doesn't enable those on their own to enjoy my skill - it limits the audience and the interaction. You can't play a "quick game" as you always have to wait for your opponent to make a move. So I'd like to create a new path where you can ask to "play against Alexa" and the skill will create random moves as opposition.
Okay - so that's the dream, and that's plenty to be getting on with! So what am I expecting to happen next?
Well I expect the code to be as low a quality as any of my other "what happens if" experiments, so there will be a lot of being annoyed with myself. But what I'm really hoping is that I find the packages I've written over the last few years feel like a natural fit for the functionality I'm trying to build.
I plan to tackle each goal one at a time so I can blog about it in turn without confusing myself or taking too much on at once (which would be typical of me!) and so I have the best chance of achieving what I set out to. The blog posts may be a little spaced out but hopefully this approach means they'll build into something others can either take information or inspiration from.
Yeah, that's why I'm blogging about this experience I guess. To show other .NET developers that the tools exist to take advantage of all the effort and hard work the Alexa teams have put in to making skill development such an incredibly rich environment.