Angry Birds style game in Unity 3D (source code included)

This tutorial is meant for educational purposes only to showcase how to build certain types of games. Please respect the copyrights/trademarks of others!

If you are in a hurry, you can try the game here and check the source code here.

Last time I posted something around Angry Birds was 3 years ago, when I blogged about a 5’ creation of Angry Birds with 0 lines of code using XAML, Behaviors and Expression Blend. Well, it wasn’t exactly a clone, but it simulated on how to implement some basic dragging/collision/particles functionality with the Farseer Physics Engine. This blog post serves as an attempt to create a single level (with reusable components, long live the prefab!) of Angry Birds using Unity 3D platform. The game features a single level, 3 birds for the user to throw, 3 pigs that the user has to destroy, parallax backgrounds, a maximum strength for the bird (we cannot drag the bird more than a predefined distance), animations with the help of the excellent GoKit library, a projection of the trajectory of the bird (so we can more or less predict where it’ll land), the user’s ability to drag the screen to see the entire scene, pinch to zoom ability (for multitouch devices)  and a small trail that is left by the bird when it’s thrown.

image_thumb4_37DE4480

Game scene in the Unity editor

image_thumb5_49132F86.png

The projected trajectory

image_577FD3ED.png

The trail left by the bird

Before we begin, let’s mention the necessary stuff! Angry Birds, the red birds and the pigs are all registered assets trademarks of Rovio and this blog post serves no other than education purposes.

Game code was written in Visual Studio (check the free Community edition here). For debugging purposes, don’t forget to check the Visual Studio tools for Unity here.

Onto the game! It’s a pretty big game, we’ll attempt to cover most of the stuff. We’ll begin with examining our scene in the editor. As always, it would be better if you opened the game in Unity and examined all relevant parts as the post walks you through them.Read More »

A Flappy Bird style game in Unity (source code included)

This tutorial is meant for educational purposes only to showcase how to build certain types of games. Please respect the copyrights/trademarks of others!

Update: If you’re trying the downloaded game in Unity 5, uncheck the “Apply Root Motion” on the Animator component on the flappy GameObject and everything should work like a charm.

Unless you’ve been living in a cave or visiting outer space, you have certainly played Flappy Bird, one of the most successful games for mobile devices. Hence, I decided to give it a shot and recreate it using Unity. Needless to mention that all graphics and sounds found in the tutorial are used only for educational purposes and do not intend to harm any intellectual property at all circumstances. The sprite sheet used was found here http://www.spriters-resource.com/mobile/flappybird/sheet/59894/  whereas the sounds were found here: https://www.sounds-resource.com/mobile/flappybird/sound/5309/

Game code was written in Visual Studio (check the free Community edition here). For debugging purposes, don’t forget to check the Visual Studio tools for Unity here.

So, let’s start  with the small tutorial! This game’s development has many aspects, we’ll attempt to touch all of them one by one. First of all, we used Unity’s spritesheet editor to “slice” the spritesheet and get references to specific sprites

image_2F509071.png

Then, we created a small animation to simulate the flight course of the bird (this can be easily accomplished if you drag-drop the relevant sprites into the scene).

image_6E47326E

Now, let’s take a more detailed look at our scene. We have various objects made children of our perspective camera and the Flappy bird.

image_05090AA9image_0D2036FERead More »

Simple Puzzle Game in Unity (source code provided)

I had blogged in the past about a simple puzzle game in XNA. Nothing better than to recreate it in Unity with a tutorial, of course! To begin with, here’s a screenshot of the game running on the editor

image

The purpose of the game is to tap/click on the pieces next to the empty one so that they exchange positions. It goes on and one until you make the pieces appear as in the original photo. Since you are reading this article, I suppose you most probably are a novice Unity user. The following Microsoft Virtual Academy video might be useful for you: http://www.microsoftvirtualacademy.com/training-courses/developing-2d-3d-games-with-unity-for-windows-jump-start

To begin with, we’ll need a photo. The best way to save yourself from copyright issues and not having to read licenses etc is to use a photo that you took! So, we need to slice it. For this purpose, we’ll use Unity’s native 2D tools and its sprite editor.

image

Once we set the sprite mode to multiple, we can use the sprite editor to ‘slice’ our image. Since the image does not have an alpha channel, we’ll use Grid slicing. Moreover, we’ll name our exported sprites with a name that contains their location information (i.e. piece-0-0 => this implies that the sprite’s “correct” location is on the top left corner of our game). Plus, we’ll set each sprite’s pivot point to be top left, since this will help us in positioning.

imageRead More »

Brick game (like Arkanoid) tutorial in Unity (source code included)

This tutorial is meant for educational purposes only to showcase how to build certain types of games. Please respect the copyrights/trademarks of others!

Some time ago I did a blog post about a brick game (like Arkanoid) and its adaptation to Windows Phone using XNA. Couple of weeks ago, I attempted to recreate it from scratch using the Unity game engine and, to no surprise, it was pretty a piece of cake. Below you can see a screenshot from the start screen of the game.

image

Game has been tested on Windows Phone/Store apps. For instructions on how to deploy your existing game onto Windows Store/Phone, check out the Microsoft Virtual Academy video here: http://www.microsoftvirtualacademy.com/training-courses/porting-unity-games-to-windows-store-and-windows-phone

Let’s do a lap around the project. First of all, we have one and only one scene, the game one.

image image

We have

  • a Camera, set to Orthographic projection (most suitable for 2D games)
  • a directional light
  • a GameManager gameobject which holds the GameManager script, in charge of running our game
  • the Ball which goes around on the level
  • the Paddle which is the means that the user will utilize in order to prevent the Ball from touching the floor
  • the Floor, which if collided with the Ball will decrease player’s lives
  • the SideBlocks which just make the Ball stay in our level
  • the Status Text GameObject which will display text messages
  • and, of course, the Blocks which have to be hit by the Ball (via user’s assistance) and are organized in four BlockRow objects

Read More »

Bubble Breaker tutorial in Unity (source code included)

About 4 years ago I had blogged about the creation of the classic Bubble Breaker game in XNA. Since I’ve recently started to get acquainted with the Unity3D game engine, one of the first things that crossed my mind was to try and recreate it using Unity. Why did I choose Unity? Well, one of the reasons is that it supports my favorite programming language C# plus games can be exported to my favorite platform, Windows Phone. Conversion from XNA was not that straightforward (well, I expected that, to be honest) in the matter that only the search and compare algorithms managed to survive. Game code was written in Visual Studio (check the free Community edition here). For debugging purposes, don’t forget to check the Visual Studio tools for Unity here.

Game implementation is pretty basic, it contains 3 screens. First, we have the intro screen where you can select either to play the game or view the top 10 scores. Then, there is the main game screen (we’re making a game after all!). All screens have a script to dynamically change the background color. Purpose of the game is to remove all (or at least most of) the bubbles in the game by tapping. Once the user taps on a bubble, the neighboring ones (vertically and horizontally) will be marked for removal. On a second tap to one of the marked bubbles, they will disappear and the ones above these will fall due to gravity. Moreover, game tends to push the bubbles onto the right of the screen, so as not to have an empty column during the course of our game. Check out some screenshots from the game running inside Unity Editor.

image image

Main screen contains some simple Unity GUI buttons in which we can navigate to game and high scores screens, plus a simple checkbox to activate/deactivate sounds (I got that feedback from the single beta tester – that’s me!).

On the game screen, each bubble is a rigidbody (that’s Unity way of saying that each bubble obeys the laws of gravity). We keep track of the positions of all bubbles in a 2D array and we initialize each and every one using a random color, dynamically pulled from the ResourcesMaterials folder (yeah, this could have been done in an easier way but I just wanted to experiment with dynamically loading stuff without providing them as fields/parameters to the script).

imageRead More »

Presenting at Microsoft Build 2018 about game development and Azure

IMG_0052

This year, I was lucky enough to be invited to Seattle to present two sessions on Microsoft Build 2018 developer conference. Both sessions were presented by Brian Peek and myself and their focus was on game development using Microsoft Azure.

At the first session, we demonstrated how to scale dedicated multiplayer game servers on Azure Container Instances using various Azure Services like Functions, Event Grid and more. Project we demonstrated is open source, completely written in Node.js and you can find it here on GitHub. Same project got a really cool mention at the Azure Container Instances general availability announcement blog post, check the video here (thanks Justin!).

At the second session, we demonstrated how to use Azure Cognitive Services as well as Functions and Cosmos DB to power up a Unity game. Moreover, we added some PlayFab stuff like leaderboards and events. This project is open source as well and you can find it here.

Read More »

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 »

Projects

Some interesting projects I’ve recently been working with:

  • Scaling Dedicated Game Servers on Azure Kubernetes Service demonstrates how to use managed Kubernetes on Azure to scale dedicated game servers. We use various Kubernetes-native approaches like custom controllers, admission webhooks, custom resource definitions and more
  • Azure Container Instances Management, managing and scaling Dedicated Game Servers using Azure Container Instances, Azure Functions, Table Storage and Event Grid. Featured on Azure Container Instances announcement blog post (check the video here) as well as presented in Microsoft Build 2018 conference (recording)
  • AzureFunctionsNodeLeaderboards-Cosmos, a game Leaderboards API hosted on Azure Functions and backed by Azure Cosmos DB with MongoDB API
  • InGameSurvey and MessageOfTheDay implementations using Azure Functions and Table Storage. We provide a Unity SDK as well
  • Azure Services for Unity, a library that allows easy access of Azure Mobile Apps via the Unity game engine
  • formflowbotbuilder, an implementation of FormFlow for Microsoft BotBuilder node.js SDK. Here on NPM
  • A lot of game development tutorials
  • gaforgithub, unofficial Google Analytics tracking for GitHub projects
  • MyHomeStatus, a home monitoring solution using Raspberry Pi, Docker and Azure Web App for Containers
  • Having fun with Rasberry Pi and Windows 10 IoT Core
  • Universal Helpers, a library of various UI-related utilities for Universal Windows Apps. Here on Nuget

Moreover, I’ve co-developed some educational games, they are listed here:

Windows 8.1 and Windows 10

apps.6481.9007199266379941.ff385700-42dc-47d5-a27f-9ec02891a50d First Words with Phonics

“First Words with Phonics”, (adaptation of the Windows Phone app) is one of the first Educational application for Windows that helps children learn the sounds of letters, letters names, how they form words and spelling. “First Words with Phonics” includes 75 words in three categories, specifically Animals, Vehicles and Shapes+Colors. The three different hint alternatives (color hints, letter hints and color and letter hints) combined with five more settings, will challenge your child and help you fine tune the level of difficulty.

Logo.scale-100 First Puzzles: Animal Kingdom

“First Puzzles: Animal Kingdom” is an educational application for Windows that contains 30 puzzles for children to improve their visual perception and develop fine motor skills. The app keeps kids engaged through a fantastic star reward system, where kids earn stars for successfully completing puzzles. It also features adaptive learning, each time a puzzle is completed the difficulty level is automatically adjusted to pose a greater challenge on the next level.

Windows Phone apps

Math Puppy: Math Activities for Kids

Math Puppy is an educational app that teaches math to kids. It allows them to respond verbally to the various questions asked in 10 different languages. Moreover, it utilizes gamification techniques by awarding accessories to correct question so that the child can dress the “math puppy”. The app was awarded from the AppCampus program, a collaboration of Aalto University, Nokia and Microsoft that recognized innovative apps from mobile startups around the world. It was also featured on official Windows blog.

ApplicationIcon First Words family of games

“First Words” family of games contains educational games for Windows Phone that help children learn letter sounds (phonics), letter names, how they form words and spelling. Featured by Microsoft in the US, the UK and numerous stores throughout the world. Installed on Jessica Alba’s Windows Phone (ad was featured on NBC) and featured on Windows Phone 8 Launch event and Build 2012 event. Available in different languages and adaptations.

English Animals, Vehicles, Shapes and Colors
Spanish Animals, Vehicles, Shapes and Colors

Worth mentioning is the fact that most of the User Interface interaction patterns used in the described tablet/mobile apps have been described in my co-authored paper “Interaction patterns for Windows 8 tablet applications

 

Snake and Tetris-like games with Sense HAT on a Raspberry Pi 2 loaded with Windows 10

tl;dr – me n33dz the codez => check here on the SenseHatGames folder

The Sense HAT is a small and inexpensive board  for Raspberry Pi. It sits on top of it and offers a variety of sensors and (most importantly), a 8×8 RGB LED matrix and a 5-direction joystick. More specifically, it offers access to these sensors

  • Gyroscope
  • Accelerometer
  • Magnetometer
  • Temperature
  • Barometric pressure
  • Humidity

IMG_20160125_234729929_TOP.jpgSense HAT on top of a Raspberry Pi 2. You can clearly see the 8×8 RGB LED matrix whereas the joystick is on the bottom right of the HAT.

Absolutely worth mentioning, this board has also gone to space in the Astro Pi mission as part of a competition in the UK! I recently purchased one and, apart from the fun I had interacting with the sensors, I really liked the LED matrix and the joystick. So, I thought, why don’t I try and create a couple of games on it?

Read More »

Speaking

Here you can find a list of some recent and forthcoming events, don’t hesitate to come and say hi if you’re nearby!

2019

2018

2017

2016

  • 17-18/12/2016: SmartCities Hackathon, supported by the Municipality of Athens, mentor and judge
  • 8/12/2016: 9th Hellas GIS conference, presentation about Big Data on Azure, National and Technical University of Athens
  • 1/12/2016: be finnovative accelerator, presentation about Azure and Bizspark
  • 22/11/2016: VivaNest accelerator, judging committee
  • 25-26/6/2016: Beyond Hackathon, Mentor
  • 3/6/2016: Xamathon, Xamarin Hackathon by Microsoft Greece, talking about developing cross platform mobile apps using Xamarin.Forms
  • 28/5/2016: 5th Career Days by kariera.gr, talking about new developments in Microsoft dev tools and services
  • 16-17/5/2016: “Digital Dragons“, game development conference, Krakow, Poland, talking about Azure for game developers
  • 21/4/2016: 6th Infocom Apps conference, Keynote speaker
  • 16/4/2016: “Fosscomm 2016“, University of Piraeus, talking about Microsoft and Open Source
  • 3/4/2016: “Panorama in Entrepreneurship”, Athens concert hall, talking about Microsoft offers for startups and Azure cloud
  • 18-19/3/2016IoT Hackathon, Microsoft Greece premises, talking about Windows 10 IoT Core and Azure IoT Hub 
  • 12/3/2016: Azure in Game Development in “Spotkanie online Szkoły Twórców Gier”, online event for students in Poland (video in Channel 9)
  • 27/2/2016: ASP .NET MVC and Microsoft Azure, SAE Technology Group, Athens
  • 25/2/2016: Windows 10 IoT Core and Azure IoT Hub, DotNetZone user group meetup
  • 5/2/2016: Startup Europe Week Chania, talking about Microsoft and startups
  • 29/1/2016: Global Game Jam Athens, talking about Unity + Visual Studio integration, Azure Cloud services
  • 22/1/2016: The C# programming language, as part of the Object Oriented Programming curriculum, Department of Informatics and Telecommunications

2015

  • 20/12/2015: Pioneers Athens startup competition, participation as a judge
  • 18/12/2015: University of Piraeus, teaching Cloud and ASP.NET Web API to MSc students
  • 11-12/12/2015: Night Of the Living devs, a 24-hour Windows Store app hackathon, participated as a mentor and a judge
  • 1/12/1015: Digital Gate Awards Ceremony, speaker about startup offers and opportunities by Microsoft
  • 28-29/11/2015: Microsoft Student Partners Summit, speaker about ASP.NET MVC and Universal Windows Platform
  • 25/11/2015: Azure Web Camp, speaker about ASP.NET MVC and Azure
  • 22/11/2015: Startup Safary Athens, speaker at EGG incubator about startup offers and opportunities by Microsoft
  • March 9th to November 9th: I got a leave of absence due to my obligatory military service
  • 27/2/2015: Game Development with Unity, speaker at a .NET Meetup in Thessaloniki
  • 21/2/2015: The C# programming language, as part of the Object Oriented Programming curriculum, Department of Informatics and Telecommunications

2014

  • 25/11/2014: Universal Apps Development, as part of the Software Engineering Curriculum, University of the Aegean, Samos
  • 21/11/2014, Building apps with C# and XAML, School of Electrical and Computer Engineering, Aristotle University of Thessaloniki
  • 25/9/2014: Building games on Windows with the Unity game engine, Microsoft Innovation Center, Malta
  • 10/4/2014: Imagine Camp development workshop at SFHYMMY7, Aristotle University of Thessaloniki
  • 31/3/2014: Imagine Camp development workshop, University of Patras
  • 26/3/2014: Imagine Camp development workshop, Department of Computer Science and Engineering, TEI of Thessaly
  • 20/3/2014: Imagine Camp development workshop, University of Piraeus
  • 19/3/2014: The C# programming language, as part of the Object Oriented Programming curriculum, Department of Informatics and Telecommunications
  • 27/2/2014: Windows Phone Workshop, Computer Science department, Athens University of Economics and Business
  • 12/2/2014: Keynote speaker, Infocom Apps conference (YouTube)
  • 6/2/2014: C# for Windows Store Apps, Microsoft Greece DevDays