(Mis)Understanding Applied Game Design: Vaccine!

Working with a no longer minuscule set of customers on applied games of a really wide spectrum of themes I’ve noticed in the early phases some misunderstanding that recur. In order to help both parties (game designers and field experts) to reach a common ground, I’ve set the misunderstandings in extreme and simplified form so you may use them as vaccine :-)

Also get the PDF here.

Follow me on Twitter where I post about game design, game development, Unity3d 2D, HTML5, applied / serious games.

 

Social Share Toolbar

A Circular Range Control for Unity UI

I needed a circular range control to be for a project using Unity UI, and there seemed not to be one built-in, I created one. I wanted it to work on both desktop and mobile (touch). In building it I found out that to make it usable it requires quite a bit of tuning. [Read more…]

Social Share Toolbar

Untangling GameObject State in Unity

In this short post and video I try to discuss and clarify a few points about GameObject state in Unity with respect to game, scene and “runtime” scope. It is a bit more complex than one may understand initially, so bear with me a little.

When you start developing scenes in Unity, it won’t take long before you start asking questions like:

How can I get the same GameObject in different scenes?

Why do static properties sometimes get reset across scenes?

Why when I reload a scene I get duplicated objects which are meant to be singletons?

How can I comply with the (highly practical) principle “Make the game runnable from every scene” when I have global instances from other scenes?

Here are some answers.

Here is the full schema I refer to:

GameObject State in Unity

While MonoBehaviour’s  life-cycle is quite well documented e.g. both directly in Unity docs here and also by third parties e.g. here, how to handle GameObject’s persistence in and across scenes may be more obscure.

So here are written (partial) answers to the questions above:

How can I get the same GameObject in different scenes?
Would be probably better to reword this as “how can I persist and share data across scenes” – and there are many ways to do that :-)

Why do static properties sometimes get reset across scenes?
Only static properties which are GameObjects present in the scene will get reset (typically singletons). Other static properties will be preserved across the virtual machine.

Why when I reload a scene I get duplicated objects which are meant to be singletons?
That is because you marked those objects with DontDestroyOnLoad and created them (also) in other scenes. Create them via code (not in hierarchy) checking before their existence.

How can I comply with the (highly practical) principle “Make the game runnable from every scene” when I have global instances from other scenes?
This is best done just as explained above: create the global objects in every scene via code if they don’t already exist.

 

Unity Execution Order

Unity Execution Order – from Unity documentation.

If you are in need of learning some good patterns in software game development, a really nice book is Game Programming Patterns. Here are also 50 Tips for Working with Unity (Best Practices) which I reread from time to time, understanding progressively more and more of them (but still not all :D).

Thanks to Daniele Giardini for some feedback on the state scheme above.

Follow me on Twitter where I post about game design, game development, Unity3d 2D, HTML5, applied / serious games.

Social Share Toolbar

Varieties of Game Applications

Can you use the pervasive media “videogame”  and this field’s design techniques for communicating effectively with people? Can games be used for what you have in mind? How can a field specialist work effectively with a game development team to communicate know how more effectively? [Read more…]

Social Share Toolbar

A little Unity project to explore a math puzzle

This math puzzle was proposed on The Guardian:

puzle

How to fill up the slots with the numbers from 1 to 9 and make the result 66? I proposed it to my kids, who are actually still too young to appreciate the algebraic solution. So I created a simple “brute force” explorer of the problem – here – and used to explore the possible solutions.

Brute force problem resolution

Here is the complete Unity project. Play with it!

Social Share Toolbar

How To Teach Fractions Making It Fun?

In my frequent survey of games and research concerning learning through games, I’ve stumbled upon this cute post: Teacher Uses LEGOs To Explain Math To Schoolchildren, which actually is extracted from Using LEGO to Build Math Concepts. [Read more…]

Social Share Toolbar

Creating Match 3 Games in Unity

How to create quickly a match 3 game in Unity? Or any kind of match game? I have been working on an original match 3 game (an applied game actually) together with Unity 2D guru Daniele Giardini and I took some notes, which I present in the video below. This is not a tutorial: I just point out some concepts you will probably need to deal with.

Consider also that this is all done with Unity 5, which by introducing 2D, sprites (and also new UI) has made it much simpler to create this kind of games. And as in all my games, its actually Unity plus Gamelogic Grids component, as in my models (and probably in games in general) grids are pervasive.

Here is the video:

I started writing my tests from GameLogic match 3 sample project. The code project is based on GameLogic’s Grids for Unity component, and I’m using as much as possible the DOTween’ component for smoothing movements and effects.

The GameLogic fellows compiled an exhaustive survey of match games, including a wonderful infographic on match game structure spectrum:

2015-09-18 16_28_08-Microsoft Edge

Subtleties of match 3 game mechanics

explodingSubtleties of game design mechanics emerge once you are creating a prototype: sequential matching, peculiarities of click / swipe matching, generative universe (no need of generational AI) … discrete / continuous matches … .

If you believe that game design is basically a formal activity, mainly to do with mechanics (which actually I believe to be too simplistic) you need to be a developer at least at some level, because in building the prototype you understand the mechanics, with all its possible variations.

References

Match Game Mechanics: An exhaustive survey.

GameLogic Match 3 sample project.

Grids for Unity GameLogic FAQ.

Match 3 game draft in Unity tutorial with full code.

You Must Build a Boat.

Follow me on Twitter where I post about game design, game development, Unity3d 2D, HTML5, serious games.

Social Share Toolbar

Post gameplay feelings: “This feels like a complete waste of time”

Why playing some videogames leaves you with a sour taste, with the feeling of having wasted time and even that you have somehow debased yourself?

A short reflection on post gameplay feelings, published on Medium here and then featured on Gamasutra.

 

Social Share Toolbar

Storytelling flow in videogames – DAG pod 23

In this podcast Daniele Giardini and Pietro Polsinelli (myself) discuss story flow in games – and how game endings are told. We roam from The Witcher to Sunless Sea, crossing game genres. Hear us here:

At the end of the podcast we read and discuss a quote from If Games Were Like Game Stories…

My favourite moment from Papers, Please was when someone gave me a banner for a sports team named the Arstotzka Arskickers. I had a choice of whether to put it up on my wall, or not.

Compared to all the other decisions… taking bribes, separating families, conspiring to take down the Arstotzkan government… this was a small and silly decision. I put it up on my wall, of course.

But the reason this is so memorable to me, is because the game actively acknowledged this small act! A few people commented on the banner, some remarking it’s tacky, some cheering “Go Arskickers!” And then, of course, this decision bites me in the ass when the inspector comes by and tells me the decoration is against protocol, and fines me.

Games and books quoted:

The Witcher 2 Witcher 2 cover.jpg
The Witcher 3 Witcher 3 cover art.jpg
Thinking Fast and Slow, Daniel Kahneman Thinking, Fast and Slow.jpg
Bioshock Infinite Official cover art for Bioshock Infinite.jpg
Bioshock (one) BioShock cover.jpg
Lord of the Rings Movies Ringstrilogyposter.jpg
Dark Souls Dark Souls Cover Art.jpg
80 Days http://a3.mzstatic.com/us/r30/Purple3/v4/dc/f6/80/dcf6809a-a0bf-a620-4f03-4d36907a29a3/screen1136x1136.jpeg
Shadowrun Shadowrun4A.jpg
Kardashian Hollywood
Sunless Sea http://cdn.akamai.steamstatic.com/steam/apps/304650/header.jpg?t=1424434198
Flick Kick Football Legends http://pikpok.com/wp-content/uploads/2015/02/en_ss_497x280_02.jpg
Alessandro Baricco https://www.penguin.com.au/jpg-large/9781921145483.jpg
Papers, Please http://screenshots.en.sftcdn.net/en/scrn/69660000/69660821/papers-please-08-535x535.png
Football Drama Football Drama

 

Follow me on Twitter where I post about game design, game development, Unity3d 2D, HTML5, applied games.

Social Share Toolbar

Simple Behaviour Trees for your game in Javascript and C#

A little while ago I tried to understand what Behaviour Trees are about, as in a couple of games I’m developing I have sets of NPCs that I have to manage and I would like to somehow decouple their behaviour from the main game flow. Here you can find a good explanation of behaviour trees.

Sample behaviour tree

Sample behaviour tree

Got this, I searched for implementations (I wanted both Javascript and C# implementations) and I didn’t like them because of the amount of code and classes required. Then on StackOverflow I found this very simple example:

Stack Overflow simple behaviour trees

Encouraged by this,  with Matteo Bicocchi we started writing our own implementations, as I simply could not believe that the code needed to be so complex 😉 . We first wrote the Javascript implementation, and the two main points we had to deal with have been:

1. Distinguish between the tree description and the instance tree being run: you need a concrete instance as you need to be independent of “tick” speed and need to be able for each instance to find what is the current node.

2. You need to handle single node completion asynchronously e.g. if you have a “chase” node, this may take a long time to resolve.

Now we have our implementation, its very simple code and can be useful in a wide variety of game development situations – surely its not a complete solution but it works fine.

Here is a simple Js Fiddle example you can play with directly in the browser.

Fiddle with behaviour trees

and here are full sources in both Javascript and C# on GitHub. The C# code is a simple port from Javascript, surely it could be refined (branch it!). It also contains two classes making the C# example run, its made with a for Unity (extends MonoBehaviour) but the code can be used anywhere.

The code is mostly commented in the Javascript version.

Follow me on Twitter where I post about game design, game development, Unity3d 2D, HTML5, applied games.

Social Share Toolbar