Anywhere

از هر طرف که رفتم؛ جز وحشتم نیفزود
زنهار از این بیابان وین راه بی نهایت
در این شب سیاهم گم گشت راه مقصود
از گوشه ای برون آی ای کوکب هدایت

Engineer’s Day

براي مهندسين بن بست بي معناست ، يا راهي ميابند يا راهي ميسازند . 5 اسفند روز مهندس گرامي باد

There is no dead end for an Engineer, he either finds or builds a way. Happy Engineer’s Day!

John Carmack’s Lifetime Award

I just heard that Smartest Man Alive a.k.a. John Carmack will be presented with the Lifetime Achievement Award at this year’s Game Developers Choice Awards, in recognition of “two decades of groundbreaking technical contributions, and his role establishing the first-person shooter genre with landmark titles like DOOM and Quake.”

Gamasutra did a good job of recapping Carmack’s many achievements:

John Carmack and his team at id Software, the company he co-founded in 1991, pioneered real-time 3D graphics in game, setting the pace and the standard for other developers to follow. Carmack and his colleagues at id are credited with essentially creating the modern-day first-person shooter (FPS) genre with the PC game Wolfenstein 3D in 1992, and helping to popularize networked multiplayer gaming on PCs with the release of Doom in 1993.

id has gone on to create other major FPS and action game franchises such as Quake, and Carmack and id Software are currently in development of a number of projects, including the free-to-play, web-based title Quake Live, the upcoming new franchise RAGE, and Doom 4.

As a largely self-taught technology purist, Carmack has devoted himself to pushing the limits of hardware and software. He’s helped to set the technical and gameplay standard for modern 3D gaming – and in the process, created some of the most popular video game franchises in history, which is why he’s being honored by the Game Developers Choice Awards this year.

Of course I’m always after a reason to honor my wretched blog with bits about his honor.

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 = []
#arrayOfLinesToBeCopied.append(1)
#print arrayOfLinesToBeCopied[0]

try :
#inputFileObj.open
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 )
print “ELSE SEKTION”
for i in range (2) :
print range(0, len(arrayOfLinesToBeCopied))
for i in range(0, len(arrayOfLinesToBeCopied) – 1) :
print i
ouputFileObj.write(arrayOfLinesToBeCopied[i])
#print arrayOfLinesToBeCopied[i]

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

inputFileObj.close()
ouputFileObj.close()

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))

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

inputFileObj.close()
ouputFileObj.close()

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.

It’s IN GAME, it’s not RENDERED or CUT SCENE, I SWEAR. LoL.

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

تا کی

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

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

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

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

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

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

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

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

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

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