Saturday, 25 May 2013

Xperia Camera Test

I originally intended this blog to be solely about Unity, though since I got to be a Sony Ambassador for the Xperia Z I got to test it and it's been a lot of fun. This was the last week of my 4-week testing period and  I've been testing the camera. Next week I'll also know if I can test more Sony product and, if so, you'll get a lot more posts like these, since I really liked testing the Z!


The very short answer

The Experia Z's camera doesn't come close to a professional camera. Yet it does take awesome pictures and is great for taking some photos while on the go. It's basically as good as one of those small compact cameras. So no fancy arty photos, but good vacation photos.

Taken with Canon 550D, fish-eye
Fish-eye, Canon 550D

Where is falls short


Less control

Even though the Xperia z gives you a lot of options, there are still some missing. You can change your exposure value, iso, white balance and a lot more, though I couldn't change the aperture. Nor can you use any lenses, of course this it true for pretty much any phone-camera, but it's still something I missed.
(Some fun with a fish-eye lens on a Canon 550D on the right.)

No hardware button

Like the title says, there's not hardware button to take pictures. You can zoom by using the volume buttons but to take a picture you'll have to touch the screen.



Where it excels


Features

Even the default camera app has a lot of them. There's an awesome panorama mode, which works great but can be a little blurry sometimes. Also there's 'Smile Shutter' which takes a picture when everyone is smiling. It even adds a meter next to everyone's face telling you how hard they're smiling which is really funny. And of course you've got a timer, geotagging, image stabiliser, flash and HDR. On top of that there are also a bunch of focus modes: face detection, object tracking, touch focus and mid-screen auto focus. And it all just works.


Ease of use

The Xperia Z also has a 'Superior auto' mode which just does everything for you. It'll try to put everything just right for the current conditions, and does a good job at it too.


Not good nor bad

Quality

The Xperia Z's picture quality is average. It's really good when looking at it on the Xperia Z, with it's fancy Bravia technology. Though when I looked at the pictures on my computer the quality was noticeably worse, still not horrible, but worse.
Here's a small part of a 13MP photo, so you can see for yourself:



Conclusion

I really like the camera, it has everything I need. It takes simple pictures very good and without bitching about settings, yet gives you the option to change them if you would want to.

So that's the camera, hopefully till next time!

Thursday, 9 May 2013

Xperia Z Speed Test

I recently became a Sony Ambassador Recruit, along with 10 other people. Four weeks of testing the new Xperia Z. Last week I tested if it's really waterproof, and this week I'm testing it's speed.

Benchmarks

So, the first thing that came to mind was to run some benchmarks. Though, since this is the only phone I have I looked around for the most interesting benchmarks, and put some here. So thanks to ZDNet for the numbers!

Although they did a lot more tests, I think this says it all. The Xperia Z is all the way up there with the best phones on the market right one. Even though it's not the fastest, it's the only one that can do these speeds under water.



I also ran a few test myself and they came out a little lower than what ZDNet got. So perhaps I've got too much stuff installed or too many widgets running. Still, very impressive.










Games and apps

Next I've been trying out several apps. To put it shortly, it handles everything out there. I've been playing some slightly boring but visually stunning games, such as CSR Racing and Real Racing 3. Both ran really good. I also tested more interesting games, SuperHexagon, Splice, Solar 2, and they also run very smooth.
After that I tried some video editing, with the build-in Movie Studio app, and that too worked perfectly. Adding video's was very fast, searching felt snappy and adding effect was instant.
Lastly I did a little test of my own using Unity 3. I spawned a whole bunch of physics cubes to see how much I could spawn. My gaming pc could do about 1300 at 30 frames per second. The phone almost 500. To test the GPU I did the same test, but now with lighting. My computer did 1200, while the phone did only 220. So CPU-heavy applications will run better than GPU-heavy ones. Impressive stuff for a phone!

Daily Use

I've been using the phone now for almost two weeks and I have to say it's been great. It just feels very smooth and looks really good. Sony added their own skin over Android and usually that means it runs worse, but not in this case. The 1.5GHz quad core CPU can handle it with ease.
I don't play much games on my phone, so perhaps I don't put the full power of this machine to use, but I never experienced any slowdowns whatsoever.

Conclusion

I love this machine! It's fast, looks gorgeous and just works really well. This of course is what you would expect from a €650 flagship phone. Although there are faster phones out there, I think this is the best looking one, with the HTC One as a close second. The Xperia Z has some really awesome features none of the other have though. I still can't believe it's waterproof, that's so f... awesome!

Sunday, 3 March 2013

Easy Property Syncing over Network in Unity

A while back I was experimenting with network code in Unity. To make syncing variables easier I made something I called a 'NetworkMonoBehaviour'. This makes it easy to do exactly what the titles says, easy property syncing over a network in Unity. So here's how it works:

Properties

So we start with a field and, since we like clean code, we encapsulate it with a property.

Networking

Though now, if we change it, it will only be changed locally. This isn't what we want in a network game. So I wrote some code that makes it possible to do this:
This will change the _speed field locally and tell all connected players to do the same. It will only do it if the speed actually changed to minimize network usage. This is made possible by using my NetworkMonoBehaviour. Instead of deriving from MonoBehaviour you derive from NetworkMonoBehaviour with the classes you want to sync. They are still MonoHebaviours, but now indirectly. This makes it possible to used the a few very useful methods in this class. NetworkChangePropertyIfChangedNetworkChangePropertyAndCallMethodIfChanged these are the most used, and their names should explain what they do.
If you just want to use it, and don't want to know how it works, you can stop reading here. Just download the NetworkMonoBehaviour here.

NetworkMonoBehaviour

This is the entire NetworkMonoBehaviour class:

All of these methods will work with int, float, string, Vector3 and Quaternion. Otherwise an exception will be thrown.
The class is actually pretty simple. After checking if the value actually changed, I check what type the variable is (int, float, string, ...) Then I cann the correct RPC. These RPC's are methods that get called on all connected peers, and I made one for every type, which changes a field based on it's name.


Voila, now you can easily sync your properties over a network.
Thanks for reading!

Sunday, 24 February 2013

Is it easy to make your money back on the App Store?

So, as some of you might know (if anyone is actually reading this), I'm a hobby developer with a degree in game development. My biggest problem, when working alone, is that I can't finish the stuff I make. I always make something, but before I can properly finish it for release I start something new and then the cycle continues. Though there's one exception, a little app I wrote, called Magic Tools, for iOS.



Magic Tools

Magic Tools is a very simple app, and the first app I released ever. The problem is that it's also the only app I ever released. On top of that, for some reason, I made it for iOS. Because of this I had to pay the developers fee of 100$ (€80), and this isn't much if you're a proper developer, but might be much if you're just making app for fun and are a poor student like me.
Now, this brings me to the actual point of this post. My attempt to make some money on the App Store completely failed, but it did become an interesting experiment. How easy is it to make your money back on the App Store?


Very Easy

The short answer is: very easy. The app I made was a very simple app, I made it in a few days (while watching series) and did everything myself. Then I put it on the AppStore for 99 cents. It never sold like crazy, only a few sales per day, slowly going up. Now, after about half a year, I already made back more than half of what I paid. This with only one app, and a very simple one at that. I will report back in half a year.
So getting the developers fee back shouldn't be too hard. You can probably even making a little cash if you make more than just one app.


Thanks for reading!

Note: If I forget to make a new post about this is half a year, and you really want to know how much I made, comment here and I will keep my promise.

Tuesday, 5 February 2013

First-Person Adventure Kit (Unity)

Lately I've been making a lot of unfinished project. Most only go as far as making a basis for the game, so I've decided to put some of this online so other people (you!) can use it and hopefully learn something of it. You can use those code as-is, or alter it in any way you want. You can also use it in any game you want, even ones you sell.

What does it do?

So, first things first. What does this project do?
It's a very simple set-up to make a first-person adventure game. It contains a player script, which can walk and look around. On top of that it can interact with object in the world, and that's where it gets interesting.
But first, here's a link where you can try it out. Walk around with awsd (or zqsd for azerty) interact with leftmouse button (the wheel can be turned backward with the right button.)

How it works

Player

The player should be pretty straight-forward. It's a simple script which does the walking and the looking. It has basic first-person controls.

Variables

You can set it's walk-speed (m/s), jump strength (3.5 will make you jump just over one meter) and it's look distance (in meters.)

Pushing

By default a Character Controller can't push Rigidbodies in the world, so I added a few lines of code so it can push, the 'Pushing Power' variable sets how hard the player can push. (Look in OnControllerColliderHit for how this works.)

Objects

Now the interesting part. How does the interacting work. I've tried to make it so it's very easy to add new interactions without having to modify any code, only add a new script.

So, let's take the little green cube as en example.

Interactable Object

First of all, each and every object you want to interact with needs to have an "Interactable Object" script attached to it. This is used to gather all the interactions and tells the player-script that this object can be interacted with. It also cashes the interactions so only the first time you look at the object they need to be collected. This is also the script the player communicates with.

Interactions

If your object is an Interactable Object you need to add interactions. Interactions are custom scripts (I already made a few as an example) which define what your object does when the player interacts with the object. Instead of deriving directly from Monobehaviour they derive from Interaction (which is a monohebaviour.)
...

If you do this, you can override a bunch of methods and by that define what will happen when you interact with the object. You can add multiple interactions to the object and they will all work simultaneously. If you want an interaction to only work when something else has happened first, you can do this with custom code you write yourself.

Looking at the Interaction class you can see there's a lot that can be done with this:
So if you derive from this class and override one or more of these methods it'll work like magic! As you can see, by default the methods are empty, so if you don't override them they'll just do nothing.

Rotator

Rotator is a very, very simple class I wrote to make the wheel rotate when you interact with it. The wheel is the round red/green/blue thing on the blue box.
So, while I'm holding the use-button and looking at the object the HoldingUse method will be called. This will make the object rotate. While I'm holding the inspect button it'll rotate the other way. Very simple, almost no code and it just works!

DebugInteraction

Lastly I wrote a little DebugInteraction. This script shows when which method is called. All methods that are called once (StartXXX, EndXXX Use, LongUse, Inspect and LongInspect) are written to the console. Those that are called every frame keep how long they are being called and it's shown in the top-left of the screen (as you can see in the web-player.)

Download

Now you know the basics go check out more of the code and play around with it a little! You can download the project right here.
Note: I have custom input settings, so if you use it in your own project you might need to change these a little.


If you want some of the code explained more just comment here or email me, and I'll be happy to help!

Have fun coding!

Thursday, 22 November 2012

Choosing an iOS Engine Update: Sparrow

Hi,


A while back I wrote about choosing a game engine for iOS. And now I want to add one to that list. The one I want to add is Sparrow:

Sparrow iOS

This is a great 2D game engine. It rivals Cocos2D, though might be even better. It's not as big as Cocos, both in features and community, but it's more concentrated. One of the problems I had with Cocos2D is that there simply is too much, which can make it annoying to use. Sparrow doesn't have that problem, it's much cleaner.
It does however miss some features, the biggest being a build-in physics engine. Though you can just use Box2D (which is what Cocos2D uses too) and make them play together yourself, which isn't too hard.


As a bonus I also want to note that Unity just got an update, now it's at version 4! The best thing is that it now has social API's, so you can easily promote your game by posting stuff to facebook or twitter. There are also a bunch of other cool new features, but that's not what this post is about.

So yea, have fun making games!

Tuesday, 6 November 2012

iOS Gyro Controller for Unity

Hi,


While playing around with Unity Remote, to control my game with my iPad, I noticed that the gyroscope doesn't work. This sucks, so I tried to find a solution. I found one from the guys of Quick Fingers, though it needed some tweaks, so I'm writing an updated version here. You can read the original tutorial here, mine will be shorter and more to the point.

Needed Soft/Hardware

  • Unity3D and a mac
  • An iOS device with Gyroscope (any new iPhone, iTouch or iPad)
  • Control for iOS
  • Osculator (trail, 20second wait every 10minutes)

Steps

  • Install and start  Osculator and open the QuickFingers file
  • On your iOS device open Control, in 'Interfaces' add a new one and enter this URL:  http://www.quickfingers.net/unitygyro/layout.js
  • In Unity setup your Input Settings like this: 

  • Now you can use this in Unity, here's how to convert it to a quaternion:
float gyroX = Input.GetAxisRaw("GyroX") * 360.0f;
float gyroY = Input.GetAxisRaw("GyroY") * 360.0f;
float gyroZ = Input.GetAxisRaw("GyroZ") * 360.0f;
Quaternion rotation = Quaternion.Euler(gyroX, gyroY, gyroZ);

Now you can use rotation as the rotation of your camera yo create a window into your game. Kind of, since no image is send to the iPad... Still, it's great for testing and a lot of fun!