Playing with fire! (Blender)

Few releases back, Blender introduced a simulation for smoke/fire something that only was available on other engines. Now came to Blender. And today I was playing with it. Adding some shaders and some forces to the scene you get pretty neat effects (This image is part of a promo video that I’m working on):

0046Flame_animated

Is really easy to achieve and also is really powerful tool that can help you make some nice looking scenes.

I found a really good tutorial that shows some nodes configuration also, and showcases the features of the simulations:

Advertisements

My GCP Build-off experience!

I want to share with you all my experience in Google Cloud Platform Build-off, It was a contest where there were 3 categories: Music, Film and Gaming. If you know me you already know in which category I participated! Obviously on music!…of course not! GAMING!

So first of all I saw the ad late! around February 10th! (the contest started on 5th) I had an idea from long time back, but the only thing I had was a character:

Front

Mavi!

A nice and cute character that I wanted to put in a challenging game, I had this idea of a game that will challenge your memory and some other brain abilities. But that was it, that was all I had at that moment. Since I always procrastinate; this time I wanted to do it for real. So I said to myself: “Myself you should really do it this time, you need to have a deadline”. At school I always did the projects at the end of the period, not because I was completely lazy (well maybe a little…) but because I always wanted to do something else. But when the deadline was approaching I was giving my 200% or even 300% to achieve what I wanted to do for that project.

So I challenge myself! and I had to finish it by February 28th! a couple of weeks only! And then I started building the idea into reality, I know Unity and Blender, so I started building everything in Blender, all the environment, the coins and the emeralds.

Screen Shot 2015-03-17 at 10.43.12 PMScreen Shot 2015-03-17 at 10.44.00 PMScreen Shot 2015-03-17 at 10.44.24 PM

Then I started coding all the actions in Unity, I built a Tunnel, that would repeat over and over while the character was running. And I created a framework that would place the coins, emeralds and obstacles in specific places based on templates. Since I didn’t wanted to build each and every single combination on Unity I created this framework that will take a template configuration from an external source and place the elements accordingly. And the external source that I chose was Google App Engine, I didn’t have to code much to create a web server and responde to http requests, it was already there. So I started coding, then I noticed that a file would be very rudimentary to maintain, so I decided to use Google Sheets so that I could go to a spreadsheet and modify it online and the world of the tunnel would change. So I used a set of APIs to get the content and the last modified date time stamp. And then process that content to finally send a clean and light weight response to the mobile client (in JSON).

At the beginning everything looked fine, but then I noticed something interesting, each call was taking around 800 to 900 ms. A noticeable time for an app to wait for an updated world. Since I wanted to reduce the time for that I decided to use Memcache to store the processed information in cache. So all subsequent calls would be faster. When I stored the object the response time for the subsequent requests got reduced dramatically, from 800 ms to 80 – 90 ms!! Incredible! and not a whole lot of code needed. Just like using a dictionary.

Once all this was ready I had only 1 thing to do on the backend: the scores. For this there wasn’t much need, just a place to store unique players and their list of scores. So I easily used Datastore to store these entities. I did all this on the free tier! I didn’t paid a single penny! Which is awesome hehe!

And then after the main flow was working I started “polishing” few things in the app to make it fluid and have the playable experience, I included some sounds and music, and adjusted the volume and length to fit all the sounds into the game and I used Audacity for that. Once everything was ready I had to make a video to publish my participation on the contest:

And the I could sleep! I didn’t sleep for the last 2 days before the contest, I had to do a few adjustments and fixes before I could send the application. But it was worth it! Few days later I received an email from the organizers of the contest! I was in the next round of the contest! It was an amazing feeling. Knowing that my game could actually win the contest, I wasn’t sure how many games were there but for sure mine made it to the next round. Few more days later I received the most exciting news from them again! I have won one of the prizes, they didn’t tell me which, but I was suspecting it from the beginning! They asked me to travel to Austin, TX to showcase the game. I was really excited!! And I prepared myself for the presentation, the first time I rehearsed it was totally a fail! then I practiced a lot with my wife that supported me all the way from day 1! And then finally I flew there to Austin, a lot of exciting things happened there! Lot of stands were there with exciting technology and an awesome set of talks!

When the time came and we started rehearsing the real thing along with other winners and the presenters! The stage was imposing but exciting! And then we knew what was our place!

I WON the first prize on the gaming category!! It was an amazing feeling!! Knowing for sure that I was in the first place!! All the effort…worth it!

So I’m proud to say Tunnel Challenge won the price for the gaming category, maybe is not the next Flappy bird, but is definitely something that I’m proud of! and I’m excited to see it grow and put all the things I put aside to finish it on time!

Please go ahead and download it on Google Play:

https://play.google.com/store/apps/details?id=com.zylv3r.android.tunnelchallenge

It will be available on iOS and Windows Phone really soon!

Game Dev Tips: LeanTween for Unity

Last week I went to a very interesting set of presentations of topics related to Unity. One of the topic was given by the creator of one very good library for tween animations LeanTween. I really recommend this library because all the power that can be done with it. And also the most interesting feature of this library is the amazing performance compared to very similar libraries. There are a couple of libraries that do all these kind of effects but this one has a very good performance compared to its competitors. And it is free!

LeanTween – Unity Asset Store

Google App Engine in games

In my first post I talked about the interesting services that Amazon provides, in this one I’m going to talk about what Google has to offer.
Just as Amazon, Google offer a wide range of different services, but the there is a particular difference between the two of them, GAE (Google App Engine) has a “free” limit that you can use without using any kind of credit card or payment method. So you could publish an entire application without a single penny.

Right now I have an API for the Whack-a-mole game that stores the players scores. One advantage from the cloud that I will be using is that; since I will be testing this at the beginning and then decide if I will choose something different, like backend instances. GAE has a very interesting concept called backend instance. which is nothing more than an application running continuously waiting for a request (like a server). The difference between that and a typical application in GAE, is that the typical applications are sleep. and only run if there is a request. This is useful if your application is intended to work in this way. Since the game is not continuously communicating with the API (only when saving or getting scores). The typical application is perfect for me, because whenever a player wants to store their score an instance of the scripts will be initialized start the quota process the score and then die and stop counting toward the quota. So this keeps the quota low. Since I will not be continuously running the application. Also the typical application schema help me deciding at runtime how many instance I should be running to keep the experience smoothly. Which is something that I really want to keep encapsulated.

Thinking on this scenario:

A player initializes a request to the application to store an score, and by that time another player wants to store an score also, the application will simply initialize one instance for the first one, and then the second one will use the first instance of the application. If the first instance is too busy to process the subsequent requests it will initialize another instance of the application, in this case both instances will count towards the limits defined. But the free limits in GAE are fairly enough, because they have a free limit of 28 hours for a single instance running continuously, and that limit resets every day. So you can run 1 instance continuously the entire day and another instance for a couple of hours, you can see more about limit in this page: https://developers.google.com/appengine/docs/quotas

Hope this gives you an idea of how GAE can be used. Let me know any comments or ideas that you have.

First Post! – AWS

Today I was reading some articles on the Amazon site, these are about their web services, in other words cloud computing services. When I heard about cloud computing 5 years ago, I was thinking; why cloud computing? the web is on the cloud right? why are we going to use other approach for web?.

I was like; what cloud computing can offer us that is different than what we have right now?, well today after all those 5 years and after a lot of development work done, I can see why this is important, and what is out there that will help us develop more powerful systems.

AWS (Amazon Web Services) is a set of services that can be hired and will be very helpful when they are used with wisdom, I think the first and most important part of these services is the scalability.

For example if we develop a game that will be played just by three people, does it needs such a complex infrastructure?. At the first sight we could say: No!
But think more, what happens if you start with your own server, and then this game starts being popular, or better; viral. what happens when the game start lagging due so much players in it? well at this point you can buy more RAM, a better processor. But think! what is the first thing that you need to do in order to add this to your server?

Shut down! and this will not make your user happy right? they will need to log out and stop playing for that period of time. This is not good for the business. Maybe for three people is not that important, but imagine if your game is being played by 10,000 players at the same time, and you decide to increase the power of your server, this is a worst scenario.

But, with cloud computing you can stop thinking on this infrastructure. You can let IT professionals handle this for you. Now imagine that the same 10,000 players are very disgusted by the performance of your game, and this is because you have a Pentium III assigned to the game server. And you decide that you have the enough budget to buy a twice powerful processor. And you only say to the IT guys that you will pay for more processing power. And then magically those 10,000 players start playing the game more smoothly. And there was no downtime. This is very nice, don’t you think?

So cloud computing is a really good infrastructure. And there is more! another pillar of the cloud computing is storage. And this becomes more important when you want to deliver static content. Now imagine a MMORPG (Massive Multi-player Online Role Playing Game) that needs to deliver map content to several, let’s say a HUGE amount of players. And when this map is going to change? well let’s suppose that the map is going to remain the same forever (so boring!), but well… this is just an example, so supposing this we have this static map, we can split this map in several areas, done this we need deliver each part of this static content to players, and let’s add something interesting, this is only going to be delivered when they visit that specific area. So they only need that data, when they step into the area. But all the players needs this same content. We can deliver this with a CDN (Content Delivery Network), when we build such a good infrastructure we can achieve better game response. And also we are delegating the responsibility of deliver content to other entity, this reduces the processing of the main game server(s).

Well these are some of the benefits of cloud computing, and this is only my point of view, there are a lot of approaches and a lot of applications that can use these services better, but I’m going to be focusing on mobile game development.

And this is the end of my first post, I hope you enjoy the reading, and I’m here for any comments that you have. Thanks! Stay tuned!