Using coroutines to create tutorials in Unity 3D

When reading the first time about unitys co-routine concept I thought by myself: How can this be useful?

In the meantime I found out that co-routines are one of the most interesting features of unity 3d.

For my actual game project I use them for several purposes; the most useful is to control interactive level tutorials.

The game contains an advisor avatar:

It guides the player through the level and automatically appears when a milestone is reached and the next hint is needed.

Co-routines are the perfect tool to manage this kind of tutorial.

  1. Create a co-routine and run it when the level starts.
  2. If a initial introduction is needed, this should be the first command inside the co-routine.
  3. Create a WHILE loop which waits till the next milestone event happens and contains a “yield return null;”.
  4. What a milestone is depends on the kind of game you are working on. For my actual game project these are “opening a dialogue”, “selecting a specific object” or “reaching a special place in the level”.
  5. When the condition of the milestone becomes TRUE, the WHILE loop will exit. In my game the next command after the WHILE loop invokes the advisor popup to explain the next step.
  6. Then the next WHILE loop to wait for the next milestone follows – and so on. 

Here is an example how such a tutorial code could look like:

    protected IEnumerator HintPlayback(int moneyToAdd, int itemsToBuy)
        yield return new WaitForSeconds(4);

        ShowMessage("Please look at the pending tasks.");

        while (!this.tasks.AreOpen) yield return null;

        ShowMessage(string.Format("Please add some money - at least {0}$.", moneyToAdd));

        while (! < moneyToAdd) yield return null;

        ShowMessage(string.Format("Perfect. Now please buy at least {0} items.", itemsToBuy));

        while (!this.items.count < itemsToBuy) yield return null;

        ShowMessage("You have completed the tutorial.");

        yield break;


You can also skip one ore more hints if milestones are skipped: just check for both conditions (for milestone 1 and 2)  in the WHILE loop of milestone 1.

Ultimaker 2+ arrived

Seven years ago in 2009 I started my first experiences with 3d printing.

It took 2 weeks to assemble my first 3d printer – a rapman from UK. It had no heated built plate and the software needed lot of tuning and testing.

The rapman in 2009:

Then in 2011 I got the makerbot thing-o-matic. It had a heated, automated build platform and only took 2 days to assemble. The software still needed time to tune and to find out the best setting.

All this time I never managed to get PLA printing well – only ABS worked fine for me.

The makerbot in 2011:

Yesterday – 5 years after the makerbot – my ultimaker 3d printer arrived.
In my opinion there are worlds between these two last devices.
The ultimaker looks like from the future with its white led lighted housing, while the makerbot looks like from the past with his wooden case.
The ultimaker prints a lot of finer and more silent than my old makerbot.
No (or only a little bit) software tuning is needed– it is nearly plug and print.
It is very impressive for me to see, how big the improvements of these 5 years are.

Here are some impressions:

Improving the Oculus Rift DK2

During the last weeks I added two useful extensions to my oculus rift.

Attaching the leap motion

The first one is a “must have” for the virtual reality glasses: The leap motion controller.

Attach it to the front of the oculus rift to see your own hand inside the virtual reality. 
I already tried to manage this effect using the Kinect some months ago. But the leap motion solution is a much easier to handle.

Attaching a fan

Sometimes - especial in the summer time - the oculus glasses got a little bit fogged. 
This can be disturbing when in an exciting elite-dangerous battle. So I added a small fan to the rift. It can turned on, when needed. 




PaperMe ported from silverlight to HTML5 and bootstrap

PaperMe is a tool to design papercrafts from photos. I created it in 2010 using Silverlight which seemed to become a good alternative to flash.

Unfortunately flash *and* Silverlight “died” because they are not supported on mobile devices.
So it was time for a total makeover.

It took a lot of work porting PaperMe to HTML5 and responsive Design, but now it´s finished.

If you are interested to create a personal papercraft of yourself, your partner or your favorite celebrities –  just give PaperMe a try :-)

Creating self growing level

For my last game Project Pumpkin Jumpin 80 level had to be created. That made up a large part of the work. In addition, a level editor had to be created.

the work on the game logic was much more fun to me, I decided that my next game will use automatically generated levels.

Although it was quite a bit of work, but now the first version of the self-growing city is ready.
The algorithm
is still not perfect: The density of roads is still too high and the street pattern still look too synthetic.

Here are the first animated screenshots: