Using Azure Functions, Node.js and Cosmos DB to create a game leaderboard

In the previous blog post, we described some thoughts on how to design a game leaderboard and how to represent it programmatically. In this one, we are going to discuss about a new open source project of mine called AzureFunctionsNodeLeaderboards-Cosmos. As the name implies, this project is about game leaderboards using Azure Functions with Node.js and Cosmos DB.Read More »

Designing a general purpose game leaderboard

In this blog post we are going to write down some thoughts regarding a game leaderboard implementation. They are written as question and answer pairs and cover the leaderboard design process as well as its technical implementation on a high level.

What is a leaderboard?

Leaderboards are a necessary asset for many types of games. A leaderboard provides a means to reward the best users and increase the game’s replay value by allowing the players to compete. It is defined as a collection of high scores achieved in a game session during a specific time segment in a specific portion of game for a specific set of users.

  • ‘time segment’ relates to the lifetime of the leaderboard. Is it permanent or resets every day/week/month?
  • ‘game portion’ relates to the portion/segment of the game the score was achieved in. Is the score relevant to the entire game or in just one of its levels? Is the score relevant to a single round of gameplay (single session) or multiple ones?
  • ‘specific set of users’ relates to the ‘locality’ of the users and means that the leaderboard may contain scores for users that are in single machine or in a specific region (e.g. Europe) or worldwide
seawolfscreenshot
Sea Wolf, the first video game to use the term “high score”, Wikipedia

Read More »

Deploying a Docker Swarm Mode cluster on Azure Container Service

On June 28th, 2017, Azure Container Service team announced that a new version of the service was deployed in the UK region. This version exposes some new cool features with one of them being the ability to deploy DockerCE (swarm mode) clusters. In this article, you will see how the Azure CLI can be used to deploy a DockerCE cluster in Azure Container Service. Once the cluster is deployed, you can manage it with the docker command-line tool and deploy your Linux container(s).

This tutorial requires the Azure CLI version 2.0.4 or later. Run az --version to find the version. If you need to upgrade, see Install Azure CLI 2.0. You can also use the embedded shell in Azure Portal, called Azure Cloud Shell.

If you don’t have an Azure subscription, create a free account before you begin.

Read More »

Using SSL/TLS for a service hosted on a Kubernetes cluster

This article will dive into the necessary steps that you need to do in order to use SSL/TLS for a service of yours that is hosted on a Kubernetes cluster, making it accessible via https. We will use one Microsoft Bot Framework app to demonstrate this. This framework allows you to easily built chatbots that are hosted on the provider of your choice. Its Bot Connector service allows your bot to open “conversation channels” with Messenger, Skype, Slack and other providers. For this purpose, it requires the chatbot’s endpoint to be accessible via SSL/HTTPS, so that makes for a nice proof of concept apt for this article. So, how would you host a chatbot app on a Kubernetes cluster, taking into account the SSL requirement? One option, of course, would be to have the app itself handle the certificate process, like this example. The other option, which you’ll see in this article, is to use the Kubernetes ingress controller to handle all the SSL setup and usage. The only prerequisites from your side is to have a domain name that the certificate will be issued for and, of course, access to a Kubernetes cluster.

Read More »

Creating a CI/CD pipeline on Azure Container Services with Kubernetes and Visual Studio Team Services

This article will demonstrate how to implement a continuous integration/continuous deployment pipeline for a multi-container app using Azure Container Service, Kubernetes and Visual Studio Team Services (thereafter mentioned as VSTS) Build and Release Management.

You will use a simple application which is available on GitHub (heavily based on this one) and is composed of three components, each of those hosted in its Docker container:

  • service-a: a Node.js app that serves as a web frontend  which connects to service-b and mycache
  • service-b: a .NET Core app that sends a simple text string to service-a that contains current machine’s hostname
  • mycache: a Redis cache that holds an integer called “requestCount” which is set and requested by service-a

Read More »

Implementing FormFlow for Microsoft Node.js BotBuilder SDK

The C# BotBuilder SDK supports a really cool thing call FormFlow. With this, you can write a C# class which is used as a base for a dynamically generated series of question/answer pairs, in order to fill the properties of this class. For instance, do you want to create a burger ordering bot? Just add a enum for BreadOptions, an enum for Toppings, a choice of SauceOptions etc. This is a really cool feature of the C# BotBuilder SDK which allows you to quickly develop a chatbot with predefined rules and flow. As the Node.js BotBuilder SDK lacks this functionality, I tried to replicate it since I needed it for a simple project I’m building. Meet formflowbotbuilder.

Read More »

Using AIML files with Microsoft Bot Framework

A few days ago, I was pitching Bot Framework to an interested party, when a question came up: “Does the Bot Framework support AIML files? We have a lot of them and we are wondering whether we could use them”. Honestly, I didn’t have a clue what AIML is, so I decided to run a quick search.

Turns out that AIML stands for Artificial Intelligence Markup Language and, as Wikipedia nicely mentions it, it is an XML dialect for creating natural language software agents. AIML was used to power Alice Bot back in 1995 (this was one of the first chat bots available to the public). Moreover, AIML powered a discussion with Captain Kirk of Enterprise (ho there, Star Trek fans!). Alice AIML files are open source, you can find them here.

Read More »

Accessing Azure Table Storage Service and Azure CosmosDB with Table API from a Unity game

Update (2/1/2018): Blog post and GitHub code has been updated with instructions on how to connect to CosmosDB using Table Storage API.

Azure Table Storage Service is an inexpensive, highly available NoSQL key-value store. It can store petabytes of structured data, supports a flexible data schema and Azure team provides a REST API. Furthermore, Azure CosmosDB has a Table Storage API, so the same code can also be used here. So, I thought, why not extending my Azure Services for Unity library with support for access to Azure Table Storage Service from any Unity game? Well, here we are, our latest commit to the repository contains access methods for the service.

Read More »

Hosting a Bot Framework chat bot on a Docker container on Azure App Service on Linux

Yeah, title is long but nevertheless you get the point of what I’m going to describe. So, to cut a long story short, last weekend I attended a hackathon where my teammates and I built a PoC of a movie quiz chat bot. At the end of the hackathon, we attempted to “dockerize” it and host it on App Service on Linux (currently on preview). This blog post documents the process.

Some prerequisites

  1. Great video intro (+demo!) of chat bots and Microsoft’s Bot Framework, an easy and flexible way to create an awesome chat bot
  2. You can develop a chat bot in many ways, check here for the Bot Builder Node.js SDK
  3. Check out my blog post about building a chat bot for Greek startup ParkAround
  4. App Service is Azure’s PaaS (Platform as a Service) offering, it supports Windows and Linux (preview). Check here for App Service on Linux documentation
  5. You can deploy apps as files into App Service, if you want to deploy a Docker container check here for Docker containers on App Service on Linux

Read More »