Sunday, April 27, 2008

The tech guru - I got to decide!

Yesterday, I was watching a video on World's Most Powerful person in the world. So I thought why not let me decide who's the actual tech guru of all time. I'll firstly list three most eminent personalities as the nominees : Steve Jobs (Apple Inc), Bill Gates (Microsoft Inc) and Larry Page and Sergey Brin (Google Inc). So I'll describe their achievements one by one and will discuss why they should be the tech guru of all times.

Starting with Bill Gates, born in Oct, 1955 is the chairman of Microsoft. I won't go much in detail which one could find anywhere, but would go straight to the point where he established Microsoft. It was the launch of Intel 8080 micorprocessor, which was the cheapest microprocessor in market which could run BASIC to be used for a PC. So at that moment he founded Microsoft with Paul Allen. Second faming moment was when they cracked a deal with IBM and delivered them the PC-DOS (which was a customised Q-DOS) and retained the rights of later known as MS-DOS. These two things laid the base for the software giant Microsoft, which is today known for its Windows operating system, whose base was obviously DOS.

Next we have Steve Jobs, chairman of Apple Inc (formerly known as Apple Computers) though has not been dedicated to one company throughout his whole life, but has been really successful. His ideas has changed the world. Apple was one of the companies that brought in the idea of commercial mouse-driven UIs. I have also always been a fan of Apple's designs and GUIs for example its Leapord's and iphone's UI. When Steve Jobs had to leave Apple Computers, he acquired and expanded Pixar Animation Studios. Later he joined back Apple as the CEO, he has never looked back since then. His works has always shown enormous creativity and forward thinking approach whether it may be Apple's Mac OS X, iPhone or Pixar's Finding Nemo, Cars, Monsters Inc, Incredibles.

Then we have Larry Page and Sergey Brin founders of Google Inc the search engine giant which revolutionised the internet. The Google's story is very famous and known to everyone, I won't discuss all the things here. The PhD scholars started the search engine(code named Backrub) as their PhD project, and tried to sell it to a few companies, disheartened started their own company. And finally they were lucky enough to get enough funds to run their business successfully. What I like bout the company is their new approach to solve problems by providing very friendly environment to the employees and their 20% projects to bring out the innovation.

So finally is the decision time, so what do you think should be crowned the tech guru of all times. Well I guess the tech guru position can not be assigned straight forward. Rather I would say that we can divide it in two parts: the Innovator and the Developers. The Innovator should be Steve Jobs, who through his creativity, innovation and forward thinking, has changed the world and will keep on doing in the years to come. Then we have the developers Guru who should be Larry Page and Sergey Brin or being the central attraction for the developers world wide and for providing such a platform for them.

Also last but not the least Bill Gates, the chairman of Microsoft is not among the tech guru but for me he's the biggest of the Entrepreneur in the software world. making such good decisions in the whole life has made him the richest man for over a decade. He has helped bring out PC with its Windows which still runs on more than half of the world's personal computers and has also provided many large software products for people of every domain.

Sunday, April 6, 2008

Browser Based Games

The browser based games is a very interesting and still fairly unknown topic in the development world today. I have been recently involved in developing a lot of browser based games with a lot of graphics and flash-like looks and feel. Though I know the idea was not wholely mine, it was of one of the projects that I received. It was to develop a browser based game that could work on the safari browser on an iPhone. Probably it was one of the initial games developed for iPhones, coz i started the development in the second week of the launch of the iPhone. Since then, I have developed over 6 decent iPhone games.

Back to the topic, Browser Based Games. These games can be categorised in two: Text based games(usually multiplayer online games) and Graphics based games (usually single player online/offline games). The text based games maybe Role Playing Games(RPG) which are sometimes graphics based also ( a few examples can be sited at heavygames.com, rpggames4free.com) or Multiplayer online games(MPOG) like themafiaboss.com or mobsterlords.com(I have even worked for this game). The Graphics based games are quite different from these games in the context that they are usually single player and are usually Javascript based client side games and include board games, card games and sports games. The games that I have developed are also Javascript based, so I'll focusing on development of these games only.

The essence of developing these graphics lies in using javascript efficiently and effectively. As most of you might be knowing javascript is a client side language which is though very simple but has a vast potential. To develop these browser based games, usually we follow the following steps:
  • Firstly, we design all the graphics of the games in parts, i.e., if we are developing a card game, we would first design all the cards, table, buttons separately (jpgs or gifs) so that they could be used as objects and can move around (animate) of required.
  • Next we design the the basic layout of the game in HTML. This layout includes different screens and the proper placement of the respective objects on the screen. Usually there are around3-4 screens, for instance the games I develop have atleast 4 screens: The Loading screen(where I show the loading bar while all the images are loaded), The Menu Screen (where all the buttons to navigate around the game lies), The interstitial screen (can be an advertisement or a instructions of playing the game) and the Main Gaming screen. I align these screens widthwise(left to right) such that I hide all other screens by inserting these screens inside a DIV tag of size of one screen with a style attribute : overflow:hidden which hides all the other layers. Then during game play, I animate the screens around to fit in that DIV to be visible.
  • Preloading of all the images to be used in a game is very important to give a good visual appeal to the game. If the images are loaded at the time of game play, it appears to provide jerkiness to the game. Script for preloading the images and preloading bar can be found on a lot of javascript reference sites. So I'll skip that part.
  • Next comes the event triggered motion part. Usually all the buttons work in the same way, to trigger a javascript function from the button image or an anchor tag, we can use the following code:
<img src="http://www.blogger.com/images/button.gif" onclick="JSfunctionName()" />
<a onclick="JSfunctionName()">Click Here</a>

  • Alright that goes for the most of the work. The only main thing left now is the animation is displaying results and scores. Both of the things are accomplished by using the DOM structure of Javascript. To select a DIV or an IMG we can use the code:
    ele=document.getElementById("IdOfTheTag")
    This element class can then be used to insert text in it by using ele.innerHTML or can be moved around by using ele.style.left, ele.style.top . One thing to note is that to animate the elements we need to define the position first by using ele.style.position="relative" or "absolute"
  • For animating the objects we call a function at regular intervals which move the objects a few pixels everytime. We can use
timer=setInterval("fnname()",timeinMilliSeconds)
timer-setTimeout("fnname()",timeinMilliSeconds)
  • And these timers can be reset by using
clearInterval(timer)
clearTimeout(timer)
I guess thats it for now, you can atleast start developing some games with these things in mind. I'll discuss some more facts and tweaks for getting hands on advanced graphics games development later. Till then try developing your own games and remember the first game which you develop would be the hardest, but once you start getting into the groove, you will really love developing these games.