MozillaZine

More on Mozilla Gaming

Thursday August 10th, 2000

Dave Boswell writes, "Thanks to Dan Haddix PagMan has made an astounding amount of progress lately. Check out the latest version of the game (it works!) here."

Dan has also posted a version with an easter egg here.


#19 Re: Beam Rider

by WillyWonka

Friday August 11th, 2000 1:39 PM

You are replying to this message

> That's a fun little game.

It's an old coleco vision game I have beside my computer which I like to play every so often. In the coleco version the vertical lines are actually in perspective, but because I had to get it under 5k I made it Ortho view :)

> I'm amazed at how much you squeezed out of the size limit.

It's not that hard.

1. Compact the functions and reuse a lot of code.

2. use 1 character variable names. Remember JavaScript is case sencitive. So n is different from N.

3. Shorten the dom commands. var d = document; var e = d.getElementById; (I didn't do this in all places because of a bug which was around durring the competition... it should be fixed now)

4. Remove all spaces

5. Remove all carrage returns. On windows a carrage return is 2 characters and you can replace it with a ; so you get that down to 1 character.

6. Remove as many ;'s as possible. {a=0;} can be squeezed down to {a=0} because the } is equiv. to a ;

7. Remove english. English words are long... for example, at one point I had Play Again? (Y/N) which I shortened to Retry? (Y)

8. And when you are trying to squeeze every last byte out... use 99px instead of 100px for your coords. It shaves one byte off.

The game that I entered could be shrunken down a lot if I descided to rewrite it, but I didn't want to look at the code anymore.