Jan 24, 2011

6 weeks paid sick days

So one of my students got a new job in a game studio, and being his awesome teacher, former "sorta" lawyer and good buddie, I reviewed the job offer for him.  It was pretty standard contract for game industry: non-competition, flexible work hours, 3 weeks vacation, and... WHAT?! 6 WEEKS PAID SICK DAYS?

Yes this is real.  The contract didn't use the term "Sick Day", but it is explained very well in plain English.  It says some thing like this:

if you can't come to work because you are sick or injured, the employer will still pay regular salary and provide continued benefits and insurance coverage to the point where the employee qualifies for other income replacement benefits or to a maximum 6 weeks.
I'm glad to see there are still good companies out there who try to treat employees well in the game industry.  I'm actually kinda jealous now :)

Question: How many sick days(and vacation days) do you get from your employer?

Jan 20, 2011

VirtualBox hangs while installing on Windows 7?

I had this problem with both Virtual Box 3.3 and 4.0 on Windows 7.  While installing or uninstalling, it hangs and I can't even close the installer from the task manager: the only remedy was to hard-reset my computer... blarg...

It turned out to be Virtual Box is doing something with my network connection.  Not sure what it is exactly, but I found an easy solution:

  1. Disconnect your LAN cable from the back of your system
  2. Install or uninstall VirtualBox
  3. Plug back in your LAN cable

Jan 18, 2011

Not happy with PHP's Int

Few years ago, I used PHP extensively for our core rendering engine...... heh...... I'm kidding...... I used it not for rendering engine;, but for my various personal web projects.  And I recently took another look at this language again.  I wanted to generate some giant random numbers which cannot be represented with normal 32-bit ints.  And this will be stored in MySQL DB.

MySQL supports BIGINT, which is 64-bit, so no problem-o.  The real problem is PHP itself.  PHP's integer is C-like: it can be either 32- or 64-bit.  It depends on which machine the PHP is installed.  (I suspect you also have to install 64-bit PHP distribution to use 64-bit integer)

Sure, this is sorta acceptable on C because you can always build two executables and distribute both.  However, we are talking about PHP here, which is web-based.  Say you make some websites using 64-bit integer on PHP on a 64-bit hosted web server.  Then later you decided to move to another web host but the new one is 32-bit PHP... Then you are f**ked.  What would you do? Refactor all the code with your own custom 64-bit int class? Zawesome.

The other problem is Random() function in PHP, which accepts only an int as a seed and return an int again.  So if you use custom 64-bit int class, you will end up with making two 32-bit random numbers and use one of these as your high 32-bit number.  Sure you can still use floating-point numbers on PHP, but don't expect good precision.... uh.. not my taste......

Don't get me wrong.  I love PHP.  This is definitely my first choice for any web programming language.  But, I really think PHP should support BIGINT just like MySQL...

Jan 17, 2011

Booting up to command-line on Ubuntu 10.10 Maverick

I've finally installed Ubuntu 10.10 over the weekend.  My main motivation for installing Linux (first time in my life) was to have a test server for web programming I'm doing for fun.  Since I really didn't care about Linux GUI, I installed Ubuntu Server as a base and installed ubuntu-desktop(apt-get install ubuntu-desktop) top of it, which made everything ugly: whenever I boot up, it showed GUI login screen (GDM).... yuck...

So I tried to disable GDM.. I did a lot of google search, but all the tips I got from the web didn't work for me.  I suspect those tips work for older versions, or direct Ubuntu Desktop installation.  Finally, with my linux/unix guru buddie, Daniel's help, I managed to achieve this in a correct way. :)  This is how I did:

  1. edit /etc/init/gdm.conf ("sudo vi /etc/init/gdm.conf" for me)
  2. change where it says:

    start on ( filesystem


    start on (runlevel [5]

  3. change

    stop on runlevel [016]


    stop on runlevel [01236]

apparently this makes all the run level same as Unix.... (On the web, there was another suggestion to achieve this by changing only "stop on runlevel [0126]", but this was giving me a boot-up freeze....)

so there you go, if you have same problem with me, hopefully this will fix your problem :)

Jan 15, 2011

Brain Fart of This Week - Multiply Blend "Op"

I absolutely love my darn stupidity. :) So I had to use the multiply blend op this week at work to implement some kinda per-geometry glow effect that our FE artist mocked up in Photoshop.  Unfortunately, he didn't have the PSD file around anymore, so I had to believe what he said: it is using a additive blend layer in Photoshop + outer glow.

I was not planning to implement a real glow pass, so I decided to support that additive blend only and let our HDR bloom pickup the over-saturated value and do the "outer glow" for me.  So I simple re-submitted those glow geometries with a simple colour shader after turning on the additive blend......

The result was not great.. sure... It turns out to be he didn't use the additive blend in Photoshop; it was actually the multiply blend........ and guess what? I totally forgot the Photoshop doesn't even have a blend mode called ADDITIVE to begin with... uh.. first brain fart...but still not the best part :)

Then 2nd brain fart was even more fun... I thought I could quickly turn on the multiply blend on D3D and show the result to him.. but I couldn't find D3DBLENDOP_MULTIPLY, so I was like.. "hmm really? multiply blend mode is not supported on PC.. maybe it's only supported on X360 and PS3..."  Then later my lead reminded me that multiply blend can be done by using dest color as source blend alpha... uh... awesome brain fart.. I knew this.. but I completely forgot yesterday...

oh well, story of my life... :)

ps. the blend mode supported by Photoshop: