If you are building a game from Unity to deploy on Android it is quite easy to install a plugin that lets you have control over the exact positioning of adverts. If you are outputting to Windows Phone however your choice is much more limited. I’ve found many of the Windows Phone advert plugins seem to have problems with Unity 5. I’m not quite sure why this is, but perhaps Microsoft’s struggles with unifying the Phone/Desktop SDK, recent changes to Unity and lack of uptake of Windows Phone has left the available tool sets underdeveloped.
Still, one method that is very easy is to implement ads outside of Unity by positioning them in Visual Studio instead. Here is a quick guide on how to add adverts to the top of your game. I assume that you can control when they appear with a little bit of extra code, but to keep it simple I won’t go that far here. This method should work for whatever ad network you want to use (or indeed should work for the Microsoft Ad Mediator). The steps:
Build Finished Game in Unity
Once you’ve finished In Unity you need to build you game as normal by navigating to file->build. Check that you have selected Windows Phone 8, add the scenes you want and press build. This will create a Visual Studio project at the location you desire. I am not a native Windows Phone developer but as far as I can tell Unity will build you a Windows Phone 8 Silverlight project if you use this option. Perhaps this is to do with Microsoft trying to merge phone and store development practices with Windows Phone 8.1.
Open Project in Visual Studio
Navigate in Windows and open your newly created project. I’ve had trouble in the past with Visual Studio projects built by Unity (mainly when using NuGet) because they don’t come with a solution, so the first thing I usually do is save the project again, this time within Visual Studio, to create the solution file. However, I don’t actually know if this is good practice but I seem to get less headaches when I use package management bits and pieces.
To show adverts you are going to need to include the advertising SDK in your project. If you want to use Microsoft PubCentre then you simply need to make sure this is installed, I’m pretty sure that you need to download the SDK targeting Silverlight for WP 8. Still, I use AdMob, its developed by Google and it seems to go in phases of working really well on Windows Phone and then suddenly deciding to be rather poor on anything except android. If this is down to the fact Google can’t keep up with Microsofts new strategy for cross platform apps or the fact Google just want WP to fail I don’t know. Still, if you want to use AdMob you must include references to the GoogleAds library. This is easy enough to do:
2. In Visual Studio right click references in solution explorer and select add reference
3. Navigate to the DLL you have just extracted and add it as a reference. At this point sometimes Visual Studio gives you an error when importing like ‘Microsoft visual studio a reference to a higher version or incompatible assembly cannot be added to the project’. If you get this error then you need to right-click the Google DLL, select Properties and then click on the Unblock button
Place Advert and configure
You need to place the advert on the mainpage.xaml file. You can do this by either opening the designer and toolbox (open file and then press ctl+alt+x) and dragging on an AdView/AdControl element. Adview is Google AdSense, AdControl is pubcentre. Or you can directly paste the XAML:
<UI:AdControl ApplicationId="XXX" AdUnitId="XXX" HorizontalAlignment="Center"
Height="80" Margin="0,0,0,0" VerticalAlignment="Top" Width="480"/>
<GoogleAds:AdView AdUnitID="XXX" Format="Banner" HorizontalAlignment="Center"
Margin="0,0,0,0" VerticalAlignment="Top" Height="80" Width="480"/>
You only want one of these will need to replace XXX with your own values. Also make sure it is aligned as you want to display it.
This will display the ad in the position you choose. Don’t forget you will need test values in for development, although I am guessing most development testing will be done using ‘build and run’ in Unity.
Over the past year I have found myself playing with ways to create new ways to revise for students, mainly based around creating quick quizzes in different forms for my students to take on the go. My personal strategy has always been to ‘top up’ my revision sessions by doing flashcards on the basics of a subject; I always gathered that if I knew the fundamentals of what I was revising then the rest would come easier. Group revising has also worked well for me and another reason I’ve always like quick quizzes is that they can be done in a group and discussion is usually built on top of the activity.
A little while ago I came across Fungus,a Unity Plugin for visual story telling, I have quite a few ideas of things I would like to do with Fungus, and I thought as a test to get myself used to the system, I would try and create a revision game as it would fit in with my other experiments. My thinking was that I could throw all my quick quizzes in to a revision game that students could use to revise on the bus to learn fundamentals, but could also play the game in a group making it the focus of a revision activity.
I have previously had a very brief go with Fungus to test how possible it was to get something up and running, but a few days ago decided to spend a full day with it to see how viable an option it was to create e-learning material quickly. After the day I was quite impressed with how far I got with the tool and thought it would be a good time to take stock of what was possible in a day and write up some notes on my experiences..
Fungus claims that it is a tool for people who can’t code to help them make games, from the fungus site:
‘Fungus is popular with writers, illustrators, animators and game designers, especially visual novel & interactive fiction authors. ‘
My guess is that most lecturers and tutors will be jumping at joy of the prospect of creating a game while not writing any code. I, on the other hand enjoy tinkering with a bit of C#, the language that many Unity games are based, but don’t particularly enjoy graph or UI design. While Fungus makes a deal about supporting the designers, it doesn’t mention people like me in it’s sales pitch, it does however help us quite a lot, it gives us a solid user interface and then holds your hand by telling you where it thinks thinks like images, avatars and menus should go.
This made me think, tutors making revision applications will have different skill sets, some will be ok with graphic design, story writing, coding and they will different resources available to them. My situation is:
I have a CSV of questions and answers that I want to turn in to an app to help students revise
I am a fairly high level ‘tinkerer’ of code. I don’t mind going in to scripts and editing, but don’t really fancy writing my own frameworks
I do not have any images or pictures for my application
I do not have the desire to create my own
I want as many options as possible for students to play my game. I would like it to be playable on the go, but it is no good as an android application.
I decided to try and find free or low cost solutions to the things that I didn’t have, this in itself was, and still is a learning curve in licensing, attribution.
Gathering the Resources
I already had the questions in CSV, I’m guessing that most lecturers will also have their questions in some format or another. I found that copying and organising content in to Fungus was by far the most time consuming aspect of creating the application, but I found methods to make this easier and automate the process, which I will go in to shortly.
Fungus lets you work with all kinds of character and environment assets, I thought that the easiest game set up for a proof of concept would be to have backgrounds and a character to appear in front of the background and talk via a text prompt. While this kind of game with characters and backgrounds might sound simple, it is the foundations of a very popular game genre, the ‘Visual Novel game‘, and probably a good place to start from. Since I didn’t want to open illustrator paint and start designing backgrounds and characters, I started to look for places with existing assets I could use. This in itself was a new learning curve for me.
First I took all the ‘topics’ that I wanted students to revise and looked for related images to use as backgrounds. I looked for the backgrounds at Wikimedia Commons, a database of freely usable media files. For somebody like myself who is finding licensing issues and the such a learning curve, Wikipedia commons is brilliant, not just because there are plenty of usable images, but also because it gives you advice on what you can and can’t do with each image and gives you examples of text to use when attributing the image.
I searched for download 5 images, one for each of my 4 topics and an extra one for my main menu. I saved them in to a directory named backgrounds so later I could just drag it straight in to Fungus to use them as backgrounds.
Visual Novels also tend to have talking heads, Fungus calls these ‘portraits’ and they are not the sort of thing I could find in Wikimedia commons. I found another online resource for visual assets called OpenGameArt where artists share their creations for games. Similar to Wikimedia Commons, the import aspect of the site for me was that it was clear about licensing and gave me example text for assets I had used. I picked a couple of character portraits for me game. I was particularly fond of this resource that gave me a few characters and different states of emotion that the character could be in. This will be useful in the future as Fungus allows you to assign multiple states to a character. I saved a few of the character portraits, a monk and a school teacher to a directory called characters.
I had my questions and art but I also needed the tools to make the game. Fungus is an open source, adventure game asset for Unity under a pretty permissive MIT license which you can access here.
Not everything I used was totally free libre, Fungus is built on Unity which is free gratis if you are not making $100,000 a year on your product. You revision app is tied in to the Unity ecosystem and in the future you will have to go along with whatever Unity decide is their business model. Since I wanted to develop apps that use Fungus, are quick to churn out and available on multiple devices, I don’t think there are really any other viable solutions. It might not be free as in speech, but that is a hit I decided to take and deal with for the ease of knocking out quick apps to multiple platforms.
Making the game
Fungus has many fancy options, but I decided to keep it simple for my first attempt. There were only two types of levels I needed, these were:
A menu screen to pick the quiz
The level screen to display a series of short 5 question quizzes
Fungus uses flowcharts to design the flow of levels, I won’t go in to detail on how to do it as the Fungus tutorial playlist is full of short tutorials that can sort you out very quickly. The gist is that I created flow charts for the Menu and Quizzes. For the Menu I used a series of menu blocks that shuffle the user around the screen until they get to the level they want, then a load scene action loads a new Unity Scene with a flowchart for the new questions.
It would be possible for my game to use 1 Unity scene filled with multiple flowcharts, but I have opted to use lots of scenes each with 1 flowchart. It is a bit confusing, but if you’ve used Fungus you will get the gist.
The reason for using individual scenes brings me on to the next things I needed
A teacher to tell the questions
I built one scene for my quiz levels, this was a simple flowchart that asked questions and gave the user a selection of menu items, if the write answer was clicked then a score variable would increase by one. I did a naughty things and copied and pasted this scene 25 times, one for each quiz. The reason I did this was that Fungus allows users to export and import text in to a workflow, I wanted each workflow to have the same IDs for its blocks and activities and didn’t know if this was possible my work flow shared the same scene.
Importing the questions
I have my questions in a CSV and need to get them in to the question workflows that live in their own scenes. Fungus has an option to export and import text from a workflow so I wrote a short script to take my CSV and convert it into 25 text files so that I could import 1 in to each scene. I found this saved me a lot of work, I won’t go in to detail on code for the transcript generator because people will have different need outs of it. My guess is that most people will want to write the content out manually; but I recorded it briefly generating the new transcripts if you are interested in seeing it in action.
The next step took a while. I loaded each scene by hand and I imported the transcript for each level, I then randomised the position of the correct answer question and created a character to ask the questions. Although, it might have took me and hour of repetitive tasks, but in the scheme of ‘how long does it take to create a free game’ I don’t think it was that long.
Publishing the game
I now have a working demo! It took about a day to get this very rough demo created although I think that most of the effort was in transferring content to the game and creating the Menu system. Now that I have the system in place I am going to come up with some more ways of automating conversation of content to transcripts. Like I say, it is very rough and there are quite a few things I would like to implement:
More varied expressions from characters
Different Characters to ask questions
Bigger Characters to talk
More varied backgrounds
More complex decision tree so that the dialog changes based on correct/incorrect answers
I didn’t want to publish my game to lots of marketplaces at the moment as it is still in demo phase, and will need updating and repushing to these market places. I opted to publish it to Kongregate (decided to go with Parse in the end) and Windows Phone market place because these are free and seem the most ‘suck it and see’ friendly platforms to try new things and because then I could try 1 mobile and 1 web based platform. Still, Unity lets you output to pretty much any major platform if I want to expand at a later date.
If you fancy playing my early demo you can try it on KongregateParse (if you have the Unity web player) or Windows Phone 8 store, although this takes a day or so to process so I don’t have a link yet. There is still lots to do if I decide to carry on with it, but I think lots of the work is done and I was impressed that you could get something basic up in less than a day. While I was playing I kept some notes of some of the obstacles I came across if you are interested:
Recently I’ve been playing around with the Unity Fungus asset. Although it works very well and I have not had many problems with it, the application is just coming out of Beta and there are a few gotchas. On the forums there seems to be one recurring bug people keep getting stuck with, which for some reason doesn’t seem to come up during a quick Google search. The problem is that when users call a new scene from a block using the ‘Load New Scene’ call option, all menu items on the new scene are not clickable. It is a known issue and an easy fix, which was kindly provided by Fungus admin Chris Gregan:
On any scene that has been called by a block you need to add a EventSystem GameObject. Simply load the scene in Unity and then create the GameObject through the Unity menu through this combination: GameObject > UI > EventSystem.
Fungus should create this GameObject itself during play but for some reason is failing to do so on a new scene call. After you have added it manually menu items on the scene will be clickable.
I have not written much in my blog recently, which is funny considering my aim after moving from my last institution was to ‘write something at least every day’. It doesn’t worry me because while I haven’t been writing here, I have been writing in a more formal approach on things that I hope will one day end up in my thesis. I’m not quite ready to share them yet – but that’s ok, I’ve been through this journey before, not feeling quite there and creating a blog for a rabbit to host the content. Still, it really does strike me as quite strange I haven’t put anything on here because since I left my old department a day hasn’t gone past where I haven’t thought to myself ‘wow that’s interesting, I really want to blog about that’.
I think the issue is that once you have removed yourself from a place, eventually your old patterns start to break down. Moving on can sometimes be a good thing, you stop checking the regular places for information simply because you work in a particular field and feel like you should. You start to look at different sources for inspiration: different news sources, technologies and artists. You move at such a pace you must remind yourself to stop, think and write on a public informal setting. In a way I’ve been on a voyage over the past few weeks reading and writing. I feel quite down about many things at the moment – most of those things related to job hunting, but there are still many ups being fueled by spending my energy in new head spaces. I think what I have in my mind and a little on paper is starting to look like a literature review and that feels good.
Still, the thing that brought me back to my blog was a desire to write about a something interesting that keeps cropping up in my literature review. I am interested in play and the design process. While doing a bit of reading and chatting to people about the design process I was put in the direction of a message board which described something interesting:
‘…[it] starts with conceptualizing all possible systems, regardless of whether they exist, and it is informed when some of them cannot be built or found in nature. ‘