304 Forever.

I’m back from my military trainings and ready (besides my horrific throat and cold that I’m bearing for two months) to resume work on my game. While being there I tried and did my best to not to let time get wasted and tried to think about my bugs (mainly my states bug) and did some great brainstormings with my comrad Faham, tnx dude.

I also read some GamaSutra articles, some Wired and Game Developer Magazine (tnx to Arash jan), I also read the book Kim Woo-Choong wrote in 1992 on how he brought Daewoo from a 20-man company to an international group called Every Street is Paved With Gold which I cannot emphasize enough on how great this book is.

I also experiences new situations, mostly hard ones, during this training period which I mainly found useful, besides some extreme ones that I don’t feel were necessary. Hope I can defend my country and payback what is due when she is in need. I also was lucky enough to find some new friends that I hope can continue friendship in future, it’s always good to have human contact beside your regular Charles, Marcee and Parcher, if your mind is beautiful enough of course.

304 Forever.

More Pythoning!

So, as my friend requested, I change the program to meet his more advance requirements. See if you can understand what this program does!

#    Duplicates some certain lines in the input file starting with “DFFR_X1″

import sys

#opening file

whatToDetect = sys.argv[1]
inputFileArg = sys.argv[2]
outputFileArg = sys.argv[3]

#whatToDetect = ”  Z”
#inputFileArg = “input.txt”
#outputFileArg = “output.txt”

inputFileObj = open(inputFileArg, ‘r’)
ouputFileObj = open(outputFileArg, ‘w’)

numOfDuplicates = 0

if len(whatToDetect) == 0 :
print “No pattern to match was given.”

print “Lenght of input is “,len(whatToDetect)

arrayOfLinesToBeCopied = []
#print arrayOfLinesToBeCopied[0]

try :
for currentLine in inputFileObj:
print currentLine + ” for”
if currentLine[0 : len(whatToDetect)] == whatToDetect:
arrayOfLinesToBeCopied.append( currentLine )
while not “;” in currentLine :
print currentLine + ” while”
print “appending”
currentLine = inputFileObj.next()
arrayOfLinesToBeCopied.append( currentLine )
else :
arrayOfLinesToBeCopied.append( currentLine )
for i in range (2) :
print range(0, len(arrayOfLinesToBeCopied))
for i in range(0, len(arrayOfLinesToBeCopied) – 1) :
print i
#print arrayOfLinesToBeCopied[i]

arrayOfLinesToBeCopied = []
#print “-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-”
except (IOError), exc :
raise CustomError(‘something went wrong’)


print “Number of duplicates was “,numOfDuplicates

Example of Python.

Oh, how great Python is. It always amazes me how much one can do with such scripting tool. I just wrote a simple program for a friend that searches the input text file for a given a pattern an writes that twice to the output it finds it, if not, just once.

I’m posting it here for people to see how easy it is to get input args and string comparison and even simple exception handilng:

#    Duplicates some certain lines in the input file starting with “DFFR_X1”

import sys

#opening file

whatToDetect = sys.argv[1]
inputFileArg = sys.argv[2]
outputFileArg = sys.argv[3]

inputFileObj = open(inputFileArg, ‘r’)
ouputFileObj = open(outputFileArg, ‘w’)

numOfDuplicates = 0

if len(whatToDetect) == 0:
print(“No pattern to match was given.”)

print(“Lenght of input is “,len(whatToDetect))

for line in inputFileObj:
if line[0:len(whatToDetect)] == whatToDetect:
numOfDuplicates = numOfDuplicates + 1
except IOError as exc:
raise CustomError(‘something went wrong’) from exc


print (“Number of duplicates was “,numOfDuplicates)

Silence of The Mice.

So, last time I went to NLAI to work on my game, in knee deep in the guts and blood of bugs and fails, someone tapped me and jumped me out of my chair to “mention” out of his, let’s just forgive him, nervous system that apparently I can’t bring mouse into the reading chambers. I told him honestly that my touchpad is broken (it is not but using it even for two clicks will give me pain in the thumb for the whole week that’s because I extensively used it in past years) and he nodded just as I expected from as bright as he is.

So, I went home afterwards to search for any quite mouse that I can find. There were some but that mostly would need me “going out” (people! oh people! they are dangerous!) and involving in traffic and waste of time and asking lots of remarkable “yesterday Sheppard, today computer salesman” about this matter, which I honestly avoided during past 6 years.

So I asked my Hardware genius, Massoud, about the matter. Whom if he was not helping Intel making better processors, would be help me hand in hand in this matter. So as he could do best from miles away, he found a nice article about how to quite a mouse. As some of you might know, I rather to lots of nasty things in order not to solder things, being a software guy. Even though all of my experience I remember doing soldering were successful (not in your terms, but mine), even that A Link To The Past GBA cartridge that took me a whole week to fixed for Hossein PeaCe that he broke kindly after 5minutes of returning it to him, I still tried to avoid soldering for this matter.

So knowing that I was not gonna solder things, I tried working with the touchpad, see if my old injuries are healed. It was just to my surprise that 10 clicks with this devil button and I have my pain back. Nice. So I went “idn way” and tried to invent a little during the journey. I don’t like hardware and also don’t like to talk about how switches in mice work and what causes the sound, I just want to mention that I could do the trick without soldering, I did it in place. I must admit that it was not an easy task, it requires even more nimbler fingers than mine and a nervous system made of steel.

There were times that I was just about to rip the mouse and break it into the screen and go gardening in a far far farm near a railroad, but what I was needed was a quite episode of The Return of Sherlock Holmes with a cup of tea in 5am.

So here we are, after 2 days of nerve breaking work, a quite down mice.

I must admit that I didn’t touch the wheel’s click since it’s almost impossible to deal with it without soldering and the work is not “clear” as some people do, but that’s just me any my “ways”.

Friends …

Behzad & idn ...
This a small screenshot from our game showing a secret feature that I’ll not talk about until it finishes.


I love it so much I saved it in BMP, sorry dudes.

Life of an XNA Game

One of my concerns with XNA was that I could not find in which order it’s inner methods are called. As you may be interested or aware, XNA has some inner method calls, like Initialize for its Game component and so on. Even though I’m still struggling to understand the secrets behind most of it, I found this blog post to be very useful. It’s from a very kind and cool person named Nick Gravelyn which I recently discovered via their boards who also published some nice tutorials on the subject.

If you don’t want to read the post, just take a look at the diagram here:

Xna Game Flow
Xna Game Flow

تا کی

در پيله تا به كي بر خويشتن تني؟
ـ پرسيد كرم را مرغ از فروتني ـ

تا چند منزوي در كنج خلوتي،
در بسته تا به كي، در محبس تني؟

در فكر رستنم ـ پاسخ بداد كرم ـ
خلوت نشسته ام زينروي منحني.

فرسوده جان من از بس به يك مدار
برجاي مانده ام چون فطرت دني.

همسال هاي من پروانگان شدند
جستند از اين قفس، گشتند ديدني.

يا سوخت جانشان دهقان به ديگران،
جز من كه زنده ام در حال جان كندني.

در حبس و خلوتم تا وارهم به مرگ
يا پر برآورم بهر پريدني.

اينك تو را چه شد كاي مرغ خانگي!
كوشش نمي كني، پري نمي زني؟

پا بنده ي چه اي؟ وابسته ي كه اي؟
تا كي اسيري و در حبس دشمني؟

شعری بسیار عمیق از نیما
با تشکر از دوست خوبم هادی که منو با این شعر آشنا کرد

MyMario 0.14.10

I just uploaded my last year’s 2D Platformer that I made with ActionScript 2.0 in Flash for a friend, thought it’s time to put it here too:

The graphics are borrowed from NES‘s Super Mario Bros. and was just a placeholder for my own characters and environments, which will be used in this year’s game.

Be sure to click on it to gain focus or else you can’t move characters. You can jump with Space key and shoot with “Shift”, movements are done with arrow keys.

MiniLD #14

Since I have more time now and it’s 40 days until my conscription service, I’m working much more on my 2D Platformer, still not my idea work time but my delta is way positive than before and that’s what keeps me going, even though there are still false thoughts in my head that I have to get rid off.

There is a competition being held at Ludam Dare site that is a little different from their regular LD (no, it’s not lethal dosage, sorry) competitions. It’s called MiniLD. MiniLD’s are smaller and get less attention and usually have no winner or prize at all but it’s a good boost for people like me to have a deadline, while being indie.

So the theme of the competition will be revealed at Friday morning and we will have two days to hand out our games.

I’m dealing severly with my collision detection, I managed to solve it with programming hacks that I know of, but as you might know me, that’s not something that would satisfy a mind like mine (which is a very beautiful one, indeed).

With now being Wednesday morning and me having a very bad toothache and mood and still caught in that damn bug,  I’m not sure what I will have finished by then but you know what? The result is like that very old Persian saying:

There was this old farmer that had 5 sons that they refused to work at his farm. So at his deathbed he gathered his sons and told them that there is a treasure hidden beneath these lands, so try finding it. You know the rest. I feel even if I solve only this bug by then, I would still consider me self, winner.

Working this year again on a platformer at NLAI, is reminding me of last year working on that MyMario. I loved those days, I spent a whole month on developing a ladder that I would enjoy, and I achieved it!

I will never surrender.

The Book of id.

Logo of id Software.
Logo of id Software.

I, as always, was searching the Web to find well-hidden gems from id Software that I reached a collector’s edition of id that contained 19 games from the pre-Quake II era. *sighs*. I was browsing its contents that I found out that there was a book with the package, so guess what. After 5 seconds I found it. No you don’t need to read this post anymore, so here is the rapidshare link that I uploaded and I encourage you to download from it, and here is the direct link to the book. Its around 5MiG.

For the love of Carmack, smarters man alive.