Learning game development

    09 Sep 2013

    Every now and then, I get keen on a new technology and I decide I want to master it (even though I rarely do it). It can be a new programming language, a new MVC framework, a new platform and so forth.

    Two weeks ago I realised I knew nothing about game development and, since I am both a developer and a gamer, I had to fix that.

    First off, I asked myself two simple questions:

    1. What kind of games I would like to create (2D/3D)
    2. What platform I want to develop for

    The answer to the first question was easy: since I like to learn things the hard way, I obviously went for learning 3D game development (stupid me!).
    As for the platform, nowadays mobile seems to be the most profitable market. But since I rarely play games on my iPhone and iPad I wanted something as multi-platform as possible.

    I thought about creating my own game engine, but as I don't have as much spare time to put aside, I quickly left this option.
    Therefore I started investigating the best 3D game engines, which I think at the moment are:

    • Unreal Engine (the one of Gears of War and Infinity Blade)
    • Unity3D (The Room and many others)
    • Source Engine by Valve (Half Life, Portal, Team Fortresse etc.)

    I will skip the in-depth comparison, you can find a ton of articles about it. I can just say I went for Unity3D.

    Unity3D and 3D modelling

    I immediately dove into Unity's official documentation and tutorials, you get tons of them.
    Both documentation and tutorials are really good, but after finishing them you can find a lot of third party tutorial on YouTube (links a the bottom). The number of different ways for learning we have nowadays still amazes me.

    As scripting language I could choose between Javascript and C# (Boo wasn't really a choice since doesn't support iOS development). Both languages are very solid and their ease of use makes them the perfect language to start with (anyone said no hipster-syntax? :P).
    By the way, I picked C# as it is statically typed.

    For 3D modelling the obvious choice was Blender: very large community and free. I know it is awful but it does the job, trust me.
    I didn't really learn anything about it, just followed some simple step-by-step tutorial on how to make a very simple level with walls and floors, nothing more (yet).

    The game

    To make the most of my learning, what's best than creating a simple yet real game? Since guns and zombies are always fun for most of people, I started creating "Zombie Slaughter" (I still think this name is too crude).

    I started with a simple first person controller to navigate the level modelled in Blender

    Then, I decided to add some zombies to play with their AI: I used the A* pathfinding algorithm to make them following the player. They update their path in interval from 0.5 to 1.5 seconds (to avoid overhead) and only if the player changes position during that time frame. It was good playing with an algorithm studied during university and never really used before.

    Also, I added a normal zombie-walking animation to them, using the new Unity's Mecanim animation system (which is awesome, by the way).

    After giving zombies a brain (kind of) and making them walk, I realised I haven't implemented any shooting yet (which actually happens to be the core of the game!).
    Thus I started adding a huge badass revolver to my character and I implemented the underneath logic for the game: two shots and a zombie gets killed.

    Also the game was still a bit too naked. There was no texture at all and lights were just too bright. I couldn't feel a dark and gloomy atmosphere you can usually feel in a zombie game.

    That was the right time to learn something about textures and materials.
    To create simple materials that feel real, it is important to make different assets for each texture which describe how the material receives the light and which part of it are more in relief. Only in this way it is possible to create from a simple seamless image like this one

    image

    a real 3D material:

    image

    I used the magic CrazyBump for that, gorgeous tool.

    After having applied some textures and tweaked lights, I added some animations as well. Especially I create the running and dying animation for the zombie, so that when there is a new horde zombies start running, and when they get shot the player can actually see that with a nice animation.

    After quite a lot of work, this is what I got.

    What I learned

    This is how far you can get playing with Unity3D in one week and half, not bad considering the tons of stuff you learn in the process.

    The main lesson I learned is that game development (at least in Unity) is just 10% about programming, the rest is equally split between 3D modelling and game design. That's it.
    Most of the code I wrote is dead simple, just some simple vector arithmetic and if-then-else statements.

    PS: If you're starting out with Unity like I did, I definitely recommend, besides Unity's official tutorials, the YouTube channel quill18creates and the great Turncoat Dev Diary by Jeff Lamarche.

    Citymapper

    15 Aug 2013

    Citimapper's release notes:

    3.2: Bug fixes.
    Just kidding, we added a new city.
    New Yorkers, welcome to Citymapper!
    Londoners, be nice. Well according to Apple's localisation technology, if you're reading this, we assume you're in London. Or you have your language set to UK English (instead of Default English, whatever that is- how rude). Or you happen to be on the UK App Store. Honestly, we're not completely sure how this works, except that if you are not in London, then you're wrong, because according to Apple you are in London, and thats whats really important.
    So yes, we added a new city, with all its quirks and complexities. Which shouldn't matter to you since you're in London anyway. Unless you're not in which case you're wrong. Of course if you do happen to go to New York, our app will automatically figure that out and offer you a Subway ride (its like the Tube except somewhat cheaper but smellier and it runs 24 hours, although good luck trying to ride it after hours). Or if you happen to be somewhere else entirely, e.g. on a tropical island somewhere, the app will ask you which city you wish to use, but really why are you reading this, just go enjoy yourself.
    Btw, why did the American cross the road? To get to the gas station!
    Hahaha.
    Don't worry, no Americans can read this. This is our own secret place where we can say what we want. Because according to Apple's localisation technology, all of us are in London. Aside from the NSA, who are probably reading this. And trying to decipher our UK English.
    So anyway, what have you done for me lately you say.
    Bus stops and tube stations have been updated, we're now showing next scheduled departures for buses and lines that are not running live anytime soon. Why show first tube but not last tube you ask? That's a very good and observant question, and one we're asking ourselves as well.
    We've also updated various transport data especially bus stops across the city (thanks to everybody that reported!).
    London rest assured we're not done with you yet. There are still too many problems to solve. But its time to grow up and embrace the complexity. London is where the first underground transportation system was created, and probably where the first miserable commute was experienced. And now that this torture has been passed on to other cities, we must save all the citydwellers of the world! Alas, the simple days are gone, and we enter a more complicated and wondrous place. Citymapper is now global.

    The app is gorgeous and they are brilliant.

    What I do for a living

    25 Jun 2013

    I decided to write this post because I don't know who I am. Well, from a professional point of view I don't know who I am.

    I am always a bit afraid when I know people are gonna ask me the infamous question - "What do you do for a living?".
    At this point, my mind starts running my personal algorithm for answering questions, which takes two inputs:

    1. the question to be answered
    2. the person that needs the answer

    Based on these two very inputs, I generally elaborate all my answers. But, just to explain what my job is, the second input is split in many other inputs which are:

    1. is the person a friend, an acquaintance or a complete stranger
    2. is the person tech savvy / knows what a programmable computer is
    3. is the person interested in what the answer will be

    Now, the algorithm gets a little bit trickier and the output (aka the answer) might take a while to be calculated (in the meantime I look like a bloody idiot blabbing something like "ehhh...eemmmhh...ehhhh") but eventually I've got the answer. Well, the answers:

    • I program computers (if the person doesn't give a damn what I actually do for a living)
    • I make iPhone and iPad apps (if the person is not tech savvy)
    • I am an iOS [Software] Developer (if the person is tech savvy)
    • I am an iOS [Software] Engineer (again, just if the person is tech savvy)

    Those are my answers, because is what I rather say, at the moment. But I am not really sure if they are the best possible answers.
    At the beginning, I was torn to define myself an "Engineer", a "Developer" or just a "Programmer". But eventually I analysed each of them and took my decision.

    Let's start from the latter. I don't quite like the term programmer. It feels empty to me. It feels like a cold machine which types stupid nonsense characters in front of another machine. So, I prefer not to use this term.

    I much rather use the term developer than programmer, not because I like it, just because it seems the most recognised term for a person who writes software. And it is much less worse than programmer.

    But at the moment I quite like to use the term engineer. I don't actually have an engineering degree (nor I want one), so probably calling myself engineer is not right.
    Nevertheless, my job title is "Application Engineer", the department I work in is the "Engineering Department" and my colleagues are engineers.
    I fancy this term because it says much more about my actual work. I find myself spending less and less time coding and much more time discussing requirements, thinking about high level architectures, drawing diagrams to find the best ways to engineer the software.

    There is another term which I really like it a lot: Software Craftsman. It is just two words but, it describes what I do during my 9-6 job and what I am passionate about: crafting software.

    The Passionate Programmer

    25 Jun 2013

    I’m often asked why it is that there are so many good musicians who are also good software developers. That’s the reason. It’s not because the brain functions are the same or that they’re both detail-oriented or both require creativity. It’s because a person who wants to be great is far more likely to become great than someone who just wants to do their job.

    When I was a music student, I spent long nights in my university’s music building. Through the thin walls of the university’s practice rooms, I was constantly immersed in some of the ugliest musical sounds imaginable. It’s not that the musicians at my school weren’t any good. Quite the contrary. But they were practicing.
    When you practice music, it shouldn’t sound good. If you always sound good during practice sessions, it means you’re not stretching your limits.

    Always be the worst guy in every band you’re in. - so you can learn. The people around you affect your performance. Choose your crowd wisely.

    It’s comfortable to play the idealist and pretend you don’t care what other people think about you. But, that’s a game. You can’t let yourself believe it. You should care what other people think about you. Percep- tion is reality. Get over it.

    [...] people all too often assume that anyone who doesn’t know how to operate a com- puter is not intelligent. Saying it explicitly like this makes it sound idiotic, but that’s true of all prejudices. However, this feeling is so ingrained in many of us that we don’t even know when we’re feeling it.

    Read. This. Book.

    Getting ready for iOS 7

    15 Jun 2013

    Marco Arment published a post on his blog which I completely agree with:

    If you want to enter a category that’s crowded on iOS 6, and you’re one of the few that exclusively targets iOS 7, your app can look better, work better, and be faster and cheaper to develop than most competing apps.

    As iOS developer, I got really excited by this year's WWDC: an ecosystem that feels new and mature at the same time and a tons of new API to learn and play with.

    If you're developing an iOS app, please make sure to use some of them if you're hoping to be noticed by Apple.

    These are my favorites:

    • UIKIt Dynamics
    • UIViewController and UICollectionViewLayout transitions
    • Background fetches
    • Push updates

    I think I'm going to dive into UIKit Dynamics and new view controllers and collection views transitions as I think this year the challenge will be about thoughtful animations.
    After that, I'll probably check whether they really fixed iCloud and Core Data.