My articles featured on Gamasutra!

So, this summer I had my 15’ of fame as Microsoft sponsored some articles/tutorials on the well known game development website Gamasutra. Some of my Unity development blog posts were selected, specifically

Creating a simple puzzle game in Unity, source code here on GitHub

Create a Bubble Breaker style game in Unity, source code here on GitHub

– A tower defense-style game in Unity part 1, part 2, source code here on GitHub

A brick breaking game in Unity, source code here on GitHub

Check here for all the Microsoft sponsored articles on Gamasutra and here for all my game development blog posts.

Building a match-3 game (like Candy Crush) in Unity

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 find the source code here.

Match three games are pretty famous these days. From the original Bejeweled to Candy Crush Saga and even Evolve: Hunters Quest, many games are based on the match 3 mechanism while giving specialized bonuses to the user. Such an example is giving a special item if she matches more than three items. If the user creates a match that includes this bonus, then the whole row or column is destroyed.

In this blog post, we’ll try to dissect in what is needed to build such a game, using Unity 3D, Visual Studio and the C# programming language. 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.

Let’s start with a screenshot of the game running in the Unity Editor

image_5062F746.png

Only external assets we’re using are some candy graphics (Public Domain, found on OpenGameArt here) and a very cool sound (found on FreeSound here) to build our game. User can drag (in an attempt to swap) one candy either horizontally or vertically. When the swap happens, the game checks for a match. As soon as a vertical or horizontal match of three (or more!) is encountered, the matched candies disappear. Remaining candies collapse, new candies get created to replace them which collapse, too (imagine gravity acting upon them). The game checks if another match of three is encountered (without any user intervention). If this happens, the matched ones disappear again, remaining candies collapse, new candies fall and so on and so forth. This goes on until no match of three exist and user intervention is required for the game to go on. If the user does not touch the screen for a while, potential matches (candies that if one of them gets swapped will form a match of three) start animating, to give the user a small hint in order to continue the game.

The described game flow can be visualized in the below diagram

image_659DD063

Read More »

Playing music on netduino via a web browser

I was really lucky lately to get my hands on a netduino. I’ve never programmed on such a small device before and I have to confess that it’s really fun and awesome!

First, take a look at the video to see what’s going on. Basically, we are instructing the netduino to play a specific set of noted via a web browser on our PC.

(Please visit the site to view this video)

We’re using a netduino device. For the unaware, it’s a small device that runs a small version of the “big” .NET Framework, called .NET Micro Framework, so one can easily use C# and Visual Studio to code for it. It’s connected to a Piezo, a small component that can create some noise.

WP_20150115_11_39_20_Pro__highres

We’ve connected the netduino to our PC via USB cable and via an Ethernet cable. The USB connection allows us to deploy and debug our stuff on the device whereas the Ethernet cable allows us to make a small LAN between netduino and our PC. Without any more hassle, let’s check the code!

Playing music

Code was found on Getting Started with Netduino book. It basically adds octaves on a hashtable, sets frequency and period, connects to the speaker (via PWM which is accepting input on the Digital 5 Pin) and plays the respective input. Check the full code here

image

image

Web Server

Read More »

Microsoft Job postings for Software Engineers 2014 -2015

a

Opportunities

If you are ready to ask the big questions, to work to make technology better, and push the edge on innovation, let’s make it happen together. At Microsoft we offer you the opportunity to start your global career. With a presence in 190 countries you have the chance to impact users around the world.

Software Engineers at Microsoft are passionate about building technologies that make the world a better place. Work on software applications and services for consumers, gamers, developers, or large enterprise customers. Our teams touch all levels of the stack, so you will find the technology that excites you. Your efforts on the design, development, and testing of next-generation applications will have an impact on millions of people.

Software Development: New Graduate and Intern

Qualifications:

· Pursuing a Bachelor’s, Master’s or Ph.D. degree in Engineering, Computer Science or related field

· 1-2+ years of experience programming in C/C++, Java, C# or other computer programming languages preferred

· Practiced in the design and development of tool architecture as well as feature definition, design, and feasibility

· Ability to derive creative and innovative solutions by thinking "outside the box"

· Demonstrated skill in estimating development time

· Ability to solve complex problems and write automation systems and device drivers

Apply NOW to be considered for interviews:

 www.microsoft.com/university

Locations available: Czech Republic, Denmark, Ireland, Norway, United Kingdom, and the United States

Do you want to know what's it like working at Microsoft as an Engineer? Check out some interviews by Greek students here: http://studentguru.gr/academics/f/170 (in Greek)

A Tower Defense game in Unity, part 2

If you’re in a hurry, you can find the complete source code on GitHub: https://github.com/dgkanatsios/TowerDefense. You can try the game here in WebGL.

It is recommended that you read part 1 before proceeding on reading the rest of this tutorial. On the first part, we explained the way game levels are saved/loaded from XML files, as well as the Object Pooling technique. In this part, we will deal with the core Tower Defense game mechanics.

This is the second post in 2 post tutorial regarding making a tower defense in Unity. In the first post we described the game scenario and gameplay and we also mentioned the level editor, the XML file and structure that holds level information and the object pooler methodology we use. Again, if you haven’t read it, I strongly encourage you to do it ASAP, this post will be much clearer after that!

We’ll start by exploring the prefabs we have in our game.

The RootGO gameobject

In the instructions we gave at the previous post about making a new level, we mentioned dragging a prefab called “RootGO” to the scene. Let’s see this object’s children in detail.

image_112F268B

Read More »

A Tower Defense game in Unity, part 1

If you’re in a hurry, you can find the complete source code on GitHub: https://github.com/dgkanatsios/TowerDefense and the second part of the tutorial is posted here: https://dgkanatsios.com/2014/09/06/a-tower-defense-game-in-unity-part-2-3/. In part 1, we will see how the game levels are saved/loaded from XML files and a mechanism we use to optimize our game, called object pooling. In part 2, we will visit the core tower defense game mechanics. You can also test the game in WebGL here.

Unless you’ve been living in a cave in the recent years, you surely must have played a Tower Defense style game. Be it Plants vs Zombies, Kingdom Rush, geoDefense, Jelly Defense or any other, I’m sure you’ve spent much quality time setting up your defenses, killing enemies and advancing stages. So, since it’s one of the most common game types you can find on the application stores out there, I decided to try my luck and create one from scratch, using Unity3D and present it in this tutorial. Since it’s a bit bigger compared to my previous efforts, it will be split in two parts. In this first post, we’ll describe the game, the level editor, the respective XML creation and parsing and the object pool used in the game to increase performance. Check the screenshot below to get a taste of how the game looks like, running on the Unity editor.

image_1B244292.png

Scenario and gameplay are both pretty basic, actually. Badgers are attacking user’s bunny house and she has her Chuck Norris trained bunnies to protect it, by shooting arrows. In order to be able to create more protector bunnies, user needs carrot money. If user kills all the badgers after the predetermined number of rounds, she wins. If enough badgers get into the bunny house, user loses! Badgers follow a path in order to approach the house upon which protector bunnies cannot be placed.

Let’s dive a bit deeper into the game mechanics and gameplay.

Bunny House: Initial life is 10, each badger that arrives If 10 badgers arrive at the house, game is over.

Path: The path that the badgers will walk on in order to arrive at the house. Specific waypoints will designate their direction.

Badger: Our enemy. It has a speed property and a health component, which is decreased when it is hit by an arrow. It follows waypoints (non-visible gameobjects) that are placed on the path pieces.

– Bunny: Our defense. It can shoot arrows at a constant fire rate. It starts its activity by looking for an enemy at a close vicinity. If it finds one, it starts shooting. If the enemy dies or leaves the vicinity, it searches for another enemy. Has a standard carrot cost to create.

Carrot: Falling randomly from the top of the screen. User needs to tap/click on them in order to increase money, to create more bunnies.

BunnyGenerator: (yeah, I could have come up with a better name) It’s the bunny on the lower left part of the screen. User needs to drag it in order to create new bunnies. On areas that a new bunny cannot be created (such as on the path), it will highlight them as red. Upon a new bunny creation, a standard amount of money will be taken of the user’s account.

Level Generator:  All game levels are to be stored in an XML file that uses a standard format. The Unity developer has the option to use a custom made Unity editor that saves the file from the scene editor to an XML file.

We also have a couple of “roles” that will be mentioned in this tutorial

Unity developer: The one that will use our custom editor to create new levels for the game

User/gamer: The end user that will enjoy our game!Read More »

Introducing Universal Helpers for Windows Store apps

I’ve been using various small XAML storyboard utilities and behaviors in my latest Window Phone and Windows Store apps. I’ve just packaged them all and released them into GitHub. Universal Helpers may not be that good of a name since the library is pretty small (yet) but I hope to enhance it in the future with more utilities and behaviors. So, let’s jump right in and see what’s under the hood!

First of all, there are some Blend Behaviors. I love behaviors! Easy just as a Drag’n’Drop, yet so powerful! What’s even more great is that Windows 8.1 SDK has a Behaviors SDK, which, to no one’s surprise, works with Windows Phone 8.1 Store apps. A limitation right now is that you can’t (at least easily) write Behaviors in a portable class library, that’s why I’ve implemented them in the Shared project. Let’s see them, one by one.

DragElementBehavior

This behavior allows any element with a CompositeTransform to be dragged. It has options for inertia plus a container, in order to never be out of bounds (either by dragging or inertia movement). Plus, it has Boolean options for rotation and multitouch scaling.

FeedbackBehavior

This behavior allows for simple feedback (opacity change) when an element is pressed. Moreover, with the flexibility the Pointer API provides us it increases the scale when the mouse is over the element.

TapStoryboardBehavior

This behavior executes an animation when the user taps an element. Optionally, when it’s completed, it can fire up a custom method (this one’s using Reflection, if you know a better way let me know!).Read More »

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 »