• .
  • .
  • .
  • .
  • .
  • .
  • .
  • .
  • .

Visual Studio, Unity & Mac The Finale

Posted on by Quick Fingers in General, Unity | 4 Comments

Aaah workflow. We meet again.

Compared to most cross platform software,  Unity has a disproportionately high number of Mac users. Why? Because it began it’s life on the Mac. (In fact I (and I’m sure many others) only moved over to Mac because of Unity!) Now I’m miles more comfortable on my Mac I don’t want to go back to Windows, but there’s one reason I keep a VM on my Mac at all times. Yes that’s right… Visual Studio. If you, like myself, are unable to let go of a 2 and a half gigabyte text editor with more power than the LHC, then I’ve got some good news. I’ve finally put together everything you need to get all the integration options available in Unity Windows. On your Mac.

Requirements

First of all, you will need!

  • VMware Fusion (Tested in 4.0, theoretically compatible with 2.0+)
  • Windows XP or above in a VM loaded with Visual Studio 2010. (Untested with Express editions)
  • Your Virtual Machine must have a user account (or admin) with a password

The rest is pie.. or cake…. Pick one.

What’s supported?

  • Click to open script in Visual Studio from anywhere in Unity (Editor Window, Inspector, Project view, Console)
  • Click to open script at specific line from console output! (Errors, debug.logs, etc)
  • One click to sync Visual Studio 2010 project and solution.
  • One Visual Studio project per Unity project. Just like old times! (No more ASsembly-csharp, first-pass and dozens of csproj clutter).
  • Customize file types to include in visual studio project sync (Defaults to .cs, .shader, .txt, .xml, etc)

Gimme The Goods!

Okay here you go simply press the blue button.
 

Download Virtual Studio  PAYPAL Donate

There’s some initial setup you will need to do so please read the readme file inside the archive. Oh yeah, if this somehow helps you make tons of cash or your company rolls it out throughout there whole office, sort me out with a few notes.

The Quick Fingers Sleep Pattern

Posted on by Quick Fingers in General | 1 Comment

I was going through one my old note books from my 6 months as an indie developer and I came across a sleep diary I had made. I was tracking my sleeping pattern as it was pretty erratic and probably questionably dangerous. Judging from the position in my journal it was around the time I was making Drop. 

One of the questions I get asked a lot is how to produce work quickly. Well if you see the info graphic I made below on my sleep pattern during the week I created Drop, it might become clear! (I promise it is accurate).

A quick disclaimer though, this is probably a completely wreckless lifestyle and totally unobtainable so don’t try it at home.

Click to enlarge

So there we have it! Mystery solved… Simply work for 122 hours a week and sleep for 46.

Covert Post Mortem

Posted on by Quick Fingers in Covert, General, Unity | 2 Comments

A couple of weeks before Christmas Unity dropped a public preview of the latest update to their engine. Along with this they announced a competition to make a game using a preview of the Flash exporter functionality. So I set to work making my entry, Covert.

Inception

The game idea spawned from my love of the original Deus Ex game. My favourite elements being the sneaking around, hacking computers and guessing the keycodes for doors. So I wanted to make a game that just focussed on those elements. I figured that without weapons of any sort, coupled with a 1 shot death means the tension should carry the gameplay enough to make it fun. Without further ado, lets get on to some of the technical tricks I came up with that made this game possible. 

 

The Cameras

The cameras field of view and visible cone was done using raycasting. A LOT of raycasting.

I used a variable amount of raycasts per camera ( depending on how many cameras there were per level) then just set a value for the field of view. The camera then steps across its field of view raycasting at regular intervals and storing the point it hit. If any of those raycasts happened to land on the player I trigger the alarm. Then finally I take all the raycast hit points and triangulate a mesh out of it to show the visual fov cone.

So yes, I was doing over 100 raycasts per frame… in flash. I was really impressed with the performance considering how much I was smashing the CPU with unoptimized prototype quality code.

 

Enemy AI

The new navmesh feature came into its own here. Unity has basically made it possible to develop a relatively advanced AI in about 3 minutes. I couldn’t believe how eat it was to plug in just one behaviour controlling the alert state of the enemy (either stopped, patrolling or alerted) drop a few waypoints in the editor and let the navmesh do the rest.

The only limitation I came across was for areas on the navmesh you want to toggle. (in my case , the doors). The only way I could find to have some navmesh areas toggle was to put a small section of floor under the door on a different navmesh layer.

This effectively blocks the AI until you add that layer to the allowed path ( when the door opens). A decent enough solution but there is a hard limit of 32 navmesh layers so if I had a giant level with hundreds of doors I would of had to find another solution. Luckily, I didn’t. I think the highest door count I got was on the last level it reached about 20. And after designing that one I decided I didn’t want any levels bigger than that!

When the player opens a door I add the assigned layer for that door to the walkablePath of all the enemy agents in the level with the following code: 

public void RemoveLayerFromNavMesh(int layer) {
    foreach (NavMeshAgent enemyAgent in allEnemyAgents) {
        enemyAgent.walkableMask += 1<<layer;
    }
}

Image Effects

Not being completely confident with the performance scope of the Flash player I wasn’t sure about using all the advanced image effects with Unity Pro. I kept away from the heavier effects like depth of field and vignetting but really wanted to have some visual gloss so found some cheaper ways to imitate post processing. 

Firstly I used an alpha plane with an inner glow created in Photoshop over the whole scene to create a fake vignette effect that was on through the entire game.

Secondly a Mobile Bloom (found in the Angry Bots sample project) was added that is cheaper than the full bloom/flares effect but has less fidelity. It didn’t seem to impact the frame rate much and was more than happy with how it looked

Before & After Mobile Bloom Effect

When viewing through the cameras (and the computer screens to a lesser effect) I wanted to add a noise pattern. There is a noise image effect but as I was trying to stay clear of heavy post processing I used a much cheaper method that looks fine for the purpose. 

Simply adding a plane over the entire area of the UI camera with a simple noise texture created in Photoshop and using an Additive shader creates a pleasing (albeit static) noise effect. The final step was adding some movement to the noise effect. Just using the UV offsets in the material and randomizing the values creates a random and totally believable noise effect with no post processing:

void Update() {
    Vector2 random = new Vector2(Random.Range(0f, 1f), Random.Range(0f, 1f));
    renderer.sharedMaterial.mainTextureOffset = random;
}

UI 

I couldn’t do the post mortem without giving a nod to a plugin that made the game possible which was NGUI. After the Flash exporter was added to the developer preview of Unity I think it took the creator a couple of days to re write his code to support the Flash platform. I had previously started using it as the support he was offering impressed me so I was really happy to see he had chosen to support Flash so early on. All of the UI was built on the NGUI system and it’s the UI I now use for everything :)

 

What Went Right

With the insanely strict deadline imposed by the competition it seemed like an impossible task to create a game from start to finish with enough depth to shine in a competition with a grand prize of $20,000 but thanks to the timing (done over the Christmas break) I had a lot of free time and not too many work commitments so I worked on this project 24/7.

The actual game idea and theme was something I’d had in the back of my mind for a while and had wanted to develop since before the competition so I didn’t spend any time coming up with a theme I just started working on it right away.

The graphic style came together very quickly and was inspired quite heavily from Frozen Synapse. A game I’d played a little of but appreciated the minimalist (and very blue) styling throughout.

Problems

 The Flash Exporter (which is still a preview) has some limitations which meant I ran into a few hurdles a long the way. Certain methods aren’t included in the Flash .net subset including System.Array which I use quite a lot for managing native array types. Instead of these helper methods I had to roll my own solutions for dealing with array functions like copying and resizing.

One day before the submission my entire UI exploded for reasons I have yet to work out, and due to the timing I was back at full time work so had to do a days work, do an all nighter on Covert and then back to work for another day. It was a really tough slog but I was very happy that I managed to re make all the UI through the entire game and get my submission in about 30 minutes before the deadline.

Conclusion

Overall I was really happy with how it came together, in terms of the Flash export functionality I was extremely impressed. Converting an old game to use the Flash exporter may leave you with a lot of errors and unsupported features that prevent you from exporting, but creating a game from scratch with the Flash exporter in mind really isn’t so bad. Doing test exports frequently should mean you’ll find any issues early on and can work round them. 

Thankfully the guys at Unity enjoyed my game enough to give it a runner up slot in the competition and provided me with some additional Unity licenses which was great. So thanks to everyone at Unity for doing this competition and providing us with a great toolset for making Flash content!

Come Home

Posted on by Quick Fingers in Unity | Leave a comment

A NEW IDEA

I’ve been contemplating posting this for over 6 weeks now. It was a project I started on December the 1st and finished on December the 14th of 2011. A new type of project for me, and something I believe to be fairly unique in the gaming world. It’s a pretty personal subject matter and the story is right there for everyone to see. No names or anything were used but the people involved are fully aware and have given the all clear for showcasing this online.

Come Home is an interactive true story based on moments in my life. It’s a PC/Mac Standalone game. It’s a fairly weighty download (around 75mb) and has some fairly heavy image effects so a fairly good GPU is recommended. If this isn’t enough to scare you off then go right ahead to the game page here

Boom Bugs Released!

Posted on by Quick Fingers in Boom Bugs, iPad, iPhone, Unity | 1 Comment

Title says it all :) Boom Bugs my physics based destruction game has officially been released on iPhone and Android, and the iPad HD edition is under review as we speak.

After working solo on the project for a little while I collaborated with the guys at Playerthree and between us we finished it from an early alpha to the polished game that it is now!

If you aren’t familiar with the game, please take a look at the trailer below (courtesy of unity3d.com)

All you have to do is head on over to www.playboombugs.com for more information, get it on your smartphones and start killing some spiders!

Designing for iOS

Posted on by Quick Fingers in General, iPad, iPhone | 5 Comments

I’ve been quiet recently, a lot of this is due to me focussing on a couple of key titles for me for iOS. One you already know about and one is totally unannounced. With all this work on little screens I was doing all sorts of UI and HUD design and one of the things that bothered me was previewing the work I was doing in Photoshop on a device at native resolution. (especially with retina display when the native resolutions screen area is tiny compared to most computer monitors displaying the same resolution). I’ve researched some solutions but inevitably came up with my own that suits me best.

There’s an app for that.

Currently there’s a couple of apps out there suited to this. First up is LiveView from Nicolas Zambetti. This is a free screencast type affair that broadcasts a select area of your screen to your device. Setup is super simple, you do need a host app installed on your computer and it is only available for Mac, once installed the device connects over wifi and everything works. You need to specify an area of your screen just for the screencast, this means if you move your photoshop windows about a lot it’ll break the illusion and you might spend time re aligning to the capture area.

The second app i tested is called Review by Kevin Kalle and Pieter Omvlee. This is a more bespoke tool for the task, specifically targeting photoshop users. It is a file sync solution that again requires a host application and again is Mac only. (I use both a mac and pc throughout development so I prefer cross platform solutions)

Once you’ve got both the iOS app and the mac app running syncing them was easy enough and to use it, there’s a system wide shortcut for syncing any images selected in the finder or any active window open in photoshop as a png. Very nice. The only negative thing i found was the process to update an image currently being displayed was slightly convoluted. It requires you to go back to the start of the app, hit the refresh button, wait for the update and the click on the image again to show the updated version. The iOS app of Review is also not free. It’s currently being sold for £1.99.

So one app (LiveView) provides instant updates as you make them via screen casting techniques but requires you to have a reserved area of your monitor specifically for this so didn’t really allow for folks like me who chuck photoshop windows around reckless abandon. On the flip side Review was more suited to me, just a keyboard shortcut and a file is ready to be viewed on the device, however the price and process to view a file I may of only changed a couple of things in meant it wasn’t right for me. The other problem I had with both these apps was having to install another helper app on the mac side was something I’d like to avoid if possible (and ideally, get a cross platform solution) and with liveview, broadcasting a screencast does have an impact on your processor.

My solution (Dropbox / custom website)

Photoshop Action (bound to SHIFT-F1)

So what was the end result? Well I chose to use neither. Instead I utilised what I already had available to me… Namely a Dropbox account and a tiny little web site on my domain. How this works is as follows… I’m messing around with a mockup in photoshop, I hit a keyboard shortcut, an action runs to save a copy to my Dropbox public folder with a specific name (in my case iospreview.png) and I just tap my iPhone screen and the image magically appears.

(One added bonus of using Dropbox is the nice little icon that tells me when the image is done. And if the changes are minor it only uploads the delta so it’s pretty darned fast)

That magical bit is where the interesting part lies, I’m using a free app on my iPhone called Full Screen Browser (this app is also a private browser, whatever that means, but the full screen bit was perfect for my needs. I have a website that just shows that drop boxed image, and nothing else. With some metadata and javascript I’ve made it fit the iPhone screen pixel perfect and make the image a link to refresh the page. Simple! Now I can design on my Mac or my PC, with no extra applications running and update my iOS view with a simple shortcut and a tap of the screen. It also works without the iPhone being on the same network as my computer (Useful if your workplace has network restrictions or no public wireless) and its totally free.

Before and After some HUD Changes. 1 key press & 1 tap to see the update on device.

As an added bonus I included a swipe control on the website that toggles a “screen-door” effect. This basically emulates a non retina screen on a retina display device. So when viewing images on my iphone4. I can see how they would look on an iphone 3gs and lower just by swiping across the image. For information on how this works (and why it is different to just viewing a half resolution image on your retina screen) visit Louie Mantia’s blog here

If you want the source code for the html page to do this click the big blue button

 

Download Source

 

Ludum Dare, Me and The Future

Posted on by Quick Fingers in General | 4 Comments

Last weekend I participated in the 21st Ludum Dare. The ultimate 48 hour game jam. The  competition phase is now underway and voting is taking place. My entry was called AWOL and information and play links are available on the project page.

As far as how I felt it went. It was really smooth, even smoother than the last LD I participated in, finishing earlier, having a better  game at the end and enjoying slightly more  break time than before. I put this partially down to luck and also just down to my initial motivation being more directed to begin with. I will write a Post mortem of AWOL as my next blog and explain some of the tricks and interesting things I did in that.

Current Projects

So as you might be aware if you’ve been following my stuff for a while I have a few projects that are still in development. Some I’ve talked about a fair bit, others not so much. But these are the projects currently in development and their status:

Boom Bugs : My iOS title that was announced months ago. Development of this has been continuing and I have been working on this a lot over the last few weeks. It’s getting close. This is likely to be the next release from me. But I’m afraid I cannot really offer more details on this title any more, I’m sure you can work out what that means ;)

Island Strike : Momentarily halted… Keep reading.

The Core : Hehe yeah yeah… when its done!

Me and Now

So Quick Fingers has been running for just 6 months now although it feels like a lot longer. For those that don’t know, my background is about 6 years as a Flash Developer, as soon as I discovered Unity a couple of years ago I knew that was where I wanted to be. So I spent a little time playing about, but ever since last year I’ve been learning intensively and for the last 6 months (as Quick Fingers) actively developing projects and hopefully becoming a part of the Unity community.  Based on my work over the last 6 months I’ve been offered a full time position doing purely Unity development and I have taken it :) Further more, the company that I now work at is happy for me to continue Quick Fingers work in my own time so for you guys enjoying my games and updates, nothing should really change. I’m letting you guys know because it’s a pretty good moral. I was unhappy making Flash games for a living, I had a lot of love for Unity and I wanted to use it professionally, but without a portfolio or any ‘proof’ of what I could do with it, I took 6 months to really put myself out there and develop like crazy and now I have that job. So there! It’s never a bad thing to shake things up in your career and change tech, and possibly… even your discipline…

The Near Future

Which leads me neatly onto my final point. In the past I’ve always considered myself more a “Developer” than an artist or designer in the gaming world. I’m happiest knee deep in my comfortingly syntax coloured C# scripts, tweaking and hacking away at things I don’t fully understand. Design has always been a part of me and music of course. But as for raw artistic ability… that’s my weak area.

At the moment I’m firmly in the Pink area of this neat little diagram I made. I want to be in the middle. So for the next few weeks, outside of my work at my new Unity job, I will be doing drawing lessons, doing a course on Maya and trying to get into creating some awesome environments and architecture in 3D. So that’s why Island Strike is currently on hold, only temporarily mind you whilst I get this urge to do artisty type things out of my system :) Anyway, wish me luck! And I apologise in advance if I’m distant or neglect the updates while I go on my little journey to environment artist!

iPhone 4 Gyro Control in Unity

Posted on by Quick Fingers in iPhone, Unity | 11 Comments

The Write Up.

This idea spawned from seeing an iPhone app called Cameraman for Maya by Wes Mcdermott (www.the3dninja.com). The basic principle is you can use the gyro inside an iPhone 4 to record motion capture data. Really useful if you want to get an authentic shaky cam effect. I’ve been planning some larger projects in my head and figured something like this would be really useful for getting some animation clips for the camera in cutscenes.

Initially I thought this would be really easy in Unity. It has a remote iPhone app and I can just use that. I had a friendly peer-imposed deadline of 24 hours from Prime_31 so I figured why not :).

Unfortunately gyroscope support has only been added to Unity in the very latest version (3.4) and the remote hasn’t been updated to send Gyroscope data to Unity when using it as a remote. So that was out, (although that would also have limited me to having a usable system only on Mac). So I tried something else.

(If your not interested in the background and just want to get it going on your own projects, goto the bottom of the post to get the download links and how-to)

OSC?

For the uninitiated OSC stands for open sound control and is a messaging format optimized to be super fast over current networks. It’s primary use is in audio, controlling synthesizers and synchronising hardware with software. However due to its light weightness its really good for real time stuff, I did a quick search for iPhone apps that support OSC and found a BEAUTY. This is part 1 of the puzzle to get this thing running.

Control

The app is called control. It’s a single dev’s work by the name of Charlie Roberts (www.charlie-roberts.com/Control/). If it wasn’t for this I wouldn’t have made my 24 hour deadline. It’s basically a customizable interface allowing access to all sensor and touch events and send the raw data with OSC. The great thing about it is the interfaces are in JSON format so writing your own is a piece of cake. Oh yeah, and it’s free! Here’s an example interface for Control:

loadedInterfaceName = "template";
interfaceOrientation = "portrait";
 
pages = [[
{
    "name": "refresh",
    "type": "Button",
    "bounds": [.6, .9, .2, .1],
    "startingValue": 0,
    "isLocal": true,
    "mode": "contact",
    "ontouchstart": "interfaceManager.refreshInterface()",
    "stroke": "#aaa",
    "label": "refrsh",
},
]
];

So I made an interface that sends the gyroscope information 100 times a second and also has 4 triggerable buttons on the screens (used for movement in Unity). Once you’ve got all this sending data, it has to be received by something. So another app was required here. (Sending the gyro at 100hz was absolutely fine as long as my wireless signal was strong. Any sort of interference or low signal caused a few drops here and there)

Osculator

Another wonderful application that I utilised is Osculator (Mac only unfortunately. I didn’t search for a Windows alternative but OSC is an open format so should be plenty of software out there!). It is available as a demo which functions fully apart from a pause every 10 minutes or so for 20 seconds. This application receives all the OSC data you can throw at it then does whatever you want with it. You can see in the screenshots it provides these great live views for any parameters you send it so I get a nice graph showing me exactly whats happening with the gyroscope. On my osculator setup shown in the screenshot you can see I mapped each gyro output (pitch, roll and yaw) to a different joystick axis and then assigned the 4 on screen buttons to joystick buttons. Now just have to hook them up in the Unity editor and half the puzzle is solved.

Osculator Setup

Unity

Once we are in Unity we just set up the 3 axes in the Input Manager and write some script to handle it. The scripting is pretty straight forward. Just adding a little code to convert the axes into the transform data and everything starts moving around as it should. Initially when I did this I had the animation creation as a 2 step process where you would make your data whilst playing, then create the animation file and edit it after the game has ended and your back in editor. Now I’ve streamlined it thanks to Unitys AssetDatabase API I can create the animation asset whilst your playing and store it in your Assets folder. (This will obviously only work in the editor still, it wont work if you export. That was never my intention). Anyway that was the final hurdle so now, we are done :) It took me 20 hours in total to reasearch and complete the prototype.

 

Trying it Yourself!

If you’d like to give this a go yourself… Well, cool. But there’s a few prerequisites.

  • Control Application for iOS (iTunes Link)
  • Osculator for Mac. (Demo)
  • iOS with Gyro (iPhone 4 or iPad 2)
  • Your computer and iOS device on the same network.

Okay I have all that, I still wanna do this!

  • Start Osculator and grab my patch file from here. Load it and leave it running.
  • Start Control on your device: In the app, goto ‘Interfaces‘ click the plus (+). Point it at the URL http://www.quickfingers.net/unitygyro/layout.js (This will download the interface to your phone so it’ll always be there from now on) You should see it in the list as “Unity Controller“. Now goto ‘Destinations‘ and your computer’s IP address should be there, tap it. Then back to ‘Interfaces‘ and tap Unity Controller.
  • Inside Osculator you should see things starting to flash.
  • Now open a new or existing Unity Project
  • Download the GyroRecorder.cs file and attach it to the camera. (Or anything you want to record animation for)
  • Download the InputManager.asset file and overwrite the one in your projects /Library folder. (Be aware this will destroy your Input Managers settings so don’t do this on some pre existing project with complex button mapping setup).
  • Restart Unity.
  • With Control and Osculator running, hit play in Unity and everything should just work!
  • Hit ‘Zero‘ on the device to reset the current gyroscope position as 0,0,0.
  • If your getting weird behaviour and flipping make sure to lock your devices orientation. This uses Core Motion so the accelerometer does come into play. I had weird effects when the orientation was detected. It’s better to just lock it

The rest should be pretty straight forward! Hit the record button to start tracking input. If you stop the engine or press stop it’ll output to a .anim file in the Assets root directory. Okay enjoy!

1 2 3 4 5 6 7   Next »