Saturday, December 18, 2010

Squared Is Live

My second HTML5 game for the Mozilla Game dev contest is live on server.You can check it out at This game has two modes "CopyMode" and "FreeMode". The basic gameplay remains the same though. This was my first attempt at making a game with two different game modes. The code structure doesn't seem to be in a very good shape though. I've just used an if condition to make the rules come into play. It definitely was a fun exercise. I wanted to add another mode called "Reverse Mode" which is essentially a converse of "Free Mode" but didn't add it as i was travelling. I just hope people like this game, It's simple but iv'e tried my best to make it addictive.. :)

You can check the game on my gamedev website

Saturday, December 11, 2010

Importance Of Concept Art

Recently i've started drawing concepts for games before starting the actual code. If you think enough about the game play, you inevitably wind up with the most basic art that is required to represent the game. Case in point.. "Stardust" this is the game i made for pyweek. I was all set to do a standard platforming game when i started thinking may be its' time I try something different. I came up with the gameplay mechanic based on the gravity levels from "DeadSpace". I tried to visualize that 3D gameplay in 2D and what I ended up was the simple format. I started doodling in the Inkscape just to see what it would look like and that ended up to be the final look for the game. I never did this form of making a mockup before actually writing the game before, but im' glad I started doing it now. This gives me a better idea about how the game will look like and i have a better understanding about how to implement it. Here is another concept ive' drawn in M$paint brush in W7 .. the color scheme is the default colors that you find in that .. I just loved the color combination and used it. The game is called "Squared" and is one of the games im' going to post for the GameOn 2010 contest by Mozilla.

I'm done with the gameplay and scoring. I have to get the audio up and running. I've had complications using audio in JS while making "Stardust". But hopefully ill' be able to do a better job this time around. Have to start searching for audio and also the audio system code if it's available somewhere.

Sunday, October 03, 2010

FaceBook Integration

If you visit stardust game website, you will find a Facebook like this

I was thinking about working on a social network based game.. so what better place to start than at the good and not so old facebook. I started looking at the documentation and was able to figure out what has to be done in a few minutes and i have to attribute it to the documentation. It is really good, there are a lot of examples all along with the docs. Registering the app was very simple too (was kinda worried that it would be something like the apple app store kinda review process). If you want to integrate FB in your site, just go to and you will know what to do.

And as for the integration... i've integrated my stardust game with facebook as in.. you can brag about your achievements in game on facebook from the game itself (i.e, if you allow the application to). Check it out here,

Friday, September 24, 2010

PlayGroundSDK from PlayFirst

I wanted to try out the PlayGround sdk, so went to their website and tried to download it. Sure enough i was prompted to register and create a "Free Account" to download the SDK and the documentation. So like any normal sane person i tried to register.. guess what?.. I couldn't .. why you might ask.. well there was a "CAPTCHA" for making sure that people were registering rather than some bot i guess. So what's the problem you ask?.. I would say THAT is the problem.. why does everybody just use those twisted CAPTCHA which arent' very clear to even read for normal people? Any way i tried it like 50 times... and im' pretty sure i got it right a couple of times but the playfirst's servers refused to accept any of my attempts.. dejected and frustrated i started requesting my friends to try it out and see if they can get one account.. and somehow the audio CAPTCHA seems to have done it for them. For me not so much.. in those 50 times i tried.. (2-3 times was audio CAPTCHA). I guess i just had a very very very bad day.

For what' it's worth.. the SDK seems to be pretty good for like storing / tracking high score data across the world and a clean way to do it with just lua scripts. It's worth looking at even to just learn about the architecture of the framework.

Friday, September 17, 2010

Stardust (HTML5)

I always hated the javascript because of the browser incompatibility issues and so never bothered to do anything much with it other than making a silly menu navigation demo for a tutorial class.

Lately iv'e got interested in the whole WebGL movement with things like mozilla labs starting a gaming initiative and a game dev contest. Later i came across this website and realized i could probably make a resonable 2D game using the canvas element and javascript. Then i came across another gem, a whole freaking 2D game engine built around javascript and html5.

This gave me hope that i would actually be able to make a reasonable game using javascript. And guess what i wanted to port? .. My Pyweek11 entry stardust. I started reading about implementing classes in javascript and a little details here and there and finally go to writing the code. It was quite frustrating at first as some of the things like callbacks didn't quite work as i expected with member fucntions so i ended up using a lot of global variables. Any way i hacked and slashed my way through the random errors i was getting (mostly because i didn't bother to read into the details of javascript docs) and got the game up and running. It was an Interesting experience.
Here are the few Lessons I learnt:
  • Drawing filled shapes using ctx.* functions was more time consuming than just drawing images.
  • The callback functions apparently can't handle scoping well. So no member functions as call backs.
  • For some weird reason assigning a float value to variable and deducting it from another float made it into a NaN. (may be i messed bad but this is what i concluded).
  • Chrome has excellent debugging tools for javascript (breakpoints, profiling, stepin, etc) just amazing.
  • Use firefox to ensure that your code is right. Chrome was somehow ok with some errors in code.FireFox was the only way I could find them.
  • For max browser coverage use ".ogg" files instead of ".wav" for audio in your game/application (chrome doesn't support them).
  • There are extensive set of javascript libraries and tutorials available for just about any problem you might encounter at this stage.
So as you might expect i did run into some performance issues. I reduced/restricted the amount of particles that i created so that it would be good too look at yet have that flair. The blending functionality kinda requires you draw a rect and then the image for effect so i skipped different powerups and made just one powerup to blow all the enemies (this might change though).

Any way you can now.. "LAUNCH GAME" in your browser. enjoy.

Sunday, September 12, 2010

Punish The Player

Looks like people expect the game to "punish" i.e kill the user controlled character or restart a level when they screw up too many times. They want to "see" a loosing condition. I guess that's what brings in the challenge aspect in a game. For my entry in PyWeek11, I went for a smaller simpler game with better game play and it did pay off, I ended up third in the individual entries list . The one thing people complained about was the repetitiveness of the game. I didn't quite get what they meant, because every game does one thing repeatedly.. in a shooter game you shoot, in a puzzle game you solve puzzles. But the major factor for them getting bored was the game didn't quite challenge them.Picking up enemies did effect their score but that was second nature. It didn't effect what they were doing which in turn made the game boring too soon. So I guess it's a good thing to "kill" the user when he/she commits too many mistakes. I think ill' keep this in mind and may be add this to the stardust game as well.

Friday, September 10, 2010


I've never worked on improving any of my pyweek games before. This is the first time im' doing it mostly because i'm not satisfied with what i've put together in the two days i worked during the contest. Any way after a few rounds of feedback, i've added another enemy type to make it a little more interesting. Improved the medal requirements and added the ability to pause the game :D.
Press escape to pause and you will see the pause menu. Once in pause menu, if you press esc again it will quit but if you just click (mouse) then it will resume. Also remember that you can make new patterns using "" available along with the source code. as you can see.. the pause menu is pretty simple and to the point. You can grab the latest executable version from project site

Wednesday, September 01, 2010

pyglet + py2exe

If you want to distribute a python program (game or just plain script) as an exe for windows, there is a nifty library/set of tools called py2exe. This enables you to easily create an exe from your python programs. Here is the list of files you have to ship along with the exe if you are using pyglet library in your program:
package these along with the stuff get in the dist folder and you will be good to go on any windows system :)

Thursday, August 26, 2010

PyWeek as Py48

For the pyweek11 i wasn't sure if i should register because i thought it might be hard to find time to complete a game. After a lot of thought I did register. Just before the contest started, I had to work a little extra at the office, get some stuff done as a result I lost the first 2 days of the pyweek. Just when i thought i had the rest of the week (5days) for completing.. i was required/requested to travel. So i quickly decided on a simple game mechanic that i wanted to implement and started working on "StarDust".

Just after 2 days of work on the game, it looks pretty good. Im' glad i settled for a simple game mechanic and concentrated on getting the things work right. Im' really amazed that i could complete this game in just 2 days. Oh well just have a look and see for your self :D
Game Features:
  • Achievements tracking
  • High Score tracking
  • Beautifully animated Patterns for waves of stars.
  • Simple Mouse based Controls.
  • Editor to create new Patterns (easy to load them just copy to data folder)
The screens don't actually do justice to the games fluid particle animations. You can download the game and have a look.

Monday, August 09, 2010

Updating Plugins from Blender4.9 to Blender5.3

Blender5.3 is the new beta version of the awesome 3d authoring tool. I've been skeptical about using it as it had changed some of the shortcut keys etc. I didn't want to make the jump to Blender5.3 yet but after taking a look at the latest version i was impressed by the ui changes. I decided that it would be nice to switch to 5.3 and try it out for creating art assets during the upcoming pyweek. So i started playing around with blender5.3 creating simple models, animations etc and decided that its' time to start porting the anim3d. The moment i started looking at the export scripts for other formats, all hell broke loose.. i was confused disoriented and frustrated with the lack of proper documentation for getting the information i needed to spit out the 3danim format that i designed. That is when i looked at the "python code sniplets" just a glance at this book and i was able to move ahead a lot in coding the exporter script. Right now only the key frame vertices are missing. I'll be working on this and hopefully will be done by the end of today. If you haven't already done it.. Please do check out blender 5.3 its' really nice..

update1: Finally got the python export script ported to 5.3 :). The output generated needs to be tested. Most probably it will work but i still have doubts. you can grab it from here .

Friday, August 06, 2010

New patches for Old Code

If you have tried using Pencil with mouse on your pc, you will have discovered that the pan and zoom features are not accessible in an intuitive way.. i.e they are not the same as you see on gimp or any other image editor.
"ctrl + wheel up" = zoom in
"ctrl + wheel down" = zoom out
"middle button + drag" = pan
So ive' made a patch to fix this problem. I also made a patch to fix the compilation issues on linux + some bugs in the old_code branch for Pencil. You can access these patches here:
Pan and Zoom with mouse
Bug Fix, Build Fix

Monday, July 12, 2010

Patch for Pencil

If you have read my previous post you already know what Pencil is all about. When i saw that it was developed in Qt I got really interested in having a look at the source code. Lucky for me the source code was pretty clean and since i already have good experience with Qt I was able to figure out the bits and pieces. So one of the Items on user requested features was "duplicate frames" As this is a traditional drawing software, drawing frames which are pretty close to each other is very common and duplicating the frames feature helps a lot in reducing the time for completing the task at hand. So I thought it would be a nice feature to implement. Im' done with the code, iv'e tested it and to the best of my knowledge it works well. So if you want to try it out grab the source code patch from here

Ps: this patch is to be applied on the source code available in the trunk. I've not put a good icon for the operation yet. This is how it looks right now...
And just for the kicks.. here is another animation i made using Pencil tool

Saturday, July 10, 2010


I've been trying to do traditional animation based on the tutorials at
All was fine but i wondered if there was a software which would help me make the animation on the computer just like i would do on a sheet of paper. One google and 5 minutes later.. i found a slick lightweight tool for making animations. I've been tinkering around with the software and have made a couple of small animations.

Btw.. you can create a gif from a sequence of images using convert command.
"convert -adjoin animcyl00?.jpg cylinder.gif" where.. animcyl00?.jpg refers to the image sequence and cylinder.gif is the output file.

Sunday, May 23, 2010

Yet Another Discovery (OpenGL2.0)

Adrian has been receiving a face lift with fancy glsl opengl stuff. Now I've seen good number of problems with using the GLSL shaders. But what i found today was a little more annoying. So today i thought i'd update the display drivers to a latest version because its' been a while and it's always good to have the latest ones... because all the other users might be using them. Now Adrian which was working fine starting showing a colored screen instead of the actual game, I was shocked because i haven't changed anything but a working code stopped working now.

Apparently iv'e assumed something that i shouldn't have.. see.. the vertex shader that we use has a line which goes something like this:
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
This looks fine.. if we dont' set the texture matrix, it should ideally be and identity matrix .. or so i thought. Any way... Now .. after digging through all the code.. making modifications everywhere i could think off.. I finally figured .. i just had to get rid of the gl_TextureMatrix[0].. from the above line. Now i know i shouldn't be using it if im' not initializing it.. but cmon!! it worked before what happened now?. Is it defined somewhere that the default texture matrix is not ensured to be an Identity matrix?..

Sunday, May 09, 2010


I know OpenGL2.0 has been out for a while now and i have been developing small example programs for learning purpose, But I've been putting off developing using OpenGL2.0 (GLSL) etc because I wasn't sure if people would be able to play them because of hardware issues. I wanted to develop a game which used OpenGL2.0 features. I wanted to try it out for Last PyWeek but most of the people participating did not have compatible graphics hardware so i scraped that idea. But after having looked at a couple of game engine related blog posts at, I decided i have to write a game with Graphics Engine using GLSL shaders.

So Instead of writing from scratch, I thought it would be best if I tried out on an already developed game and "Adrian" was the obvious choice. We have been updating the game since last year during our free time (yes.... this isn't a solo effort... ) and so updating graphics engine came up. I wanted to start small and so started off with the implementation of Post-Processing pipeline for the game engine. Here are the results..

You can Grab Source Code at
You can Follow Adrian Dev Blog

Toon Shading

Depth Of Field (well kinda)

Bloom (My Fav)
Normal Rendering

hope you like it :D Im' totally excited about this.. keep tracking for further updates ..

Saturday, May 08, 2010

Minute Mistakes Franatic Frustration

I've been working on updating our good old game "Adrian". Trying to update the graphics engine to use shaders, frame buffers and all that stuff. Actually the other day i found a wonderful game dev blog which discussed various graphics engine tweaks, implementations etc. I've been eager to work on something with shaders.. thought Adrian might be the best bet. So i quickly started writing some basic code for handling multiple pass rendering and some basic code for handling frame buffer objects etc. I've read a lot about glsl .. even done some examples (simple ones) before so i did not think it would hard to get stuff running.. boy was i wrong.. I struggled to get multiple textures to work in my shaders.. and the reason?.. well let me put it in code...
//vertex shader
void main()
gl_Position = ftransform();
gl_TexCoord[0] = gl_MultiTexcoord0;

//fragment shader
uniform sampler2D tex0;
uniform sampler2D tex1;
void main()
gl_FragColor = texture2D(tex0, gl_TexCooord[0].st) * texture2D(tex1, glTexCoord[0].st);
Looks simple right?? now how do you send / bind the uniform variables to two different textures from host program??
glBindTexture(GL_TEXTURE_2D, tex0_id);
glBindTexture(GL_TEXTURE_2D, tex1_id);

GLint h0 = glGetUniformLocation(program, "tex0");
glUniform1i(h0, 0);
GLint h1 = glGetUniformLocation(program, "tex1");
glUniform1i(h1, 1);

now the most obscure stuff is setting the sampler handle values to 0, 1, .. corresponding to the texture you bind it to..(GL_TEXTURE0, 1.. ) instead of the texture id itself.. and now most ridiculously frustrating part.. you need to call glUseProgram(program) before you can set these variables. Most people got the other stuff wrong.. but i was stuck with this problem for like 12hrs or so... actually i just figured out about this problem and thought i should document it somewhere before i forget it again.. so there you go.. if you want to tread in the glsl waters.. you better be careful.. they are very .very.. weird.. :D

Sunday, April 25, 2010

InkScape As Level Editor

I have been working on creating a simple game engine for 2D games which would use pymunk (chipmunk) 2D physics engine and currently undecided tool kit for windowing. I was working on creating a simple loader for loading info from the svg file to create game objects. I have done this successfully you can see the code at

It's a no brainer that we have to add the meta data required for game engine to the objects in svg file, but adding all that Game Engine related info to the SVG objects can be a little tedious.. esp if you want to have many objects in a level. So I've been trying to look at making it a little less painful.. guess what.. inkscape extensions are pretty awesome for doing just that. I quickly put together a simple inx file which inkscape uses for creating gui for the extensions. Im' pretty excited about this now.. Really cool..

.. i have been trying to get the extension to work but for some weird reason it wouldn't... so guess what.. i just copied an extension which was already there.. and started editing it to make it mine :) ... and it worked!! oh well.. guess i missed something really trivial.. but its' working now and is up in the code base.. next i have to think about how to get the model info in there. for separating out rendering from the other stuff..

Friday, April 16, 2010

Slider Puzzle

After CubePuzzle, i wanted to make another puzzle game just for the heck of it. I thought for a while and came up with a simple puzzle game. I started off coding it in glut and called it BallPuzzle (not very creative) .. coz the game was to have a ball that would just keep falling down unless you made sure that there was a block stopping it from falling down. Since glut already has functions for drawing spheres and cubes, and because I remember the glut functions better.. i coded it using glut lib. But to make it presentable i switched to SDL, and the GLui i implemented for CubePuzzle. After about 4-5 hrs of porting and polishing .. I uploaded the Src and Binary (both linux and windows)

Mean while i wanted to see if i could use Blender to create a python game. i.e, create all the logic etc inside blender like we do for BGE but output objects/files so that we can run the game using python. Turns out we can't access the GameLogic api when trying to export files. So im' planning on writing a script which will be run through the BGE. Ill' have to keep all the scripts dependent on one global variable which will be set only when trying to run through python. The idea was to use Blender as a Level Designer, but adding the above feature will take it one step ahead and will probably be pretty good. Still have to figure out a lot of things.

Monday, April 05, 2010


After ive' worked on developing a couple of puzzle games, i've started getting this weird idea that it would be nice to integrate these small puzzle games into some kind of adventure game, where solving the puzzle opens a door/passage etc. I was also thinking about how to dynamically generate a road for a racing game or just a track kinda thing. So when i saw the pyweek10 announcement.. i jumped on.. i wasn't sure if i'd be able to make time to complete my entry but i managed to pull some night outs and completed it in about 4 days or so.

The themes this time were "Eleven", "Rose", "Wibbly-Wobble", "Canine" and "ScrewDriver" check out the actual stats here. As soon as these themes, i started thinking about what features i wanted to implement in the game and i also had to think about a story which would use/include all the mentioned themes. Here are the features i wanted to have at first.
  • Use the 3danim experience i.e, use the new keyframe animation format i have created.
  • Make the game in 3D
  • No Side Scrolling platformer.
  • Have to be something different.
well have to be something different isn't as easy as it sounds.. because every idea that kept dawning on me had been done before.. so finally i settled for a 3d platformer kind of thing. This was very straight forward for me, i just had to have a map rendering and everything else would just fall in place oh and i wanted to use absolute values of xyz instead of having to calculate the relative coords from world coords etc to avoid confusion.

The first thing i started working on was to port the 3danim code to python from c. This was easier than i thought and once i got the basic model loading and rendering done in python, i knew i was going to complete the game with what ever requirements i had in mind.

Almost 3 days into the competition, i realized there wasn't enough flair / awe factor in the game i had created.. to keep pushing the player to complete the game. I knew i had to put in some thing unique in there to make it stand out.. i wasn't happy with the way the game play varied. While thinking on those lines, i came across an interesting piece of documentation in pyglet, which said we can save a screenshot of the rendering.. .. that was it.. it sparked a whole puzzle game idea thing, where you had to solve 5 puzzles to win the game. So i quickly put together the code for a simple jigsaw puzzle in a separate python file and later integrated it into the main game.

I enjoyed this part because it was the first time i tried anything like this. I quickly created a bouncy block to indicate that this is something to catch/ pickup and launched the puzzle game as soon as the user touches it.
Though i did not get time to polish the game to the extent i wanted to.. the 3d platforming part looks pretty and the puzzle gameplay works. I just hope people enjoy playing the game. :)

Sunday, March 14, 2010

Linux binary Finally!!!

Long time ago... when people made money porting games to linux.. i came across an article about how to create a universal executable for linux. That is an interesting thing because you never know what the end users' system has installed and which of the libraries that you need are missing.

The article offers three solutions.. out of which i decided to go ahead with the third method.. Here is the article if you would like to have a look

Definitely a good read... if you would like to develop applications for linux and deploy them on large number of systems.

If you are wondering why the hell im' posting this now??... after all these years??.. well remember the Cube Puzzle game??.. it was available for windows as a binary but not for linux.. the source was out there.. but thats' not fair.. so today i decided and made the linux binary for the game. Grab it from .
As you can see above, you can just double click on the .. you will be prompted with this message box you see above, click "run" and the game runs :)

The binary was created on a ubuntu 9.04 machine and has been tested on a fedora12 machine.. and it worked.. im' guessing it should work for any other distro :) Please do note that this is just a 32 bit executable.

The one disappointment i still have is that i couldn't figure out how to set an icon for the game launcher script... oh well i guess that will just have to wait a little longer :)

Next is what?

So the other day one of my friends asked me if i could help him guide a team of artists and developers to get a game done. .. so i wrote a small write up for how the game should be.. essentially a requirements' specification doc for a game. Have to see how that works out .. :)

Meanwhile .. ive' been working rarely/sparsely on it and haven't made much progress. Mostly because ive' been busy with writing the above doc :) .. but thats' just an excuse.. i've been getting stuck at various stages as in how to implement the rotation of the puzzle etc. During the development of CubePuzzle for the pc ive' taken some liberties implementing it without proper structure etc, I wanted to change that this time and wanted to do it better.. .hopefully ill' come up with something which is easy to manage and doesn't look outright devilish... :)

Sunday, February 14, 2010

Cube Puzzle

So i've been hard at work polishing the prototype that i had created a few months ago for an iphone game. It is finally in a presentable state, There may be a couple of issues still hanging around, but hopefully they are not bad enough to ruin the experience.

It is a simple puzzle game where you rotate layers of cubes in such a way that no two cube in two different layers overlap. Sounds simple right? well try it out and see.. :) We call it "NooBix" a simplified Rubix .. but don't be fooled.. it could get pretty tough at times.
Grab the system independent Source code or The windows executable.. from

Hope you like it..

If the game is crashing on your system, you should install vc++ 8 redistributable package

Monday, February 08, 2010

Setting Icon for Win32 Console Applications

Here is a scenario..
  • You create an application with Visual Studio Express 2008 (or some other express thing)
  • You created a win32 console application (so that you dont' have to deal with win32 api)
  • You want to set a custom icon for your app (instead of the generic .exe icon that shows up)
Sounds Simple right, but took me a while to figure out the solution, but as it turns out is pretty easy to do. Here are the steps you have to follow
  • Add a new (.rc) file to project (empty file)
  • add the following line to the .rc file you just added to the project
  • Copy the customicon.ico file to source code directory of the project.
  • Build your application just like you would normally. (using the menu options in VC Express)
  • Check the .exe created in the release/debug folder based on your configuration.
Well i tried to put it as simple as i could, Hope you found this useful, here are the links which helped me figure out how its' done .. just in case you dont' understand what i wrote here..