Friday, August 15, 2008

Freebase Parallax - The future of Web

Hey guys, I found this amazing project called Freebase parallax which if works as the video promotes, its gonna change the meaning of search engines. It will be the beginning of a new era of internet. Have a look at this video:


Freebase Parallax: A new way to browse and explore data from David Huynh on Vimeo.

This concept will be based on the idea of considering the data not as mere text but as objects with its properties and methods. These properties of different objects can be compared to make real-time analysis, graphical representations and form basic clustering. This project is still under alpha. We all will be waiting for it to be available for general usage, and the dawn of the new generation of internet, maybe Internet 2.0

Tuesday, July 29, 2008

Software Engineered

Yesterday, I launched my fourth blog and first official public blog: Software Engineered. Here I've quoted some of the details of the blog:

What this Blog is:

  • a place filled with positive sarcasm and jokes
  • closely relate to the life of a software engineer in a fun way.
  • support for an employee to make the life of his employer miserable
  • eyeopening patterns followed in the organisation to ruin developers life
  • comparisons of college education and organisations work
  • and a lot of similar stuff

What this Blog isn’t

  • its not a blog with discussion on techinical stuff
  • no political or economical issues’ discussions
  • no educational articles
  • no hacking tips and tricks
  • no mergers and acquisitions of brands
  • and no bad/abusive language usuage

Sunday, July 27, 2008

One step ahead

Yeah, I cleared the code jam round 1 too. This time not with a good rank though(724), ya a small silly mistake cost me 15 points and around 400 ranks drop. Hopefully I'll do better in round 2, coz next time there will be less than half the people going through it.

Friday, July 18, 2008

Google Code Jam 08

This year Google Code Jam started day before yesterday (16th of July), for me it was yesterday. It was organised in a bit different way, usually they used to sponsor the contest as a event on Topcoder and contestants used their arena to develop the code. This time they applied a new approach and a better one. They opened the contest for all languages and was compiler independent. We were supposed to download input generate the output and upload it along with the source code file. So on 16th was the qualification round, 24 hr long event with 3 problems. The person submitting one solution correct was to be promoted to the next level.

Each question had two input sets: small and large. The output of small was evaluated instantly and the result was displayed. The output for large data set was submitted and the result was announced after the event.

So in all it worked out well, and yes I have qualified for the online round 1 too, with a full score of 75 and world ranking 336 :) Lets see what happens in the rounds ahead.

Wednesday, July 16, 2008

Launching hairyhi.info

Hey everyone, today I am officially announcing the launch of my new site hairyhi.info. Its displays my profile. So go ahead and check out the site if you want to know more bout me. It uses a beautiful accordian and has cool javascript effects. Its a better and updated version of my last site which still exist at ankit-jain.info.

Wednesday, July 2, 2008

Browser Based games III

Yes, I actually managed to write the third version of my browser based games tutorials. Today I am going to discuss the second type of browser games: small Animation games. Like I discussed last time, small animations games are like tetris, frogger, bricks which require moving objects but very less AI and have static backgrounds. These games require a lot of memory space to store the position and status of various objects along with the objects' properties.

There are a few points that one can consider while planning the game for development:
  • Firstly, examine the game very carefully and be very clear with all the rules/ instructions of the game to be developed. This will help you decide the data structures to be used. Usually most of the data is stored in javascript Arrays. So, we need to be very careful while designing the game to optimise the utilisation of memory (try to use minimum memory space and use local variables as much as possible)
  • The idea behind using Arrays is to find patterns among the objects. For example, the image objects in the frogger game which move along the road can be stored in the arrays. By finding the right quantity of those objects we can define the size of the array. By deleting the old objects which have crossed the screen and inserting new objects in those places. Similarly.. we could store the empty and filled spaces of the screen in an array in the game of Bricks.
  • Moving the objects is fairly simple now.. if we have a constant speed, we could just move objects by using a set interval command, and calling a function which moves all objects on the screen.
    timer=setInterval("functionName()",50);//This function is called periodically after aevery 50 ms.
    function funtionName()
    {
    for(i=0;i<size;i++)
    arr[i].style.left=parseInt(arr[i].style.left)+moveRight;
    }
  • This will move the array objects to the right by moveRight pixels every 50 ms. If you have to move both ways.. u might need an array to store a boolean value indicating left or right. and move accordingly.
  • Similarly to detect collision both the objects coordinates have to be matched. Generally all objects could be considered as rectangles and hence they could be checked for their areas of intersection by their end points easily.
I think rest is dependent on your imagination and creativity. Just try to make game as light as possible (in complexity and memory used).. so that it could be played on low end systems as well.

Tuesday, June 24, 2008

Browser Based Games II

I am back with the second edition of how to develop browser based games. If you haven't read the first volume, please do it before reading this one. It will help you to understand this one.

Alright, so as I told in my previous post that there are several types of browser based games. But like last time I'll be talking about the Javascript games which are visually appealing and help you understand on how to build a game.

To start with, we first need the structure of the game. I would broadly classify the games into three categories: board games (very less animations required but high AI requirements), minor animation games (these are games like frogger, bricks, tetris where we have minor animations and have static backgrounds) and complex games (like pinball, snooker, tanks where we need to apply the collision mechanisms, trace the paths of the objects and can also have moving backgrounds plus these might require a lot of AI too).

The board games are like casino games(blackjack, slots, roulette, etc) where the main aim is to develop a proper game play mechanism, defined on a set of rules which are hard coded into the program. For instance if we are to develop the blackjack game, we know certain rules that blackjack pays 3 to 2, insurance pays 2 to 1, etc. These rules can be laid down in form of JavaScript functions which calculate the final value of a variable (Score) based on these parameters and these functions are trigger when the respective conditions occur.

AI part might be required in a multiplayer game where the opponents are all bots. For instance a game like texas hold'em poker, where we need to figure out certain parameters based the values of which the bot makes his move. These rules can be designed by carefully observing a real game play. You can figure out certain limits which define the responses of a player, and code them to create a bot player for your game.

Oh and yes, the random part like finding a card out of the deck can be done in this fashion:
function Shuffle(max){
var num=Math.random()*max;
return Math.round(num);
}
This Shuffle function would return a no. lying between 0 and max inclusive. So if you have to pick a card use the following to obtain the suit as well as cardno.:
funtion getCard()
{
var cardno=Shuffle(12)+1;
var suit=Shuffle(3)+1;
}
Where each no. from 1 to 4 can represent a suit for the card. Also for the minor animations I use this function, though it was specifically made for movement in right to left direction, but with minor tweaks, one can adjust it to work both ways:
function Animate()
{
the_style=Img.style;
the_style.left = parseFloat(the_style.left) + movLeft;
the_style.top = parseFloat(the_style.top) + movTop;
if(parseInt(the_style.top)>=lastTop&&parseInt(the_style.left)<=lastLeft&&splitting==0) { the_style.left=lastLeft; the_style.top=lastTop; animating=0; eval(afterAnim); return; } if(parseInt(the_style.top)<=lastTop&&parseInt(the_style.left)<=lastLeft&&splitting==1) { the_style.left=lastLeft; the_style.top=lastTop; animating=0; eval(afterAnim); return; } if(parseInt(the_style.top)<=lastTop&&parseInt(the_style.left)>=lastLeft&&splitting==2)
{
the_style.left=lastLeft; the_style.top=lastTop; animating=0; eval(afterAnim);
return;
}
setTimeout("Animate()",10);
}
Well that's it for this time, I'll dicuss the other 2 types of games next time.