The IMDb DB
After having lost it for a couple of years(!) I found the IMDB data files again! You can start from here and get the Gzipped text files from an FTP mirror.
Oh, so much data! Sweet sweet data! My “Sprunger” is fully tumescent!
C++11?
The C++0x standard has been approved by ISO/IEC. This probably means that we’re going to be calling this iteration of the language C++11.
It amazes me how much of the language and the standard library people don’t use already. And I mean the C++98 stuff that has been around for 13 fracking years! True, there are professional developers that decide to use a specific subset of the language, or in some situations some design decisions are “inherited” by programmers working on an existing body of code… but I’m not bitching about them (much!) I’m talking about programmers and their new projects and sample code. New programmers (usually university or high school students) don’t learn about most of C++ because their teachers don’t know them and that almost all programming books on C++ suck (sometimes, it’s not the author’s fault; C++ is just too vast and complex.) More “experienced” programmers usually learn about a subset of the language and form a “comfort zone” and stay in there; because anything out of that zone will upset them. The bad thing is that this C++ comfort zone is – more often than not – way too small.
It might (or might not) include good polymorphism and class hierarchies (which I don’t like, incidentally) but almost always it does not include any meaningful use of generic programming, higher order and (some vestiges of) functional programming, attention to memory and layout (I believe many non-trivial programs have ran or are running into address-space limitations as we speak,) exception-safe and exception-correct programming, development of domain-specific mini-languages, real scalability and thread-correctness, etc.
Of course, everybody is free to program the way they want or can. I’m not the one to judge. All I’m saying is that even in the single language we use, there is much that we don’t take advantage of (let alone using other languages that might be more suitable for a job.)
Now, enters a new and feature-rich standard of C++ into an already starved expertise pool. There are so many real features and improvements in this iteration of the standard that they could overwhelm at the first glance. There is (just off the top of my head) r-value references and perfect forwarding, lambdas, variadic templates, compile-time constant expressions, user-defined literals, better enumerations, typedefing templates, initializer lists, better control over inherited methods, better control over compiler-generated class methods, finally some semblance of class- and method-specific directives (alignment, etc.,) extern templates, forwarding constructors, initializing class data members upon declaration, auto and decltype keywords for type inference and whatnot, (oh, I almost forgot!) the cool and hip new way of declaring the return type of a function, and much more.
The above features are just the ones that I could recall right now and in the core language only. I need and want to use these features, additions and improvements right now. They all make my code better and my life easier. These are not some obscure features for practitioners of “black magic”. They benefit the likes of you and I, not language lawyers, but people with real applications and real problems.
I guess what I’m saying is that as a C++ programmer, you should not be afraid of experimenting with the new features today. Don’t wait for the books or libraries and frameworks to pick them up. Books will take years and they will be all wrong and useless anyways (of course, with a couple of stellar exceptions.) Again, only with a few exceptions, libraries and frameworks will be burdened with incompetence, corporate politics, backward and forward compatibility and compiler compatibility (with the most brain-dead compilers. Please don’t rely on Qt or wxWidgets or whatever to do your C++ for you. Please don’t wait for Deitel and Deitel to teach you C++.
Start with Wikipedia. Read various texts and tutorials and overviews that uncle Google finds for you. Start experimenting and teaching yourselves the new features of C++11; and any of the old feature-set that you might be rusty about. It’s a great time for C++, as it is now a better language than it ever was. It’s probably the best general purpose programming language out there for people with actual hardware limitations on their applications. And it can do practically everything. (Also, C++ supports the widest range and mixture of programming paradigms of any programming language that I know of.)
Notes: I have three points to add to the above rant.
First is about the advancements in the standard library. They are much more substantial and accessible for the lazy programmer (I don’t use the term “lazy programmer” as a negative phrase!) as most of the additions are already available with the most popular compilers, or even in Boost if your compiler doesn’t have them yet or if you don’t like your compiler vendor’s standard library! I’m much less enthusiastic about the new C++ standard library features simply because most of them have been available as part of Boost for years and therefore are hardly new. Still exciting, though!
Second. No compiler that I work with has support for all or even most of the new core language features, although GCC is close (not to “all”, but it is close to “much”.) The state of support in Microsoft’s Visual C++ is closer to pathetic. Intel C++’s condition is not much better either. A partial table of the state of support for various new features of the language across quite a few compilers can be found here. Right now, I (and probably everyone else) would suggest using GCC. Get your hands on 4.7 if you can, or use 4.6 or even 4.5. Good luck!
It seems that I’ve forgotten my third note! Maybe it’d come to me later.
Giving HTML Emails a Try
I have decided to change my all-plain-text email policy and give HTML emails a try. This is mainly due to bad right-to-left support in plain text email messages (or in Thunderbird?) but there are other reasons. I will give it a try and in a few weeks decide whether I like to make it permanent or not.
I don’t know why I feel so shitty about it, like I’m cheating on my significant other or something!
Of Pursuit of Programming in Universities
I was reading this post on the AltDevBlogADay and noticed how similar it was to my own experience. The writer’s point is how removed most of academia is from the real world (at least in the programming world) and he relates a couple of anecdotes from his own past. It’s a short and funny read (specially the part about the floating-point number format in memory. I mean, talk about bad bad misinformation, not to mention the idiocy!)
Anyways, near the end of the post, he mentions that he somehow figured out that all the things his professors said were not the truth, the whole truth and nothing but truth. I remember exactly how and when this happened to me.
It was the first semester in my university (which was an absolutely mediocre one.) In the software engineering program over there, there was an “Introduction to Programming” for the first semester, and an “Advanced Programming” (or something like that) course for the second. Back then (in 1999) they taught Pascal in the introductory course and C++ in the advanced. My Pascal teacher was a young guy. A pretty decent teacher and academic (and quite orderly!) Those days, the way to program in Pascal on DOS/Windows and not get into the whole mess of Object Pascal and VCL was to use Borland Pascal (or Turbo Pascal,) which ran on DOS and was primarily targeted to that platform. Not that this was a bad thing, because most (almost all) of the students were unfamiliar with UNIX and programming for Windows was… well, is a mess.
Anyways, when he was teaching Pascal, he mentioned a few times that if you do this or that, the compiler will issue warnings. This was a bit puzzling for me, since I had been using Turbo Pascal for 3-4 years then and I had never seen anything like warnings being issued by the compiler! It either gave errors, or it compiled the code happily. It should be obvious for any programmers in the audience what the problem was by now, but of course, before then I had never actually written any C/C++. My experience was limited to some BASIC variants (Commodore, GW, Q, Visual (shudder),) Pascal and some Assembly. But I was beginning to dabble in C, in anticipation for the next semester and it suddenly became obvious to me that our instructor did no Pascal programming himself. He just had C experience and had read some books on Pascal!
There were many more incidents like this with many more teachers; little mistakes that would absolutely never happen if they had any real experience, and not book knowledge. (I should mention here that not all my teachers were like that. Some of them were surprisingly on top of the subject they taught, e.g. the white-haired 60-year old associate professor who taught Assembly!) I started resenting some of my teachers for their blatant ignorance and shamelessness. In time though, I learned that all of them knew stuff that I didn’t know and could learn. That’s when the university became much more tolerable. I only had to treat all important information the same way: with a grain of saltdoubt, no matter the source.
Garshasp on Steam!
By the prickling of my thumbs
Something wicked this way comes…
Garshasp is up on Steam and Gamers’ Gate, and it will be available for purchase shortly. This is a huge step for us, specially if we are received well.
I am now praying to all the gods I don’t believe in to make it so (witness the vanity and weakness of man!)
Human Brain vs. Computers
When I was young, maybe in my early teens, I used to think that what gave the human brain its advantage (over synthetic computation machines) was its speed. I used to think that the brain processed information with a throughput and latency that was far superior to machines and that was why computers couldn’t duplicate the more complex tasks that every human does every second. But of course this was completely false. In terms of sheer speed of processing and signal transmission, human nervous system and brain fall much short of any computer.
Later on, I arrived at the concept that it was the inherent parallelism and emergent mechanisms that are going on in our brain that give it its superiority. The billions of neurons on our brains all are working in parallel (well, not all obviously, but each subsystem seems to be massively parallel) and many of them are actively selecting and routing and inhibiting and amplifying the signals that come their way so new, probably non-deterministic and previously untried, methods are emerging and falling all the time. As an interesting side note, it seems to me that our brain is quite good at data parallelism, and really bad at task parallelism! A corollary of this concept could be the idea that human brain is also very small for the computational power it has (I don’t think it is.) Anyways, while this parallelism might very well be a great feature of human brain, it’s probably not the most important or amazing. After all, the whole Internet is a parallel machine (for some loose definition of the phrase) that probably has more computational power than the whole human population combined by several orders of magnitude (haven’t done the math; don’t bug me about it!)
In the first years of college, I was introduced (a tiny bit more properly) to the fact that human brain reconfigures itself on the fly. Through a process and under rules that might very well be quite simple and even trivial to understand, it reinforces some paths and connects and creates others. This still counts (for me) as an important feature.
Very recently, I’ve started to realize the most amazing feature of the human brain is its energy consumption! There’s all this stuff going on in there, with all these capabilities, and it consumes, what, 100 watts? 200? (again, haven’t done any research or calculations – please illuminate me if you know.) That’s not even enough to power a half decent GPU these days. Am I too wrong?
پیام من به قضاوتکنندگان گرشاسپ
روی صحبت من با همهی کسانی است که گرشاسپ را میبینند و نه فقط انتقاد کنندگان. من کاملاً به حق شما برای انتظارِ دیدن یک بازی کامل و بینقص احترام میگزارم. من با جدیت تمام عقیده دارم که حق همهی ما به عنوان بازیباز این است که بدون هیچ قید و شرطی بهترین بازیهای ممکن را بازی کنیم. ولی گاهی کمی واقعگرا و منطقی بودن هم بد نیست.
مثلاً بودجهی گرشاسپ را در نظر بگیرید. کل هزینهی صرف شده برای تولید گرشاسپ (به اضافهی سوشیانتِ ناکام) و تبلیغات و شرکت در نمایشگاههای داخلی و خارجی به 300 میلیون تومان هم نمیرسد (این عدد فقط حدس و تقریب شخصِ من است.) این یعنی حدود 300000 دلار (برای راحتتر شدن مقایسهها در ادامهی بحث همهی عددها را به دلار بیان میکنم.) این عدد را با بودجههای بازیهای مطرح دنیا (اصطلاحاً AAA) مقابسه کنید:
- Gears of War: $15M
- Modern Warfare 2: $50M
- Killzone 2: $45M
- Gran Turismo 5: $80M
- Metal Gear Solid 4: $60M
- God of War III: $44M
- Assassin’s Creed: $18M
- Assassin’s Creed 2: $25M
- Bioshock: $15M
- Halo 3: $55M
- Grand Theft Auto 4: $100M
دقت کنید که از ساخت بعضی از این بازیها چندین سال میگذرد. همچنین توجه داشته باشید که اعداد بالا تقریبی و فقط شامل هزینهی تولید هستند و نه هزینههای تبلیغات و بازاریابی و توزیع، وگرنه هزینهی تمام شدهی بازیای مثل Modern Warfare 2 به عدد باورنکردنی 200 میلیون دلار میرسد!
بیایید از فاکتورهایی مثل ساختهشدن بیشتر این بازیها برای چندین دستگاه و کنسول مختلف، باتجربه بودن همهی این شرکتها و تازهکار بودن ما، هزینههای بازاریابی که معمولاً بیشتر از هزینههای تولید هستند و مانند اینها صرف نظر کنیم. تعدادی از متخصصان و باتجربههای صنعت بازی در جهان معتقدند که یک بازی بزرگ و مطرح جهانی برای اینکه هزینههای خود را جبران کند و اصطلاحاً “سربهسر” شود باید حدود یک میلیون نسخه بفروشد. با توجه به قیمت معمول بازی یعنی حدود 60 دلار (حالا شما با توجه به انواع تخفیفها 50 دلار فرض کنید،) یعنی یک بازی AAA حدود 50 میلیون دلار هزینه دارد. باز فرض کنید نیمی از این عدد هم هزینههای بازاریابی و توزیع باشد (که معمولاً بیشتر از این حرفهاست) پس میتوان فرض کرد که یک بازی مطرح در جهان حدود 25 میلیون دلار هزینهی تولید دارد. این عدد را به یاد داشته باشید.
بخش بزرگی (تقریباً همهی) هزینهی تولید به صورت مستقیم و غیر مستقیم برای نیروی انسانیِ سازندهی بازی صرف میشود (یعنی دستمزد و غیره.) دستمزد دستاندرکاران بازیسازی در ایران حدوداً بین 12000 دلار و 24000 دلار در سال است (1000 تا 2000 دلار در ماه.) این عدد برای بقیهی دنیا حدوداً 50 تا 100 هزار دلار در سال است که میشود حدود 4.16 برابر. یعنی بازیسازی در ایران حدوداً چهار و شانزده صدمِ برابر ارزانتر تمام میشود، پس باید بودجهی ساخت یک بازی جهانی را بر 4.16 تقسیم کنیم. 25 میلیون تقسیم بر این عدد میشود کمی بیشتر از 6 میلیون دلار. یعنی در تئوری، برای تولید یک بازی مثل بازیهای نامبرده شده در ایران باید حدود 6 میلیون دلار هزینه شود.
کلِ بودجهی گرشاسپ یادتان هست؟ 300 هزار دلار. یعنی یک بیستمِ مقداری که بنا بر نُرمِ جهانی باید برای این بازی هزینه میشد! حالا از همهی شما بازیکنها و طرفداران و منتقدین گرشاسپ خواهش میکنم این عدد را همیشه به خاطر داشته باشید. یعنی کیفیت گرشاسپ باید 20 برابر بدتر از بازیهای روز جهان باشد. یعنی طول بازی، تعداد ویدیوها، تعداد کاراکترها، کیفیت مدلها و صداها باید 20 برابر کمتر و پایینتر و تعداد باگها و crashها و مشکلات مورد انتظار باید 20 برابر بیشتر از آنها باشد. اگر گرشاسپ از این مقدار مورد انتظار بهتر و بالاتر ظاهر میشود، یعنی ما کار خود را خیلی خیلی خوب انجام دادهایم.
تازه از منظر دیگری هم میشود به قضیه نگاه کرد و آن هم قیمت محصول برای مصرفکننده است. یک بازی AAA در جهان در حدود 60 دلار قیمت دارد، در حالی که قیمت گرشاسپ بین 3 تا 3.5 دلار است. اگر شما بازیهای خارجی را به قیمت واقعی میخریدید، آنوقت قدرِ واقعی بازیهای ایرانی را میدانستید و میتوانستید درست و منطقی در مورد آنها قضاوت کنید. باور کنید که در این دنیا در همهی زمینهها هر چقدر که پول بدهید آش و سوپ و لازانیا میخورید. (این حقیقت که قیمت پایین بازی در ایران نه تنها تولیدکنندگان، بلکه مصرفکنندگان و بازیبازها را هم نابود میکند باید مثل روز بر همگان آشکار باشد. اگر میگویید نه، تا آنلاین شدن و غیرِ قابلِ کرَک شدنِ همهی بازیها صبر کنید!)
من و بقیهی دوستانم در تیم سازندهی گرشاسپ به کار خود افتخار میکنیم و به هیچ وجه شرمنده و عذرخواه نیستیم. درست است که ما میدانیم که گرشاسپ اصلاً بیمشکل و بیایراد نیست و میشد و میتوانستیم خیلی بهتر از این را هم بسازیم، ولی این نگرشِ ایدهآلیستی تقریباً در مورد هر محصولی و در هر زمینهای و در هر زمان و مکانی صادق است.
من فقط از شما میخواهم که کمی منطقی و منصفانه فکر و قضاوت کنید؛ همین.

