 guys come they can listen from wherever I am at that moment. How many of you have developed any kind of games before or have interest in building games? Whether for a company or on your own to earn some extra money. Anyway so topic of today's iOS game development I'll touch upon a lot of techniques that you can use to build games in iOS platform but before that let's see some numbers. So these are the revenues or income by companies in 2014 and 13 in games over 25 billion you know people made just building games just by selling games. This is both for iOS and Android but this is we are some numbers of games and the daily revenues by these games in US dollar. So this much money these games make per day from users. Now Candy Crush is obviously in the list if you have seen a lot of Facebook spams you know how people earn money. Before Knowledge Library or framework that's provided by Apple to build games which is not a sprite kit and sprite kit is very easy to build iOS games but 70% of games in the App Store they are 2D games. There are few high-end 3D games like Infinity Blade and all but games that you probably use on a day-to-day basis like Angry Birds, Cut the Rope, Where's My Water, Flappy Bird all these are 3D games and more than half of the game developers are indie developers they don't work for any companies. Sometimes there's a team of one or two guys who just joined in meetups like this and probably thought about building some games and they make some pretty cool stuff like for example Flappy Bird is done by a single guy and he has built both iOS and Android and he has some similar games in both the platforms. In each of these games they have very common needs they obviously need beautiful graphics need to find a good designer or if you don't know any designer there are ways you can get you know game assets from different sites or you can simply build games using just text I'll also you later how and you need obviously some kind of visual effects some kind of particles in your game and you need physics and animation depending on the game for example Angry Birds is a physics based game being built using Box2D. So in 2013 before SpriteKit there are other libraries like Cocoa2D and similar libraries that we used to build games for iOS and Cocoa2D can build both for both iOS and Android. However a lot of time sometimes people roll out things on their own using just core animation if the game is very simple but then Apple thought you know why don't we provide a framework to its guys to make their life easier and so that they just focus on thinking about game logic and really good games then trying to build game engines and then came SpriteKit and SpriteKit let's you do a few things it allows you to quickly create sprites different particles let's you use a lot of physics objects let's you create physics based games allows you to animate these objects apply accents on these objects really literally with single line of course we'll see those later on and you can and some games you can have like there are requirements of videos almost in all games you need some kind of audios when things happen and you need obviously visual effects all is a part of SpriteKit. I'll show you a demo basically my talk has like several demos that also one of them is this sample that comes with this has been provided by Apple it's called Adventure. This is a simple adventure game where there are archer and warrior I select the archer and there's this archer I can use my mouse or keyboard to move this guy and I can fire arrows to these goblins and if you see some kind of effects there the lips are falling and if you come under the tree the trees kind of fade away and a little bit of parallax effect that allows you to visualize this depth in this game and as you move in you'll see more goblins there are fires and different objects this is simple game that you can download from Apple to kind of see what are things that you can do using SpriteKit. There are literally three main parts of building a game using SpriteKit one is scene another one is action and third one is physics and then we'll look into all of this as we go. So scenes are basically where imagine scenes as a particular scene of the game that you are visualizing in a way imagine there's a canvas where you will draw objects whether it's your player whether it's your enemies or whether it's a background image you basically draw things like nodes on these scenes and nodes represent again the adventure game we saw the archer that archer is a node the trees those are individual nodes and background image and all those things are nodes different nodes and sometimes you want to apply different physics to these nodes and you want to have some kind of action with these nodes. So finally you need a way to add these things to your game basically there's this class called SKView SK stands for SpriteKit and SpriteKitView where you add your scene and basically that's it in your scenes you draw on nodes and you add your scenes to the SKView. Let's take a look into the game look what happens when you when the game is running for every frame for each frame there's this method called update that gets called and in update basically you update the frame or you basically in update you can spawn enemies or you can spawn different players or obstacles and objects just things you can do inside the update method and it evaluates any actions that's depending on the particular node or nodes if there are several nodes and you want to do several actions for each frame it evaluates these actions and it checks after evaluating if you need to remove some of these nodes or if you need to you know do some kind of animation after these actions are finished then there is this method deval evaluate actions that gets called and you simulate physics checks that the physics is finished and if you need to do anything after the physics simulation is finished and that keeps on rendering for each frame and ideally for games they run between 30 frames per second to 60 frames per second so for each frame these methods get called giving you opportunity to run different pieces of your course and let's see a demo I was reading a book and that book I'll give you the name of a book later that book is works you through to build five different games one of the game is this one zombie Konga I'll just build it basically this zombie moves and you to when you scratch a cat the cat is zombified and the cat follows you but if you hit the cat lady you lose life and I think poor free life yeah so that's the game so as I talked about there are different nodes that allows you to do different things in your game and the base class is SK node which is which stands for strike it node and you have different properties using which you can change the alpha value of the node you can rotate the node you can scale the node or you can so or hide the nodes but ideally you won't be using SK node directly what you'll be using it's something called SK Sprite node 80% or 70% of your code will be just creating will involve just to create SK Sprite node and manage these nodes it has an explicit size it can display color or can display texture if you specify a size then it draws the node of that particular size you specify color it draws a SK Sprite node for that color same with texture so if you create a new project this template called game you can simply select this template and it asks you okay which game technology you need to use sprite kid is one of them you have seen it which is being used for 3d games you have open jellies and the new thing metal they can select one of these templates and you can obviously choose saved or objective C let me just call it I'm just going to create it for iPhone and it gives you some you know some sample classes to start with I'll just run it to see what happens this is just game template where you click and the spaceships come and they just rotate so going back to our code I'll see how how to create these nodes and how to rotate them with texture you have some helper methods one of the important one is texture with image where you can specify the image name to directly create a texture with a particular image name and in order to create a sprite node SK Sprite node you need to first create a sprite node then need to create a texture then need to set the size of the sprite and you need to set the texture for that sprite but this is so common that you also have a convenience method a sprite node with image named and just keep the name of the image and it will create a sprite node for you and you basically add that node to your scene in order to make it appear on your scene as you saw that we can create sprite nodes with colors and with textures you can kind of combine them together also to give different effects for example here in this case there's a mountain I can put blue color to give the icy filling of icy filling to this mountain for my ice wall for example let's say if you have a firewall you can put red color make it red so you can with similar textures just like changing the color you can have you can achieve different effects also a new thing that's called particle these are things that you need to use for example in the adventure game there are fires coming out similarly in some games when people or your player collide with enemies you might might want to create different particle system or different effects you can use you can create using particle system you can change various properties of these particles I'll simply show you how to create these particles and how to use it for example in this same game sample I'll just create a new file one of them is this particle part of the system and you have different things that you need to choose you can choose fire stars whatever effects you want I'll choose fire and it asks me the location I give the location and this is a particle that I have and there are various properties that you can change to make it look like what what is the effect you want for example here the birth rate is 455 which I think is probably too much I let me change it to 40 and you can instantly change it here in the editor to see how it looks let me make it a little bit more so depending on what your what is the kind of effect you want you can play along with this values for example lifespan let's say this is 2.5 I want to increase the lifespan so let's say 5 different effects similarly you can apply different colors the start color and the end color you can just choose a color and drag and start from a color and so all these things you can change and you can create a particle system easily later I will show you another demo where I use a particle system for my game these are about particle systems and a lot of time the maximum amount of time after you create your sprite grid node you need to apply some actions to them or you need to animate them somehow you can do normal you know actions like rotate scale say move all these things you can do to run an SK action there is this method run action and you just do it on a node and it's basically sprite node and it'll just run that action you can run or basically can repeat actions repeat actions you will use normally when you want to spawn certain objects at periodic you know interval for example for the zombie con guy game that I saw so they're the cats spawn at regular intervals that's where I can use the repeat action sequence is where you can sequence or chain a series of actions and these actions take place one after another you can group them also together so they'll run in parallel so depending on what you need you need to do sequence or group or you can combine them together also you know this is the sequence and you can kind of group them together also there is another action which is called wait for duration if it's certain scenario you want to wait for certain seconds before your next action happens then you can use this wait for duration the thing that I use in my game the zombie if I saw the game again run and so you if you notice the zombies not moving just the straight line there is sequence of textures I'm using it's like two three texture I'm using and that gives you this feeling of the zombies working rather than moving in a straight line and you can use this animated textures and you can specify the time frame and you can use different textures to give this walking or jumping kind of feeling there are some special actions where you can remove these nodes from your scenes let's say in certain games you have a spaceship that flies off your screen and once the spaceship flies off you probably want to remove it from the scene and there is this remove from parent method that you can use to remove the action you can use as reaction also to play sounds along with your other actions this see another demo so in this game I have not used any images all assets are basically ascii characters so this is also in a way to the Xcode that I'm using because sweep changes quite frequently and it's not really stable they the APH changed a little bit depending on the particular version of Xcode hopefully this works it was definitely working I think the method signature has changed let's see anyway let's see if I can run this towards the end some errors the third thing is physics and sprite kit you can apply physics to any SK node and it will physics of a particular shape and it will animate accordingly it will behave accordingly in your physics world I'll show you an example so over here I have two physics objects one is a square and another is a circle there's this gravity thing if you if I put minus 9.8 after some time it'll drop to the bottom and if I change the property to 9.8 we'll go to top similarly there's another thing called bound if I remove the rectangle of this particular scene in which these objects are or SK nodes are they'll just fly off the screen I'm not sure if you have played this game earlier this is called gravity guy which basically runs and at certain point of time the gravity changes you need to flip the guy upside down in order to you know move ahead I'll show you another game which is this cat nap so basically the objective is I want to drop this cat in this plate and I need to remove these blocks one by one for example if I remove this one the cat falls up the thing what if I remove one by one so you can think think about different ideas on how you want to use this physics bodies and as I mentioned you have different shapes that you can create you can create your own custom shape and you can apply it to different nodes and whenever you do an animation or do an action it will automatically work for you another thing is collision detection you know in games you need to detect the collision between your players and obstacles players and enemies if you want to have some points you can collect coins and all these things you need to detect collisions between these things because all of these are frames and basically nodes with certain frames you can use this method called CG wrecked intersects it checks if there is an intersection happening between two frames and if it happens then you need to do certain things again on the first game when the zombie hits with the cat lady it loses life when it hits with the cat the cat kind of follows the zombie and there are some new things with the new sprite cage you have inverse kinematics where you can use it to build robotics games for example you can apply different kinematics to different nodes you have light nodes you have different kind of shadow effects so all these things are there in the newest bracket you can start with these four videos actually a lot of things that I talked about today is from the first video introduction to the sprite kid but what's new in sprite kid gives you about you know talks about the new things that are there and best practices for building sprite kid games talks more about performance and other things you can buy this book if you are planning to buy then definitely paying me because I probably can get some discount for you I would suggest buying just the pdf books unless you really like to read the printed version and that's the book from where the zombie Konga games come in and then the cat nap and there are few other games that are there you will build five different games while going through the tutorials of this okay that's it thank you any questions yeah you can have any set you can create your custom sets also I think for doughnut you need to use sink it because I said 3d shape it's not really 2d shape I think for that you probably need to use sink it I'm not sure you can do it using just sprite it or you might be able to do it using physics body and sprite I'll tell you first new games right it all depends on how you want to let user interact with the games there's one time I think was this game called train your dragon or this movie actually so when the movie was first released we were actually building a game for them it's more like an demo game or MVP game if you say so there's a dragon you basically rub the dragon and the dragon gets hot and you can see the baby dragon breathing inside a hot egg there's a x-ray button we tap on the extra button you can see the baby dragon breathing and if it becomes too hot the dragon gets angry and your phone will start shaking and you can use your microphone to kind of pull the dragon out and blow air pull that egg so you can touch is one thing I can use touch and swipe and all those things but you can also use this other interactions like microphone or other input methods like microphone or even different gestures sakes yeah okay I'm not sure the second speaker is here he said I'm on my way so we'll just wait for him and you can enjoy the food until then if the food is there yeah I think there are four more boxes there you can just enjoy the food and talk with each other