Archive for October, 2007

Pittfalls of Using Stock Photo

Monday, October 22nd, 2007

My company’s website was redesigned few months back. I had nothing to do with it, because I’m not really a designer. I’m a back-end dude - I live in PHP and MySQL, and while I’m no stranger to CSS, design is not my cup of tea. For one, my ’shop skills are abysmal and my grasp of composition, and color theory is fair at most.

The website they designed is nice. Personally, I would tidy up the code and dump the rolling javascript driven footer but then again, that’s not my department. Besides, the composition is nice, colors work, and the stock photos they used give the site that slick and professional look.

For example, this young lady’s smiling face ended up on our home page becoming the de-facto face of the company:

Stock Photo

Who is she? Who knows - some anonymous model who posed for a stock photo that is being offered on few dozen stock photo reseller sites. Why do I bring her up? Because I saw her again, in more than one place. For example, here is the cover of a free Polish junk magazine published by a popular hosting company:

Hosting Mag

Where did I see that girl before? Oh, yeah - she was on our website. Needless to say, she is no longer used on our front page. You don’t want the face that shows up on cheep publications, and dozens of websites representing your company.

Stock photos are nice, but you have to remember they are not original. The really good ones - ones that catch your eye right away, are bound to get popular and start showing up in odd places. Your website represents your company, and in a way the photo that people see when they visit it is very important. If you using a very common picture, you are not really making a spectacular first impression on your customers. So, sometimes investing in original photography for websites and advertising publications is a good idea.

I finally broke down and played Halo

Sunday, October 21st, 2007

I avoided Halo for years because I never believed it really had that much to offer. My reasoning for this was as follows. Halo was a FPS game. FPS games started on the PC, and remain to be primarily a PC-centric domain. Say what you want, but mouse + keyboard combo is infinitely superior to a console controller. And I know - I played FPS games on PS1 and 2 in the old days when Sony was still kinda cool, and not the laughing stock of the universe.

Then again Halo was a FPS made for FailBox made by Microsoft which I didn’t own, and didn’t plan to ever buy. How good could that game be? Why would I actually want to get a silly console game and play it on my PC? So I easily ignored the original Halo, and then Halo 2.

Fast forward until today and just about every person with a blog is having a massive gamegasm because of Halo 3. Seriously, ever since that game was released it became impossible to go to any gaming site without witnessing fanbois jerking off to Halo 3.

I’m not planning to buy Xbox 360, and so I will probably won’t be playing that game any time soon. But all that praise lumped on top of the Halo series lately got me wondering what exactly was I missing. So I broke down, and installed the original Halo: Combat Evolved on my PC. I wanted to experience first hand what exactly was this whole hype all about, and how all of this started.

Halo

My first impressions? For a 6 year old game, Halo was really not that bad! In fact, it was highly entertaining. Unlike many other games, the difficulty system seemed to be very well designed. On easy, the game is genuinely easy, without sacrificing the AI intelligence. Enemies still take cover, fall back or try to ambush you - but they are much less accurate or effective with their shots.

To tell you the truth, I was quite surprised that a 6 year old game had all the FPS elements that are now staples of the genre: intelligent AI that uses cover, wide range of vehicles, scripted combat sequences, smart ally NPC’s fighting alongside you, a good story and etc. I expected a shitty console shooter, and I got a grade A FPS that was actually more fun than some of the much newer games that I played recently.

I especially liked the vehicle movement. In the PC version it uses 2 buttons - one for driving forward, and one for driving backward. While you are driving the vehicle turns to align itself with where you point your mouse. I’m actually surprised that more games did not copy this model because it was much more convenient than a full WASD vehicle control you usually find in FPS games.

While I abhor the checkpoint save system, Halo was the first game I ever played that actually made it work. It saved itself so often that I never had trouble finding a good stopping point. Also, the only time I was annoyed with it was during the final long escape sequence when I messed up one of the long buggy jumps. In fact this was the longest game stretch without a checkpoint and it was probably done this way to impose sense of urgency on a player. It didn’t work - and I was annoyed, but only mildly since ti was the end of the game, and I got it right on the 3rd try.

I immensely enjoyed fighting Covenant forces. I liked how you could sneak up, and toss a plasma grenade at an Elite, then pick off grunts as they ran away, or run up to a Jackal hiding behind a shield and knock him out with the butt of your gun. Flood on the other hand was not as much fun. They were pretty much generic monster/zombie types that you see in every other game.

Story was good too for an FPS game where the main character says total of like 8 sentences and never removes his helmet.

So while this was not the best game that I ever played, it was a very solid FPS. I highly misjudged it all these years. Now I kinda want to play Halo 2 to see what happens next, and kill more Covenant troops. Anyone got it working under XP yet? I know that a crack is out there, but I read mixed opinions about it’s effectiveness.

In before “buy and Xbox” and “get Vista” - no and no. Re: Xbox - I still maintain that playing FPS games with a console controller is silly. I’d rather put than money toward a nice video card. As for Vista - ugh. I’m strongly revolted by that whole thing. Sluggish 3d graphics, unstability and DRM are not my ideas of fun. Vista is Windows ME for the new millennium. So I think I’ll hold off on it for now. Maybe I can wait it out till MS releases a new version of OS that doesn’t suck.

TV-Links: RIP

Saturday, October 20th, 2007

If any of you guys thought that UK had a copyright law that is any less retarded than ours, think again. Apparently, over there you can actually go to jail for linking to copyrighted material illegally hosted on a foreign site. Sin, the maintainer of tv-links.co.uk who commented on here several times, was arrested the other day and his website was shut down.

Yes ladies and gentlemen - UK is all kinds of fucked up. In some ways even more so than we are. I don’t recall anyone being put in the slammer for linking to youtube, stage 6 and dailymedia. So watch out guys.

In the meantime, let’s try to find a good replacement. This might be a good place to start.

Post your favorite tv-links like site. Also, shameless link whoring is allowed, as long as your website is on topic (ie posts free streaming TV shows and movies).

Update 10/22/2007 09:44:53 AM

If you want to donate for the tv-links legal fund, you can do it here. Btw, I’m not sure if this is legit, but what the hell. Thanks to Gary for posting it in the other thread.

Designing a Tetris Clone: Part 1

Saturday, October 20th, 2007

Someone told me that Tetris was a “hello world” of game programming. I whole heartedly disagree. Tetris may not be an awfully complex game, but it sure as hell is not trivial. The whole concept of a “hello world” is to show the simplest trivial example of functional code that actually does something. But if you think about it, Tetris is not all that simple. So I decided to actually implement the game to show that if you really sit down and try to put it together it is slightly more than just a hello world.

Now, I could just sit down and hack a working prototype relatively quickly but let’s do this the right way. Lets design it, rather than hack it.

Good place to start is to put the spec of the game down on paper. So, let’s just list everything we know about the game:

  1. the playing field is a grid of the size 10×20, 10×24 or 10×16
  2. all tetris pieces are composed out of exactly 4 blocks
  3. the pieces come in 7 shapes: J, L, T, Z, S, I and O
  4. each piece has an orientation and color
  5. pieces start at the top in the middle of the grid, and slowly fall downwards
  6. the speed at which the pieces fall increases with each level
  7. player can move the pieces left and right or rotate them (change their orientation)
  8. when a piece touches the bottom of the grid or top of another piece it becomes locked down
  9. there is a slight delay before the lock-down that allows the player to slide the piece into place
  10. if a full row on the grid is filled it will clear and add to the players score
  11. the original Nintendo formula for computing score is m(n + 1) where n is level, and m takes the value of 40, 100, 300, 1200 depending on the number of lines that were cleared simultaneously (40 is one line, 1200 is 4 lines)
  12. when a line clears, all the blocks above move down
  13. requirements for advancing to the next level depends on a game, but most start with around 40 lines, and the number gets progressively smaller to become 1 level per line around level 20-30
  14. some games implement gravity that makes blocks that do not rest on other blocs slide down causing chain reactions
  15. most games display the next piece next to the grid
  16. most games allow player to instantly drop the block down either via hard drop or soft drop
  17. some games implement a wall kick that allows for rotating pieces backed up against the wall

The 17 points above roughly describe the game and can be used as an initial specification. Remember, we are building a game that already exists in many different version, so we want to create something that is instantly recognizable as Tetris, but we do not necessarily need to include all the fancy features that were added to it over the years.

As they taught you in your software engineering class, pay attention to the nouns. They are your potential classes. Right now I see several really good candidates: Block, Grid and Piece. In fact, we could possibly define classes for each specific piece like LShapedPiece, JShapedPiece and etc… They would all be subclasses of Piece and would define the shape, color and orientation. Each of these classes would also implement rules on how the piece could be rotated. This way Grid class would only need to interact with a Piece class.

I actually can see a nice factory pattern forming here. Grid will call a Piece factory which will randomly generate one of the subclasses, and then return it as Piece. This may or may not be practical, but it seems like a good idea at the moment.

Also, the spec is just a rough sketch of the game. If we want to implement it, we must answer several questions and make some important design choices. For example, how big do we want the grid? Do we want to allow the player to rotate pieces clockwise and counter-clockwise or just in one direction (the later choice means you only need a single rotate button rather than two). Do we want to have hard drops or soft drops? Do we implement wall kicks or leave them out? We also need to pick several variables such as lock delay, the speed at which the pieces drop. We must decide if we want pieces to crawl (move one pixel at a time with specific velocity) or skip (move full block length down every n seconds).

We have a pretty good scoring formula, but just a very rough guideline on level advancement. That will need to change. Oh, and there is also that pesky matter of collision detection - somehow we will need to decide how do we detect that piece has hit a wall, or a locking element like floor or another piece.

We also need to pick platform and a language at some point, but that is not all that important at this point. Tetris can be written in any language, and while some might be better suited for this task than others, it ultimately won’t matter as long as we can use some graphic display libs and don’t have to re-implement a whole 2d display framework.

I’m going to address all these questions Part 2, and start drawing up some UML. I also want to look at actual game piece design - like sprites, and internal representations of a piece and a grid. I already have certain design in my head, but any suggestions are welcome. I also have a very specific language and framework that I’d like to use, but I’m not really designing with that language in mind so I’m not going to tell you yet. Good design should work in any OO language - and once we pick one, we can do necessary adjustments if needed.

Still, I’d like to see what language you guy would use for this. Let me know in the comments. If you suggest a good one, I might even change my mind. )

Outlook 2003 Attachment Dialog Doesn’t Show Zip Files

Friday, October 19th, 2007

I have like 4 or 5 people in my company who are experiencing this issue. I have yet to replicate this problem on any of the machines in the office, but it seems that it’s hitting mostly the users of Office 2003 on WinXP. It manifests itself the following way:

  1. The user creates a new email and hits the paper clip icon to add an attachment
  2. The file chooser dialog, does not display any Zip files
  3. The chooser filter is always set to all files
  4. The zip files can be dragged and dropped onto the email from explorer as normal

So it seems that there is some arbitrary filter that gets activated in some versions of Office 2003 but not all of them. I found a few similar issues like this online, but most are forum posts with a long chain of “me too” shutouts and no solution. I have yet to find an official Knowledge Base article touching on this issue.

Some people advocate a workaround to this issue which is not a perfect solution. I think one of the better written tips can be found here. The solution? Unregister the zipfldr.dll which allows XP to treat zip files as folders.

regsvr32 /u zipfldr.dll

This does cause issues though - for one, you cannot peek into zip archives anymore. Secondly, while the files do show up in the attachment dialog, they use a generic “file” icon instead of the more representative Zip-folder one. Even if you associate the files with WinZip or WinRar and the icon changes for Explorer, the dialog will still show them using the generic icons. This really irks some users - and honestly, it annoys me too.

This is not a solution - this is a temporary workaround. If there was a problem with Outlook 2003 and zipfldr.dll every single workstation here would get hit. But so far, it’s been only few users who experienced this. There is a link here, and we need to find it. But then again, this is a low priority issue and at best a mild annoyance to the users. No one wants to spend more than 5-10 minutes troubleshooting this on the phone, and no one is willing to send in the machine for service. So until we can replicate this issue locally, your guess is as good as mine as to what is causing this.

Anyone here ever had that issue? Did you ever figure out the source? Let me know.