Disclaimer: this is an automatic aggregator which pulls feeds and comments from many blogs of contributors that have contributed to the Mono project. The contents of these blog entries do not necessarily reflect Xamarin's position.

August 26

Introduction to Android Material Design

We recently announced preliminary support for Android L Developer Preview, and as you dive into playing with the new SDK you will immediately notice one of the biggest enhancements is the brand new Material Design concepts that Google has developed. This is the first time that Google has created a full design specification for developers to work off of when creating Android applications. In this post I will introduce the main concepts and impact of Material Design for Xamarin developers including:

  1. Theming and Accenting your Android App
  2. Elevation and View Shadows
  3. New Drawable Capabilities

material design

Additionally, Jérémie Laval and I will be giving a wonderful session at this year’s Evolve entitled Android Material Design from Concept to Implementation. In this session we will cover every aspect of Material Design including design concepts, new widgets, animations, compatibility, and so much more.

Setting Up Your Project

Before we get started be sure you have all of the latest Xamarin.Android and Android SDKs installed. Be sure to read our Android L Developer Preview Support announcement for full details of how to get started. Once you have your project open you will want to update the Target, Minimum, and Compile Target Framework found under your project options General and Android Application settings. In the future, you will want to change your Minimum Target to support older frameworks, but since Android L is not officially released you won’t be able to ship L apps to Google Play yet. Additionally, be sure to create an Android L emulator or have a device such as a a Nexus 5 or 7 that can run the Android L Developer Preview.

MinTarget Android L
General Target

Material Theme

When developing Android applications you are able to use and customize themes to brand your application. You might already be familiar with the Holo theme that has become very popular in the last few years. Android L introduces a brand new Material Theme in multiple flavors that you are able to use in your application. These will not only theme your ActionBar, but will give you a refreshed style for all of the controls. Here are the three themes available:

  • @android:style/Theme.Material (dark theme)
  • @android:style/Theme.Material.Light (light theme)
  • @android:style/Theme.Material.Light.DarkActionBar

Android Material Themes

To start to use these themes you will first need to create a new folder in the Resources folder called values-v21. This is where any of your Material Theme customization should be placed. Since you will most likely need to support older versions of Android you would want to fallback to a supported Theme in the Resources/values folder for older versions. With this folder in place you should now create a new styles.xml file and create a new theme for your application that inherits from one of the themes above (to support older versions create a styles.xml in your /values folder and create a theme with the same name there). Here is a new theme for my app called AppTheme which is of the default dark material theme:

<resources>
  <style name="AppTheme" parent="android:Theme.Material">
  <!--Customizations Here-->
  </style>
</resources>

To use this theme you simple need to add it to your AndroidManifest.xml under the application node:

<application android:label="My Awesome App" android:theme="@style/AppTheme">
</application>

Alternatively, you can set it on a specific Activity with the Theme attribute.

[Activity (Label = "MaterialTheme",
           Theme = "@style/AppTheme")]

Add Branding

CustomThemeSometimes the default color schemes might not match your companie’s brand or you might just not like them. No worries, as Google has made it extremely simple to customize the Material themes by setting these three properties in your theme:

  • android:colorPrimary – Your app’s branding color
  • android:colorPrimaryDark – Darker variant of colorPrimary, used by default for status bar
  • android:colorAccent – Accent color for UI controls

Here is what a Xamarin based theme might look like with these colors:

<style name="AppTheme" parent="android:Theme.Material.Light">
  <item name="android:colorPrimary">#3498DB</item>
  <item name="android:colorPrimaryDark">#2C3E50</item>
  <item name="android:colorAccent">#B455B6</item>
</style>

You can customize the status bar with the android:statusBarColor attribute.

Elevation

When developing for Android L you are no longer restricted to just the X and Y properties of a control and have the ability to adjust the Z value to elevate controls off the page. To achieve this we are able to set the android:elevation attribute on our element using a specific size such as 2dp, which is used to determine the size of the shadow.

The shadow is drawn against the view’s background drawable. Let’s say you wanted to add an elevation to a TextView. You could set a background color and elevation, but you can spice it up and create a circle drawable for the TextView’s background with a specific fill color:

<!-- Resources/drawable/mycircle.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="oval">
    <solid android:color="#3498DB" />
</shape>

You would then set the elevation and background attributes on the TextView:

<TextView
  android:id="@+id/my_circle_text"
  ...
  android:background="@drawable/mycircle"
  android:elevation="2dp" />

Here are three lined up with different elevations:
Android Elevations

You are also able to set a translation of a view for animations using the View.SetTranslationZ method.

Drawable Tinting

A unique addition to Android L is that you can now define bitmaps as an alpha mask and easily tint them by using the android:tint attribute. You no longer have to create multiple versions of your assets to simply change their colors. Mixed with the new theme color attributes and the brand new Palette Library that enables you to get colors samples from an image you can do some amazing things. Here is an example of a white Xamarin logo tinted in a few different colors with a circle background:

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal">
    <ImageView
        ...
        android:src="@drawable/xamarin_white"
        android:background="@drawable/mycircle"/>
    <ImageView
        ...
        android:src="@drawable/xamarin_white"
        android:background="@drawable/mycircle"
        android:tint="#2C3E50"/>
    <ImageView
        ...
        android:src="@drawable/xamarin_white"
        android:background="@drawable/mycircle"
        android:tint="#B4BCBC"/>
</LinearLayout>

XamarinTint2

So Much More

This is just an introduction to Material Design, but there is so much more including animations, notifications, CardView, and RecyclerView just to name a few. Be sure to check out our Android L samples on GitHub and our Android Samples page.

Discuss this post in the Xamarin forums.

IBM Joins Xamarin Evolve 2014

IBM LogoWe’re excited to announce IBM as a Diamond sponsor of Xamarin Evolve 2014. Greg Truty, Distinguished Engineer, Chief Architect SWG Mobile Build & Connect at IBM, will lead two sessions at the conference focused on how to easily build cross-platform native apps on the client-side with Xamarin, powered by the Worklight Server on the backend.

“Connecting Xamarin Apps with IBM Worklight” is a hands on session designed to show you the power of Xamarin and Worklight together. Greg will cover how to connect native Xamarin apps to IBM Worklight Server for easy integration into your enterprise’s environment, and you’ll walk away with the ability to leverage existing resources and infrastructure for mobile, as well as manage cloud-based services directly to the end-user device.

Creating a successful enterprise app that employees actually adopt into their workflow requires much more than just delivering a great UI and UX on the employee’s choice of device. It doesn’t matter how good the app is if employees don’t know about it, can’t easily get it onto their device, or if it fails to keep up with new workflow processes and/or device features that make their lives easier. Greg’s second session, “Keeping Apps Relevant: Deployment, Support, and Management Best Practices for Your Enterprise Mobile Apps,” will teach you best practices for managing the last, but not least, parts of the mobile application lifecycle.

Don’t miss your ticket to native mobile app expertise – register here to join us at Xamarin Evolve 2014 today.

August 25

Salesforce Joins Xamarin Evolve 2014

Salesforce Cloud LogoWe’re happy to announce that Salesforce will be joining the roster of amazing industry-leaders that are sponsoring and speaking at Evolve 2014, October 6-10 in Atlanta, Georgia. Join us there for the mobile development event of the year for cutting-edge enterprise content, networking, and more, including a Salesforce session from Grant Davies, founder and CEO of Bluetube Interactive, a Premier Xamarin Consulting Partner.  Grant is a seasoned Evolve speaker who co-presented the Kimberly-Clark field sales app with Kimberly-Clark at Xamarin Evolve 2013.

Grant’s talk, “The Salesforce1 Platform: The Enterprise Back-End for All Your Mobile Apps,”Grant Davies will focus on building cross-platform apps faster with Xamarin and Salesforce. You’ll learn how to easily connect Xamarin apps to the Salesforce1 Platform, a scalable enterprise back-end for mobile apps with a variety of mobile services that make apps more contextual, user-centric, engaging, secure, and scalable.

Register now to take your mobile apps to the next level with Xamarin and Salesforce at Xamarin Evolve 2014.

August 24

My thoughts on the ALS challenge

Before you read this entry, please be aware that it might rub you the wrong way. (That's okay with me if it's okay with you. I don't expect that everyone will share my perspective.)

There's always the one guy who has to be the party pooper, and I guess it's my turn. Ever since hearing about the ALS challenge I've felt a bit weird about it. With every video I watched I got a bit more upset and I couldn't quite put my finger on the cause.

It seems like a very harmless way to raise money for charity. I don't have a problem with people trying to raise money for charity.

After considerable thought and some discussion with friends I have figured out why this particular challenge rubs me the wrong way. I have a problem with the mechanisms by which it has spread from person to person, in particular that it involves challenging specific people on a public forum by name.

Ultimately there are three reasons why people might participate after being named publicly:

  1. They like being part of something big, especially if it helps people. Your natural team player, they will jump on the challenge simply because they want to be involved in it.
  2. They feel guilty at the thought of not participating. After being called out by someone else, they can't help but join in lest they feel like a grinch. The 24-hour time limit on the challenge serves to exacerbate the guilt and get people to react quickly without taking any time to think about what they are doing.
  3. ALS research is their top priority and is something they genuinely care about.

Some people may fit into all of these groups. I don't really fit into any of them.

I've never been much of a team player to this extent; I mean, I work fine with others and even enjoy it, but I'm not a bandwagon-jumper.

Neither am I one to succumb to social pressure or guilting; I vehemently resist it. (This will be no surprise to those who know me.)

Ultimately, if I donate to a charitable cause it will be because I have given it considerable thought, and because I have considered it in contrast to other charities. It's not that I don't think ALS is a terrible condition, it's just that there are other charities to whom I would prefer to give. If that is truly where you want to give then more power to you.

I don't think someone saying my name in a video is a good decision-making process for deciding when, how much, and to what charitable organization I should give. On the contrary, bandwagon mentality and/or guilt trips are extremely poor reasons to give. I don't believe that most people actually become part of the third group in 24 hours.

Now here is where I'm going to step on some toes (if I haven't already), and while I don't want to, I can't really help how I feel about this. I've been having these thoughts long before I was ever nominated to participate in the challenge, and I was really hoping that nobody would mention me because I didn't want to say these things.

By nominating someone, you are making the following assumptions:

  1. You assume that they have either the money or the water to participate. I have several friends on the west coast who don't have the funds to participate right now, and many parts of the west coast are under a severe drought. They can't spare either of the resources this challenge calls for.
  2. You assume that ALS research is one of their top priorities. Maybe it is and maybe it isn't. Maybe there is something else they have judged more important to them. This isn't a decision for you to make on their behalf.
  3. You assume that they would actually like to participate in the first place.

By nominating someone, this is what you are saying: "I don't know if you have the money or water to participate, but since I've said your name you are now socially obligated to give this certain amount of money to charity, or waste water. You must provide us with proof of either action. If you don't then you will be judged."

If you've done your share of nominating you may be rejecting this interpretation because it's not what you meant. But -- and I cannot stress this enough -- it is exactly what you meant. You just didn't realize it at the time. (Or maybe you did!)

This is a form of social extortion: participate or be judged as a Scrooge.

I do not feel comfortable giving in to this kind of ultimatum, nor do I feel comfortable "calling out" others and putting them in this same position. Frankly, my charitable giving is none of your @#$%^!) business.

My family does and will continue to give to charity -- because I want to, not because a group of people are attempting to guilt me into it.

I cannot participate in this challenge, and I don't feel guilty about it at all. Judge away.

August 22

Favorite Xamarin Studio Feature Contest Winners!

Xamarin’s new $25 per month Indie subscriptions, brings new opportunities to get involved with Xamarin for developers around the world. Our latest contest was an opportunity to get to know more about users favorite Xamarin Studio’s features, and it’s exciting to read the different perspectives from all different types of Xamarin users.

Thank you to everyone who participated! There was one stand-out among the many contestants, and that’s Patrick Sullivan! In his blog, Patrick talks about NuGet Packet Manager, saying that, “the NuGet package manager integration into Xamarin Studio is one of the reasons I really wanted to try it out in the first place.”

Congratulations! You’ve won a 6-Month Xamarin Indie Subscription for iOS and Android.

nuget

Thank you to everyone who participated in the Favorite Xamarin Studio Feature contest! All valid entries will be receiving an exclusive Xamarin swag bag. If you didn’t manage to get an entry submitted this time, no worries; keep an eye on the Xamarin Blog for future contest announcements.

August 21

And the winners are….

The Unity game developer contest sponsored by Microsoft had you busy developing and porting games to Windows the past few months; we received over 600 entries which is more than double what we received last year. We were blown away at how polished and fun the games were, which made judging super tough but we also had a blast! After much deliberation, we have our top three winners and 20 honorable mentions to take a slice of the $100K pie.

We are so proud of our developer community for pulling out all the stops, and we weren’t the only ones impressed, Sonal Pardeshi, Senior Product Marketing Manager at Microsoft said,

“We had some fantastic games submitted to the Unity contest! It was challenging for the Microsoft and Unity teams to narrow down the list to 50 finalists, and even more so to select the 23 winners! Every game was special. Kudos to the top 3 winners and 20 runner ups! The Bridge is an absolutely unique game with beautiful artwork. We loved the highly polished Mini Motor Racing, it plays great on both Windows and Windows Phone. The Veil is an impressive storytelling experience with an original setting that is available first on Windows. We thoroughly enjoyed playing these games and would like to thank all Unity developers who participated in this contest!”

So without further ado, in first place taking home $50,000 is The Bridge by The Quantum Astrophysicists Guild

TheBridgeUnityBanner_940_200_edited

The Bridge is an absolutely stunning 2D puzzle game that will have you re-evaluating your perceptions of up, down and sideways as you rotate the world to solve puzzles. This is an all around fantastic game that we fell in love with.

In second place winning $30,000 is Mini Motor Racing by NextGen Reality Pty Ltd t/a The Binary Mill

Mini Motor Racing Landing page 2 edited

The Windows Store edition of this game is elegant and super fun. It has awesome 4K remastered textures, multiple input on a Surface tablet as well as full Xbox 360 controller support and it also optimizes depending on your device specs. We were impressed with it’s look, gameplay and technical prowess.

And in third place is The Veil by Wayward Productions Ltd taking away $10,000.

The Veil_1920x550-3_edited

We really enjoy the ambience, art style and discovery within this game. The minimalist mechanics are perfect for being immersed in the story and world which makes for a really lovely experience.

This year we also have 20 honorable mentions for developers who went above and beyond by producing innovative, addictive fun games, these lucky developers receive a Unity Pro license:

Slingshot Puzzle by Dream Dale

Splemy by Formerdroid Ltd

Shiny The Firefly by Headup Games GmbH & Co KG

FreudBot by Slash Games

Lost Echo by KickBack

Trolls vs Vikings by Megapop

Tiki Monkeys by MilkCap Limited

TidyUp by CREARTSTUDIO

The Quest: Anniversary Edition by Guerilla Tea Games Ltd

Mini Dogfight by Echoboom S.L.

Shoggoth Rising by dreipol GmbH

Drive Me Bananas by Press Start Studios

Snow Spin by Ezone PTY LTD

Pirate Dawn by Kim Stockton

Simian.Interface by Bullseye Studios

CarX Drift Racing by CarX Technologies

Planet Zoom 3D by Info Tech Studio srl

Medieval Apocalypse by Obumo Games/Zoltán Gubics

Kings Can Fly by Firedroid

Beyond Gavity by Qwiboo Ltd

 

[Video] Xamarin Designer for iOS in Visual Studio

Here’s a recording of the recent video I did for the Microsoft Flashcast series showing how to use the Xamarin Designer for iOS in Visual Studio:



Be sure to check out my colleague James’ Flashcast on Xamarin.Forms on August 27th.


August 20

Three Tricks in Xamarin Studio

I wanted to share three tricks that I use a lot in Xamarin Studio/MonoDevelop.

Trick 1: Navigate APIs

Xamarin Studio's code completion for members of an object defaults to showing all the members sorted by name.

But if you press Control-space, it toggles the rendering and organizes the results. For example, for this object of type UIWindow, it first lists the methods available for UIWindow sorted by name, and then the cluster for its base class UIView:

This is what happens if you scroll to the end of the UIWindow members:

Trick 2: Universal Search

Use the Command-. shortcut to activate the universal search, once you do this and start typing it will find matches for both members and types in your solution, as well as IDE commands and the option to perform a full text search:

Trick 3: Dynamic Abbreviation Completion

This is a feature that we took from Emacs's Dynamic Abbrevs.

If you type Control-/ when you type some text, the editor will try to complete the text you are typing based on strings found in your project that start with the same prefix.

Hit control-/ repeatedly to cycle over possible completions.

Five Cross Platform Pillars

The last couple of years have been good to C# and .NET, in particular in the mobile space.

While we started just with a runtime and some basic bindings to Android and iOS back in 2009, we have now grown to provide a comprehensive development stack: from the runtime, to complete access to native APIs, to designers and IDEs and to a process to continuously deliver polish to our users.

Our solution is based on a blend of C# and .NET as well as bindings to the native platform, giving users a spectrum of tools they can use to easily target multiple platforms without sacrificing quality or performance.

As the industry matured, our users found themselves solving the same kinds of problems over and over. In particular, many problems related to targeting multiple platforms at once (Android, iOS, Mac, WinPhone, WinRT and Windows).

By the end of last year we had identified five areas where we could provide solutions for our users. We could deliver a common framework for developers, and our users could focus on the problem they are trying to solve.

These are the five themes that we identified.

  • Cross-platform UI programming.
  • 2D gaming/retained graphics.
  • 2D direct rendering graphics.
  • Offline storage, ideally using SQLite.
  • Data synchronization.

Almost a year later, we have now delivered four out of the five pillars.

Each one of those pillars is delivered as a NuGet package for all of the target platforms. Additionally, they are Portable Class Libraries, which allows developers to create their own Portable Class Libraries on top of these frameworks.

Cross Platform UI programming

With Xamarin 3.0 we introduced Xamarin.Forms, which is a cross-platform UI toolkit that allows developers to use a single API to target Android, iOS and WinPhone.

Added bonus: you can host Xamarin.Forms inside an existing native Android, iOS or WinPhone app, or you can extend a Xamarin.Forms app with native Android, iOS or WinPhone APIs.

So you do not have to take sides on the debate over 100% native vs 100% cross-platform.

Many developers also want to use HTML and Javascript for parts of their application, but they do not want to do everything manually. So we also launched support for the Razor view engine in our products.

2D Gaming/Retained Graphics

Gaming and 2D visualizations are an important part of applications that are being built on mobile platforms.

We productized the Cocos2D API for C#. While it is a great library for building 2D games -and many developers build their entire experiences entirely with this API- we have also extended it to allow developers to spice up an existing native application.

We launched it this month: CocosSharp.

Offline Storage

While originally our goal was to bring Mono's System.Data across multiple platforms (and we might still bring this as well), Microsoft released a cross-platform SQLite binding with the same requirements that we had: NuGet and PCL.

While Microsoft was focused on the Windows platforms, they open sourced the effort, and we contributed the Android and iOS ports.

This is what powers Azure's offline/sync APIs for C#.

In the meantime, there are a couple of other efforts that have also gained traction: Eric Sink's SQLite.Raw and Frank Krueger's sqlite-net which provides a higher-level ORM interface.

All three SQLite libraries provide NuGet/PCL interfaces.

Data Synchronization

There is no question that developers love Couchbase. A lightweight NoSQL database that supports data synchronization via Sync gateways and Couchbase servers.

While Couchbase used to offer native Android and iOS APIs and you could use those, the APIs were different, since each API was modeled/designed for each platform.

Instead of writing an abstraction to isolate those APIs (which would have been just too hard), we decided to port the Java implementation entirely to C#.

The result is Couchbase Lite for .NET. We co-announced this development with Couchbase back in May.

Since we did the initial work to bootstrap the effort, Couchbase has taken over the maintenance and future development duties of the library and they are now keeping it up-to-date.

While this is not yet a PCL/NuGet, work is in progress to make this happen.

Work in Progress: 2D Direct Rendering

Developers want to have access to a rich API to draw. Sometimes used to build custom controls, sometimes used to draw charts or to build entire applications based on 2D rendered API.

We are working on bringing the System.Drawing API to all of the mobile platforms. We have completed an implementation of System.Drawing for iOS using CoreGraphics, and we are now working on both an Android and WinPhone implementations.

Once we complete this work, you can expect System.Drawing to be available across the board as a NuGet/PCL library.

If you can not wait, you can get your hands today on the Mac/iOS version from Mono's repository.

Next Steps

We are now working with our users to improve these APIs. But we wont stop at the API work, we are also adding IDE support to both Xamarin Studio and Visual Studio.

Unity 4.5 for Samsung Smart TV

Take your games to Samsung Smart TV

Hooray! Today, we’re pleased to announce the public preview of Unity 4.5 for Samsung Smart TV, adding another platform to Unity’s already extensive multiplatform capabilities. Unity for Samsung Smart TV is completely free for all Unity developers!

Start now, it’s free

The Unity for Samsung Smart TV public preview is available right now as a separate 4.5 editor installation. It will ship officially with Unity 5.0, and will be free for everyone to use. If you already own Unity Pro, you get all the Unity Pro features for Samsung Smart TV with no need for an additional license. It’s also available and completely free for users of the free version of Unity!

Easy porting and development

Adapting your game for Samsung Smart TV is much like porting your game to any other platform with Unity. If your game already runs on mobile devices you’re halfway there! The hardware in the TV is very similar to a mid-range mobile device, so you can expect similar performance metrics.

All the input devices

Samsung Smart TVs come with a range of different input mechanisms for your gamers to enjoy, and we’ve provided the full complement of input modes that make handling dpads, joysticks, wired and wireless game pads and mouse pointers really easy. Each remote model maps to these modes in an intuitive way, and your game can switch between the modes as needed to get the best experience for the user. You can even make a mobile controller app!

Super-fast setup

Getting your game from Unity to Samsung Smart TV is simple – just one click after initial setup and you’re done – no dev kit needed! We’ve developed an application called Unity Launcher for Smart TV. Install it on your TV via the Samsung App Hub, and, once it is running, Unity can deploy your game to the TV just like that so you can spend more time on making a great game.

Why port my game to Samsung Smart TV?

Smart TVs are becoming more powerful and more prevalent in the living rooms of families worldwide. With more than 20 million devices sold globally, this is an opportunity for you to reach millions of new customers! Samsung expects the Smart TV game market to continue to grow dramatically year on year, and you will be able to monetize your games via an in-app purchase plugin provided by Samsung.

Great Unity Games already available on Samsung Smart TV

During the beta period, several developers tested the platform by porting their games. Here are some Unity games that you can play on your Samsung Smart TV today:

Abyss Attack

edited abyss

CapsuleHunter by Wicket Studio

CapsuleHunter01 edited

 

CandyCoaster by Nfun

ScreenShot Image 1

  

Tales Runner by RHAON ENT

screen shot_image_4


What our developers are saying

“Bringing Abyss Attack to Samsung TV was a very easy process. We worked closely with our publishing partner, Chillingo to ensure that players received a phenomenal gaming experience from mobile to a larger screen. The Unity team also did an amazing job at answering any questions along the way. We can’t wait to introduce Abyss Attack to newer audiences.”

–Cristian Tota (Abyss Attack, deepbytestudios.com)

What hardware do you need?

Any of the Smart TV models listed below.

panel 2014 lineup
UHD HU9000
HU8500
HU7000
FHD H8000
H7000
H6400

 

panel 2013 lineup
UHD F9000
FHD F8000
F7500
F7000
F6400

 

Get started now

Download Unity for Samsung Smart TV here: http://forum.unity3d.com/forums/samsung-smart-tv.66/

Help is at hand

For app registration visit the Seller Office: http://seller.samsungapps.com/

For SDK information and Q&A for developers visit the Samsung Developer Forum   (http://www.samsungdforum.com/)

For Samsung Smart TV questions, please email: sdfadmin@samsung.com

For Unity-related questions, please post to the forum here: http://forum.unity3d.com/forums/samsung-smart-tv.66/

More Open-Source Initiatives from Unity

Our community is full of users who rely on Unity — whether it be for work, for play, or both. Knowing that, we’ve been thinking about new ways we can engage our community and provide a better user experience. One of the initiatives we’ve decided on is to start sharing the source for selected components of Unity. With access to the source for components (or tools related to Unity), we hope to:

  • Reduce risk by giving you control of things that are commonly used
  • Increase the flexibility and applicability of components by giving you the power to customize them
  • Enable you to extend Unity in ways that were previously just not possible

To do this, we’re going to start hosting components’ source over at our home on BitBucket. We’ve also prepared a Guide for Contributors that is now part of our user manual.

What exactly will you open the source to?gui-screen-shot-clothified

We’re starting this project by making the recently-updated source to the Unity Test Tools available on BitBucket in a repository ready for you to fork, modify, and even open pull requests with contributions if you wish.

The next component we plan to give you the source to (unless we get something else ready before then!) is the long-awaited new UI system. We’re convinced you’ll do awesome things with the source once you get it in your hands.

Beyond that, we don’t have a concrete plan, but we have a lot of things in the pipeline. These components (like the new UI system) will all be isolated from Unity in such a way that you can modify them and use your own modified version with the official public Unity release.

mit-license-smallWhat license is the source released under?

We are using MIT/X11 as our standard license. We’ve never been a fan of a revenue sharing model, and we have a similar opinion about the license for our open-source components; we didn’t want to burden you with licenses that restrict what you can do with the source code.

Because we’re releasing our source under an MIT/X11 license, we’re also expecting contributions we accept from the community to be contributed under an MIT/X11 license.

Do I need Unity Pro?

Nope! The source is available to everyone, regardless of what Unity license you have.

Unity’s History with Open-Source

Unity has been participating in other open-source projects for quite some time. Our scripting engine is based on Mono and we keep our fork of Mono open on GitHub, as well as our open-source shader cross-compilation tools (hlsl2glslfork and glsl-optimizer). We also use a lot of open-source tools internally: our build/test automation server and lives on BitBucket, as do custom extensions to Mercurial, the version control system we use. Unity Technologies employs several developers to contribute to the open-source projects that we we use (check out a list of our contributions to the Mercurial project as an example).

A new era? We hope so!

Although Unity Technologies has been active in the open-source community for quite some time, this is the first time we’ll be opening the source to components of Unity itself. We’re excited to see what you do with it.

Amazon Joins Xamarin Evolve 2014

We’re excited to welcome Amazon as the first Gold Sponsor of Xamarin Evolve 2014, the must-attend event for mobile developers October 6-10 in Atlanta, Georgia. Amazon joins a growing list of industry-leading sponsors bringing great technical content, connections, and hacking opportunities to the event.

Amazon Logo

The conference line-up now includes two new technical sessions delivered by Amazon speakers David Isbitski and Tara Walker, covering Amazon Fire and Amazon Web Services.

Amazon Web Services LogoIn the “Mobile Ecosystem” track, Tara Walker, will show you how to build great mobile apps that leverage AWS Cloud services bringing identity management and data sync (Amazon Cognito), push notifications (Amazon SNS Mobile Push), cloud storage (Amazon S3), and a fully-managed NoSQL database (Amazon DynamoDB) to your mobile apps. Tara will take you on a step-by-step journey so you can see how to configure and add AWS services to your apps, and then integrate them into your backend architecture.

Amazon Fire PhoneIn the “Emerging Devices” track, David Isbitski, Worldwide Developer Evangelist for Amazon, will show you how to build native Amazon Fire Phone, Fire TV, and Kindle Fire Apps with Xamarin. This session will include both a walk-through of how to quickly use Xamarin to run your apps and games on Amazon devices, as well as an overview of how to get started and get noticed in the Amazon Appstore.

Register now to get your ticket to mobile expertise with Amazon Web Services and the Amazon Fire line of devices at Xamarin Evolve 2014!

August 19

Major Xamarin.Mac Updates

We are happy to announce a few major updates to Xamarin.Mac. The first major update is the result of more than a year of development on our API bindings and Mono’s runtime which brings the following features to Xamarin.Mac:

  • 64-bit support
  • New 64-bit Frameworks
  • Support for lighter mobile profile
  • Easier code sharing between Mac and iOS

These features are available today in the Beta channel.

Yosemite OS X Logo On top of these new features we have been hard at work binding the new Mac OS X Yosemite APIs. We are pleased to announce support for Yosemite is now available. Since Yosemite is still an unreleased platform and may continue to change you will find these APIs in the Alpha channel along with all of the other features I mentioned earlier.

64-bit support & Easier Code Sharing

We recently announced the brand new Unified API for Xamarin.iOS and Xamarin.Mac. The Unified API allows developers to support both 32 bit and 64 bit applications with the same source code (as well as binaries) on both Mac and iOS.

In addition to this we also took the time to enhance the code sharing story between iOS and Mac. An example of this is that you no longer are required to add any namespace prefixes. This means code that looked like this:

#if MAC
using MonoMac.Foundation;
#elif IOS
using MonoTouch.Foundation;
#endif

Can now simply be written in one line:

using Foundation;

For more information, read our new Guides for Cross Platform Mac and iOS code.

New 64-bit Frameworks

With the introduction of our Unified API we are finally able to support all of those 64 bit-only frameworks that Apple has introduced in the last few years, including but certainly not limited to the many new 64 bit-only frameworks in Yosemite.
What's new in scene kit

Shadows in Scene Kit

Lightweight Profile

Also with the Unified API comes the ability for users to adopt Xamarin’s Mobile profile. The Mobile profile is the same API profile that we use on Android and iOS which has been designed to be linkable and have a much smaller footprint on disk than the regular desktop edition. This is convenient for applications going into the AppStore or that wish to share more code across Android and iOS.

Samples!

Many of our Mac samples are being ported to the Unified API and currently live in their own branch. In addition, we are starting to publish our internal ports of the Yosemite samples which can be found in the Yosemite directory.

Unified API with 64-bit Support for iOS and Mac

Today we are pleased to share some major improvements to the APIs for our iOS and Mac products.

ios and osx logos

Why a new API?

The Classic Xamarin.iOS and Xamarin.Mac APIs had two major flaws:

  1. They did not support 64 bit applications.
  2. They made iOS and Mac code sharing cumbersome.

As Mac OS X evolved, more and more frameworks became available only as 64 bit frameworks. Additionally, iOS recently made the 64-bit jump when the iPhone 5s was launched.

Last year we started a redesign for our 64-bit support, one that would meet the following goals:

  1. The same source code must work on both 32 and 64-bit platforms
  2. Libraries and binaries would run either in 32 or 64 bit modes, depending on the host platform and build settings, with no source code changes or recompilation required
  3. Improved code sharing story between our Mac and iOS products.

Enter The Unified API

The result of more than a year of development on our API bindings and Mono’s runtime is our Unified API, which we are introducing today as a preview feature. The Unified API accomplishes everything we set out to and so much more.

First, we addressed the 32/64 bit split, by surfacing an API that is 32/64 bit agnostic.

Second, we dropped the namespace prefixes. This makes sharing code between iOS and Mac apps less tedious to maintain and easier on the eyes. An example to demonstrate this is what you had to do before when you had to use a using:

#if MAC
MonoMac.Foundation;
#elif IOS
MonoTouch.Foundation;
#endif

With the Unified API you can simply use:

Foundation;

64bitThis means with the new Unified API we have not only made it easier to share common code across your iOS and Mac applications, but you are now able to take advantage of all of the new 64-bit APIs on each platform.

Get Started & Backwards Compatibility

The new Unified API is available now in the Beta channel. We made the new Unified API opt-in, which means there is no need to upgrade to this new API unless you want to take advantage of the features outlined above. Xamarin will continue to support the Classic API you are familiar with for both Mac and iOS alongside the Unified API indefinitely.

We have ported all of our Mac samples and our iOS samples to the new API so you can see what is involved. They are both maintained on a branch that for historical reasons is called “magic-types”.

We are currently working on both templates to get you started (or you can migrate on your own), as well as a migration assistant that will do the bulk of the port for you.

What is Missing?

We are aware that the following features are currently missing and we are working on them:

  • Binding Project Types, to easily call into native libraries
  • Complete templates for all the scenarios previously supported
  • Xamarin’s Components are not available yet

August 18

buckd

BuckGraffiti

One of the things I’ve been working on since joining Facebook is Buck, an open source Android & Java build tool which is significantly faster than many other Java build tools for a number of reasons.

As well as being fast, Buck gains a lot of power and flexibility by using Python to generate build rules. Once projects become very large, however, this can become a problem as Buck has to execute thousands of python scripts to build its dependency graph before it can start its parallel build process. When I started working on Buck this parse phase could last tens of seconds. Buck was already much faster than Ant, but test driven development could be painful.

Our initial work focussed on making the parsing step faster and after some experimentation with Jython we discovered that bigger improvements could be made by running a long lived Python process which could be handed build files to execute as required.

As is often the case, the bulk of the improvements could be made by caching. Build files change far less often than source files, so caching the build file output avoids the need to spend a lot of time parsing in the common case when only a small number of source files change. After spending some time looking at serialising the build file output to disk it became clear that a more effective approach would be to cache the output in memory by running Buck as a long lived server process using Nailgun.

Nailgun is a client, protocol, and server for running Java programs without incurring the JVM startup overhead. Nailgun makes converting Java applications to client-server architectures as simple as passing the name of the class containing your Main method to the nailgun Server and client application. Early experiments running Buck with Nailgun showed a lot of promise, allowing us to reduce parse time to close to zero, but running buck as a server invalidated several assumptions that required a non-trivial amount of work to fix.

The environment had to be threaded through from the client and calls to System.getenv() replaced, System.exit() could no longer be used for garbage collection, so resource lifetimes had to be managed with try-with-resources blocks and Nailgun needed to be extended to detect client disconnections which could be thrown as InterruptedExceptions to ensure that killing the Nailgun client cancelled builds as expected. It’s also worth noting that for large, long running applications like Buck the JVM started overhead saved by Nailgun is not significant, but the time saved by the long running process being able to maintain a JIT cache of Java class files is.

With Buck running as a long running server process the next step was to make it correctly invalidate cached build rules when build files changed. In order to avoid building outputs each time a file is touched, buck hashes the contents of input files to see if they have actually changed. While this saves a lot of time when switching between similar source control branches it requires reading each input file each time a build is run: something which was adding several seconds to the per-build overhead that we were trying to reduce.

To avoid this overhead we switched to a composite approach which watches the file system for changes and then checks the hashes of the contents of changed files. In the case where a few files are edited only a few hashes are generated and compared, in the case where source control systems touch many files without changing their contents comparing hashes avoids unnecessary rebuilding.

Initially we used the standard Java WatchService to generate file change events, but found that in practice the latency between changing a file and the FileWatcher generating events was far too high. Luckily wez, sid0 and friends had built Watchman which provides very low latency file change events and an easy to use JSON based interface which only took a day to wire in to Buck. Watchman is an amazing piece of technology, but requires some tweaking of OS settings to work well, so if you notice Buck taking a long time to parse project files you may need to check the system specific preparation.

When combined with exopackage and a number of other optimisations, the benefits of the Buck daemon are significant. Trivial builds now take a small fraction of the time they used to and in some cases it’s possible to incrementally build and install of an app in less time than it takes some build systems to do a no-op build.

I’ve had a great time working with the amazingly talented Buck team and I’m very happy to see buckd improving build times within Facebook and beyond.

Now it’s time to go back to writing a test, watching it fail and making it pass: with a lot less waiting around.

August 15

TlsException on Mono

For reference, if you’re using Mono and trying to use HttpWebRequest and friends to make a connection with a client certificate and you get an exception, it’s because you don’t have any trusted root certificates in the Mono certificate store (even if you are bypassing server certificate validation using the old trick of having a Validation handler returning true). You can fix this by doing

./mozroots --import --machine --sync

This will download synchronize the trusted root certificates from the Mozilla LXR web site into Mono’s machine trust store in an automated way. man mozroots for other options.

Exception that you’re likely to get if you don’t have a machine trust store:

Unhandled Exception:
System.Net.WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a

at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.RemoteValidation (Mono.Security.Protocol.Tls.ClientContext context, AlertDescription description) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsSsl3 () [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---

at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---

at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at EntryPoint.Main () [0x00000] in <filename unknown>:0

August 14

Building and Maintaining Value for Developers

It’s hard to believe, but there’s less than a week left until Unite! We’re very excited to meet so many of you, and we’ll have more developers there than ever before to answer your questions. We have a number of announcements lined up for Unite, and a schedule packed with valuable information, but we’d like to share a few things with you in advance.

The past decade has seen an incredible transformation of Unity from a tool nobody knew about to the most popular way to create games for well over a dozen platforms, by developers in more than 100 countries, working with Unity for millions of hours each month. That’s so crazy amazing!

We got here by listening to our community, and we continue to do so.

One of the things our community has been wanting is an upgrade to our rendering quality. We have been working hard to build something to meet those needs, and lately we have been showing the graphical power of Unity 5, which raises the quality bar out-of-the-box across all supported platforms. This will empower many of you to bring your creative vision to life in new and interesting ways.

We also heard from you that the quality of our engine is equally important. Our sustained engineering initiative means that everybody gets a chance to download the newest patch release every week. We’re squashing bugs fast and we’re expanding our efforts to make this process even faster and more efficient. We’re not stopping there though, and we have a number of initiatives we’ll be rolling out in the coming months that will help further lower development risk while increasing the flexibility of Unity in your development pipeline. Stay tuned!

We also know that once your game is done you need to build an audience that believes in your business and your games. That is why we’re working hard to integrate the services of several recently acquired companies. For example, with services like Unity Ads and Everyplay we can help you attract the right players to your game and keep them playing, which increases your ability to succeed in a crowded market.

WebGL in Unity 5

Unity has been, and will continue to be, the leader at helping you reach your customers on whatever platform they’re on. We heard that many of you are interested in WebGL, but are unsure of what the WebGL market will become and whether it warrants an additional investment. So we have decided that with Unity 5.0 we’ll make the WebGL deployment option add-on available to both free users and Unity Pro customers without cost. You’ll be able to easily make games that run without plugins for the growing number of WebGL capable browsers.

Together with Windows, Mac, Linux, Web Player, iOS, Android, BlackBerry 10, Windows Phone 8, Windows Runtime, Wii U, Xbox One and PlayStation Mobile for Vita, that brings the number of platforms open to your game for free to 13. Nobody else has native support for so many platforms at no cost to you.

Value and pricing

In the past few months there have been active discussions about our value proposition in the forums and whether it was time for another change to our offering. We spent the past few months talking to many of you around the world about Unity and the value proposition we offer, and we discovered the overwhelming majority felt that we were providing excellent value across the board. In fact, many of you expressed concern over a race-to-the-bottom business model for tools that your livelihoods depend upon. And you also raised a strong voice against a royalty-based business model. In our many years as a startup, we’ve always re-invested our money back into our product. We believe that you should be able to do whatever you want with your money too.

We believe the business model and pricing we have now is one that will continue to provide us with the resources we need to ensure Unity is the most reliable and delightful way to build games for the majority of developers. Nothing remains static though, and we may revisit our business model and pricing at some point in the future.

We’re really looking forward to meeting so many of you and sharing so much more at Unite! If you can’t make it in person, you can still join us for the keynote, which will be live streaming on Wednesday, August 20 at 9 am PDT.

Android L Developer Preview & Android Wear Support

Today we have published support for Google’s Android L Developer Preview in the Alpha channel. Additionally, we are introducing preliminary support for new SDKs that Google has released, including Android Wear, Android TV, and brand new Support Libraries.Android Robot

Installing our Android L Preview

  • With this release, a Java JDK 1.7 is now required to properly compile applications. You can download one for your system from Oracle website.
  • Update your Android SDK Tools to 23.0.2 from the Android SDK Manager
  • Install Android SDK Platform & Build-tools to 20

Android SDKTools

  • Download the Android L and Android 4.4W SDKs

Android L Preview SDK Download

Android Wear

Android WearWhen Google announced their new wearable platform, Android Wear, last March, they only made a new library for enhancing existing notifications available.

At Google I/O, an official developer SDK to create full-featured applications capable of running on an Android Wear device was unveiled. With this release, Xamarin developers will now enjoy the same ability.

We are also making available the Android Wear UI Library preview on NuGet to include in your wearable apps. Our Android Support Library v4 was also updated to include many of the new Android Wear interaction APIs, such as NotificationCompat and RemoteInput.

Android Support Libraries

Not only did the Android L Preview come in with a new series of core APIs, it also brought a large update to the Android Support Libraries set.

Along with Android Support Library v4 updates, additional Support Libraries are now in preview release, including great new features such as RecyclerView, CardView, Palette, Android TV Leanback, and update to Support Library v13. All of these libraries are now available straight from NuGet.

IDE Improvements

We have also added some new features to help you design for those new platforms to our Android designer for both Xamarin Studio and Visual Studio. You’ll find Wear device support, Material theme selection, and Action Bar previewing, among others, starting today.

Android Wear Designer support

See the Xamarin Studio release notes for more information and known caveats.

Getting Started

You should have the new APIs available now. Check our release notes for more details and a detailed list of the new APIs.

Tom Hanks’ Vintage-Typewriter Inspired Hanx Writer App

The Hanx Writer app, built with Xamarin, was released today after several months of work. I had the great pleasure to get the scoop on what it took to build this nostalgia-inducing app from a very cool developer at Xamarin Premier Consulting Partner, Hitcents.
HanxWriterKeyboardCropped

Jonathan Peppers is a Xamarin MVP, Senior C# Developer and App Specialist at Hitcents, and will be speaking about in-app purchases, piracy protection, localization, culturalization, and more in his, “If You Can Ship Your app in China, You Can Ship it Anywhere,” talk at Xamarin Evolve this October. Here are some questions from my Q&A session with Jonathan:

Can you please describe the app and how you got the idea?

Jonathan Peppers

The app is called “Hanx Writer.” That’s Hanx, with an “X”, but sounds like Hanks as in Tom Hanks. An agency that represents a lot of celebrities contacted Hitcents on behalf of Tom Hanks, who has an interest in collecting vintage typewriters, but also regularly uses an iPad. He wanted an app that made him feel like he was using a typewriter; he wanted that nostalgic feeling, but to still have the app function as a word processor to send emails, write letters, that sort of thing. So, we built an app that feels, looks, and sounds like a real typewriter for iOS.

How long did it take you to develop it?

It’s been about 5 months. But a lot of that time was refining and I was not working full time on this. My younger brother, Nick Peppers, also worked on the app. He did the iOS layouts and some of the UI stuff. There were 2 of us that committed code, and we also have a designer, Adam Diestelkamp, to do the cool graphics and a 3D artist, Matt Lester, do some of the 3D Models.

Tom Hanks basically said, “I want an app like this,” and you wrote it?

Yes, basically. He really just had the concept for the app, but our team took the idea and had to figure out how to translate the typewriter onto a flat screen. What things do we make like a real typewriter? What things do we make like a word processor? People are used to doing a copy and paste, so we didn’t want to get in the way of that. People know how to use word processing, but we still want to provide that cool vintage feel.

HanxWriterManageDocuments
Do you see going to other platforms besides iOS?

That was one of the reasons we chose Xamarin. We now have the option to share code with other platforms, so we’ll look at iPhone next and see if it makes sense there, and Android after that.

What API’s are you using?

We used iOS TextKit for entering text and saving. You can also go beyond the end of the page, and you can copy and paste and it splices it by page automatically and word wraps. There is a lot of text processing work going on in this app.

There are many items in the app that move around, the page flips in and out, and the keys dip when pressed. The keys need to look just like a real typewriter key when pressed down, for example. I use a lot of CoreAnimation for these effects.

I also used NSKeyedArchiver to save and read rich text.

Did you use Shared Project or Portable Class Library (PCL)? Why?
HanxWriterWirelessKeyboard
Parts of the app are in a PCL. We are using MVVM so all of our View Model classes are in a PCL. The app does have a lot of native iOS API calls, so these are not in the PCL. I prefer PCL over Shared Projects. I just get a better feeling passing around the same DLL that I know always works. I feel #IF can easily be abused with a developer using it too freely.

Anything else you want to tell us about your app and the experience?

It was definitely a cool app to work on. In the beginning, we tried to get a solid concept. All we knew is we were trying to make a typewriter. We really re-iterated and prototyped and added some different concepts along the way. It was fun to work on and I think it was a great choice to use Xamarin because we were able to complete development quicker.

To learn more about Hanx Writer, join @TomHanks for a live Twitter Q&A online this morning:

And to learn more about building apps with Xamarin, come see Jonathan Peppers present at Xamarin Evolve 2014.

August 13

Are We Spellbound By Games – Asking Questions About Habit Forming Design

The Greatest Magic Trick

Once upon a time we all thought how charming it was when games had that elusive ‘addictive’ quality which delighted players. But now the term addiction has become an accusation labeled at apparently unscrupulous FreeToPlay designers who are leveraging the psychology of Operant Conditioning to allegedly extort money from players.

Games that delight us often have the magical effect of become habit forming but how as designers can we judge the balance between a game as a social good and the manipulation of an audience.

I’m not a psychologist!! I’m a marketer who has been closely involved with running games services for the last over 16 years. That being said I’m first and foremost a games fan. That means I put the enjoyment of games first but I am also deeply interested in both the application of psychology for both playing and paying. I’ve read a lot round the subject but have also have had some fantastic help from Cyberpsychologist Berni Good (but please note that any mistakes here are my own!). I gave a webinar on this topic recently, and, if you want to hear more, you’ll find a link to a recording of the session at the bottom of the page.

Design is a seductive art which is about enticing players in to your world and making them feel safe and special. This is about creating anticipation and desire for more. Key to seduction is our ability to correctly set expectations. Just as using a fake photo on an internet dating site (I’m too old/married to know personally) can damage the first date; giving misinformation to players is a fast way to get deleted. Similarly a lack of attention to the needs of new players (such as a sucky tutorial) will be an instant put off… just like abandoning your potential new partner to go talk to someone else on your first date.

But if we want our relationships to last we can’t take out players (or partners) for granted. We have to sustain that interest over the long term. We want, no NEED, our games to become habitual don’t we?

Games have always been compelling 

Games allow us to demonstrate our own competence, be faced with genuine (albeit constrained) challenges and to escape (ideally) within a social context. These qualities are alluring and done right create something which has an intrinsic reward. That matters when we think about habit forming. BJ Fogg talks about habit forming behaviour as needing motivation, ability and a trigger. Games create compelling experiences, offer challenges which we see as achievable and contain calls to action as well as instant feedback. These seem to have the qualities needed to drive habit-forming behaviour.

The argument has been that a lot of  F2P games have attempted to use habit-forming techniques to create unscrupulous designs, often relying on extrinsic rewards to reinforce player behaviour to encourage spending rather than to deliver better  inherent value for players.

However, is that actually true? And does this mean that there is an inherent flaw specific to F2P design? Game design relies on creating rule systems and patterns which, to a greater or lesser extent, railroad users to perform specific patterns of activity. The best magic trick is when we make a level or player decision feel like it was their own choice; even where it was the only real choice available. Games do this by using audio/visual/gameplay or narrative clues to trigger reaction; usually by providing instant positive feedback when the player behaves the way we want them to.

Arguably that’s a form of manipulation

Assuming you accept that manipulation is an intrinsic part of game design then we have to ask whether manipulation is inherently wrong or whether it just becomes wrong when this involves money. Is it even essentially wrong to encourage/convince people to spend money in a game? Where do we draw the ethical line?

Terms like manipulation don’t help us as their use is too broad and we end up in meaningless discussions about semantics.

Games have often been the target of moral outrage, but I fear that, as an industry, we may be contributing to our own panic, either because of an aversion to the commercialisation of games, or through a lack of focus on delivering entertainment over revenue. It seems to me entirely reasonable that we should be able to make games people are willing to pay for as long as the business model offers value and is based on informed consent.

What is Real Addiction or Conditioning?

The two principle accusations levelled at games seem to me to focus on addiction and the use of Skinner-Box-Style operant conditioning?

Addiction a very serious issue that is harder to define than you might think. However, it shouldn’t be defined as  just a habit gone bad.  According to Harvard Mental Health Letter there needs to be a genuine compulsion which overwhelms the individual’s otherwise rational behaviour. This can be driven by a physiological need where the body has a chemical dependency which causes us to crave the addictive substance. Alternatively, it can be behavioural where an unhealthy pattern of specific and inappropriate activity becomes overwhelming. Both lead to harm to the individual concerned.

Interestingly, behavioural addiction is not included in the Diagnostic and Statistical Manual of Mental Disorders because “…there is insufficient peer-reviewed evidence to establish the diagnostic criteria and course descriptions needed to identify these behaviours as mental disorders.” It has however been described as an area for further study which demonstrates the need for further research and for us to remain cautious about jumping to conclusions either way.

In The Power of Habit, Charles Duhigg, describes a series of MRI Scans conducted as part of a legal case against a casino. The scans showed that to pathological gamblers near misses looked like wins. Their brains reacted almost the same way. On the other hand, when non-problem gamblers experienced a near miss, they received a dose of apprehension that triggered a different response, “quit before it gets worse”.

Games, if we are to believe Rafe Koster’s Theory of Fun, use pattern matching to generate stimulus. Over time and given repeated success the pleasure reward diminishes as we become increasingly familiar with the patterns. Eventually we get bored with the game and move on. However as Neurologist Judy Willis described in Psychology Today “The motivation to persevere and pursue greater challenge at the next level is the brain seeking another surge of dopamine — the fuel of intrinsic reinforcement.” That does sound like something we encourage in game design.

Just A Skinner Box

In a series of experiments on Rats and pigeons, BF Skinner found using his eponymous box that an animals behaviour could be affected by adjusting their expected rewards; such as releasing food by pressing a button. By creating an escalating or random variation in the frequency of the release of that food you can even can cause them to press that button compulsively. The topic is too complex to cover in detail here and there are unanswered questions too, however it seems that a schedule of reinforcement (repeated actions with a predictable payout) plus unpredictable timing to that reward can be highly compelling.

Is that what’s happening in games? And is it unique to F2P?

The good news is that playing games a lot may not in itself be problematic for all gamers, whereas with addiction it is always detrimental for the addict (Gentile, 2009;Kuss & Griffiths, 2012): ‘‘Healthy excessive enthusiasms add to life, whereas addictions take away from it’’ (Griffiths & Meredith, 2009,p. 247).

A number of experiments have shown that humans show the same patterns of response that other animals show when exposed to the basic schedules of reinforcement; so Operant Conditioning does seem to work. However, in a game (unlike a Skinner Box), we don’t control all the factors and aren’t the only source of stimulus. In practice it’s rare that any game will have the capacity to exert much direct influence over players; the vast majority of people are just too savvy.

Even if we could really deliver the kind of influence that might affect players’ behaviour, conditioning also seems to require effort if it is to be sustained. There comes a point where that effort becomes greater than the reward. When we vary the rate of stimulus (e.g. the interval or ratio of activity needed to trigger a reward), the investment required to achieve the payoff will eventually exceed its value (eventually leading to the cessation of that behaviour). We learn from experience as an ongoing adaptive process. When conditions change, we learn new behaviours and eliminate old ones. Habits can, of course, be very hard to break – but they can also be very hard to form as (going back to BJ Fogg) they need a sustained Motivation, Action and Trigger.

It seems to me that conditioning in games is plausible; but largely impractical, not least because people are just too savvy.

Is it an Question of Ethics?

Of course being difficult doesn’t mean impossible.  But is there an opportunity? is this even an ethical question at all?

One of the biggest holes in the question of manipulation is that most (mindful) people will quickly notice any obvious attempts at manipulation. Despite this there are of course vulnerable people including children or adults with a susceptibility who might fall into the tricks of less ethical designers. There are systems in place to protect minors, legally and from a platform perspective – however this is not just a question of enforcement.  Our brand is on the line if we sully it with unethical designs which destroy trust and credibility. The anger people feel about being manipulated isn’t just about the individual concerned – they tell everyone they can. That kills any business.

Trust is what helps keep people engaged – not manipulation! It’s not just unethical to seek to form habitual behaviour in games but it is also largely counterproductive.

To be ethical our intent has to be appropriate, reasonable, and clearly communicated. Players need to have informed consent. But, for me, this isn’t just a question of ethics.

Commercially we are better off making better games. Designing game play that factors in engagement is the very best way to ensure a healthy environment that encourages players to come back to your game. Giving feedback at the right time will helps since intrinsic positive reinforcement is massively important in terms of desire to play. That feeling of mastering something and of an escape from our everyday world are more important than mechanical operant conditioning because they leave the player with a feeling that they “…cannot wait to play again”. This taps into the very essence of what it means for people to play games, rather than the work of responding to a schedule of reinforcement.

We have a lot to learn from the underlying principles behind habit forming behaviour especially from people like BJ Fogg and BF Skinner; but the value is in trying to understand players so that we can make them better games; not just to make more money.

Special thanks to Berni Good for her input and advice (any mistakes here are of course my own!)

___

Oscar Clark is a Consultant and Evangelist for Everyplay, the free SDK from Unity that records and shares your favourite moments of play. Find out more at https://developers.everyplay.com. He is also author of “Games As A Service: How Free To Play Design Can Make Better Games.” Published by Focal Press, it is now available on Amazon as well as Kindle, iBooks and Kobo.

To follow Oscar on Twitter check out @Athanateus  

Watch the Magic of Habit Webinar

 

Pack Xamarin in your Cardboard

Virtual Reality is a hot topic these days and is viewed by many as the platform of tomorrow in some fields, like game development.

cardboard-xamarin

At this year’s Google I/O conference, among the flurry of product announcements, Google presented an interesting project called Cardboard. The experiment sprouts from a desire to make virtual reality, as popularized by devices like the Oculus Rift, more accessible to everybody. The result is a simple, affordable, and open virtual reality headset based on off-the-shelves parts that uses an Android phone for the heavy lifting of sensors, computation, and display.

Thanks to our newly released Google Cardboard component, Xamarin.Android developers can now also create virtual reality applications that work on the Cardboard platform.

Be sure to check out the included CardboardMonkey app for an example of a simple game that takes advantage of the immersive nature of the platform:

xamarin-cardboardmonkey

You can visit the official Cardboard website for instructions on how to build your own Cardboard shell. Alternatively, pre-assembled versions are available from several online retailers.

You can also head to the Google Developers website for more details on the Cardboard API.

Monologue

Monologue is a window into the world, work, and lives of the community members and developers that make up the Mono Project, which is a free cross-platform development environment used primarily on Linux.

If you would rather follow Monologue using a newsreader, we provide the following feed:

RSS 2.0 Feed

Monologue is powered by Mono and the Monologue software.

Bloggers