Tuesday, November 28, 2006

A Wiik in Review

I have now had the Wii for a whole week. You may want to read my initial review.

In the past week I have come to see just how big of an impact the Wii is going to have on gaming. For Thanksgiving, I had my parents and grandma over. My family including my grandma, were able to play Wii Golf and had a great time doing it. The Wii really does appeal to all ages it seems. I don't think I have ever seen that much excitement and fist pumping from my family ever when playing video games.

Now for a few more reviews of games.

Madden
The Wii is absolutely a perfect match for Madden. It is so much easier when in order to juke or stiff arm, all you have to do is wave the nunchuck or wiimote, instead of trying to press button on the control. It really improves your timing when doing moves and makes juking and stiff arming actually useful. The same can be said for playing defense. Jumping to intercept the ball by raising both the nunchuck and wiimote in the air or swatting the ball just by waving the wiimote is very much intuitive. The only regret that I have is it not having internet play. I hope the next version does.

Monster Truck 4x4
This game is very easy to play. The steering handles exceptionally well. The only problem with the game is that you can beat it in 90 minutes in single player mode. Aside from that though, it is still a very fun multiplayer game for racing your friends, or even playing soccer by pushing the ball with your truck!

Rayman
All I can say is, this game rocks! From throwing cows to hitting bunnies, this game has it all. It is very comical and addicting. The only reason I was stopped from playing was when my kitty hit the power button on the surge protector. Be careful! I already know one other person who is insanely addicted to this game.

Wednesday, November 22, 2006

You heard him, let's pay the man for Linux.

Tristan Sloughter has posted a blog post about how Steve Ballmer and Microsoft want to extort us Linux folk for the rights to use free software. In response, Tristan suggests we start a campaign of mailing monopoloy money to Steven Ballmer. I am definitely all for it! Only problem is, I am not just going to handover my hard earned Monopoly Money! Good Hasbro has PDF's on their site to print some out! I recommend printing the 500's. Just to make sure you pay enough to get Microsoft off your back.

Money:
http://www.hasbro.com/monopoly/pl/page.treasurechest/dn/default.cfm

Address:
Microsoft Corporation
c/o Steven Ballmer
One Microsoft Way
Redmond, WA 98052-7329

Spread the word!
Also on reddit.

Wii: First Impressions

I received my Nintedo Wii yesterday. I was lucky enough to have ordered one from Circuit City during the few minutes that they took preorders on Friday. They shipped it out Monday, and it was here Tuesday(yesterday). Anyways, here are my first impressions of some different aspects about the Wii.

The Wii Itself
I must say the thing is even smaller than I could have imagined. It is slightly slimmer than a Mac Mini, a little longer, and just a tad wider. The thing feels absolutely solid. The controllers(Wiimote and Nunchuck) are also very solid. The Wiimote even comes with a wrist strap, so you don't have to worry about flinging the thing out of your hand. When I first heard it would have a strap, I figured I wouldn't use it, since it would probably be annoying. That is nowhere near the case. You can barely even notice it is on, yet it gives you that extra security that you don't have to worry about dropping your brand new 30 dollar Wiimote on the floor.

Setup
Setup was an absolute breeze. Just plug in the power, A/V cables, and the Wii sensor bar, and you are on your way. The initial screen just asks you to specify a name for your box and the date. From there setting up the wireless is just as easy by going to the options. There is a system information section that tells you what your MAC address is if you do MAC filtering. Also, the wireless gives you all the major choices for WEP and WPA encryption if you have those enabled on your router. After that, it goes through an update. The update took me about 5 minutes, I am guessing because the server is probably a little bogged down at the moment, but nothing too bad.

Game Play - Wii Sports
I of course started by playing Wii Sports Baseball! Both my girlfriend and I had an absolute blast. The pitching and batting is very intuitive and fun. You even kind of get a workout if you don't cheat and really go through all the motions. It actually feels like you are playing baseball(at least way more so than any other baseball game I have played). In case you are wondering how you run the bases, don't worry about it, you can't! When you hit the ball, the computer basically estimates if you would have been out, or if not, how many bases you would have got.

From there we went to Tennis. Again, and absolutely fun experience. You hold the remote just as if you would the handle of a tennis racket and swing away! The remote even seems to account for what your racket angle would be an applies the appropiate spin and aim on the ball.

After that we played boxing. This was probably my least favorite of the Wii Sports games. It was fun, but it seemed kind of clunky feeling, and not all of your punches would always be registered. It could just be that I need to get more used to it.

Next was Golf. Again very inuitive, and very fun. Just like tennis, except you are swinging at the ground, the game registers the angle and spin off your club, as well as the velocity of your club to determine the speed of the ball of the club. Putting was a little challenging at first, but then again, it is challenging for me in real life too.

Finally there was bowling. This was also tons of fun. I imagine this game will be the game to play when you have friends over, as you don't need 4 remotes to have 4 people play, just hand the remote over. The game is addicting and really does require that you aim your shot, and bowl the ball with the right power and angle.

Game Play - Red Steel
I haven't gotten too far into Red Steel, but so far it has been fun. It is a little tricking getting used to using the Wiimote to turn yourself around and look up and down while using the Nunchuck to actually move. Also, sometimes it seems like the Wiimote gets a little confused and has you staring at the sky for a couple of seconds before it figures out what you want. Other than that, the game is alot of fun, and I think shooting people in the game with the Wiimote is easier then even using a mouse on a computer. You also get to do sword fighting with the Wiimote which actually follows your moves fairly well and seems pretty accurate.

Overall
Overall I would say that the Wii is the best system I have ever played. You can really tell it is made for anyone, even non-gamers. Nintendo seems to have this down to a science. Whenever you start thinking to yourself, "Well, how do I do that!" it seems at that moment Nintendo always has a little message bar telling you what you need to know. Along with these well placed helpful hints, the gameplay is simple and intuitive enough that the playing field for everyone is even. My GF beat me in Bowling and Baseball, and I beat her in Tennis and Golf. It really does not depend on how much of a gamer you are, but rather just doing it and trying to have some fun!

Wednesday, November 15, 2006

Adding AES Encryption To Erlang Chat

I have been working on adding encryption to an IRC clone that I am working on with Tristan Sloughter called EChat.

Just like IRC, in normal operation EChat sends all communications to the server, then the server figures out who needs to get what. So, for my initial stab at adding encryption to EChat, I decided to encrypt the transmissions between clients and the server, instead of end to end.

Client1 <--Key1--> Server <--Key2--> Client2

So basically, the server does all the key management. Since AES requires a symmetric 128-bit key, we need a method of having each client the server generate a key. That is where Diffie-Hellman(DH) comes in!

DH is a quick and easy way to create symmetric keys between two people without ever having to reveal what the key actually is in plain text.

DH can be explained alot better here, than I can do, so I won't spend the time going over it. However I will talk about a few specifics of my implementation in Erlang.

In the algorithm, a and b both need to be a certain size in order to guarantee there are 128 bits in the final key. Therefore, to create them I simply did the following:
gen_DHa() -> gen_DHb().
gen_DHb() -> crypto:rand_uniform(170141183460469231731687303715884105729,
340282366920938463463374607431768211455).

For the curious, 2^127+1 = 170141183460469231731687303715884105729,
and 2^128-1 = 340282366920938463463374607431768211455. Generating a number in this range assures us we get a number that is at least 128 bits.

Also, to generate g and h, I just did the following:

gen_DHp() -> gen_DHg().
gen_DHg() -> make_prime(50).

On the client side, we calculate A as follows:

DHg = ecrypt:gen_DHg(),
DHp = ecrypt:gen_DHp(),
DHa = ecrypt:gen_DHa(),
A = crypto:mod_exp(DHg, DHa, DHp).

On the server side we calculate B as follows:

DHb = ecrypt:gen_DHb(),
B = crypto:mod_exp(DHg, DHb, DHp).

Now the client and server exchange A and B, and each can calculate the key
appropriately:

Client: Key = crypto:mod_exp(B, DHa, DHp).
Server: Key = crypto:mod_exp(A, DHb, DHp).

Now we have a key that is at least 128 bits. We want to make sure it is exactly 128 bits though, so I wrote the following function that ensures this. All it does is generate exactly 16 bytes from the stream of bits:
integerlist_to_key([], Key, _) -> lists:concat(lists:sublist(Key, 16));
integerlist_to_key([Head | Tail], Key, Tmp) ->
Test = list_to_integer(lists:reverse([Head | Tmp])),
if
Test > 255 -> integerlist_to_key(Tail, [list_to_atom([list_to_integer(Tmp)])| Key], [Head]);
true -> integerlist_to_key(Tail, Key, lists:reverse([Head | Tmp]))
end.

Now that we have a 128-bit symmetric key for both the client and server, we can start using AES encryption!

To find out about AES, read here. Basically AES requires an initialization vector(IV) for each message, as well as a symmetric key, and whatever text you want to encode.

To create the Encrypt and Decrypt functions, I decided just to append the IV to the front of each message sent. The IV does not need to be kept secret, and is only used to deter statistical attacks on the encrypted message. Thus, the following code shows how I did the encrypt and decrypt:
encrypt(Message, Key) ->
IV = crypto:rand_bytes(16),
list_to_binary([IV] ++ [crypto:aes_cfb_128_encrypt(Key, IV, Message)]).

decrypt(Message, Key) ->
{IV, Crypt} = lists:split(16, binary_to_list(Message)),
binary_to_list(crypto:aes_cfb_128_decrypt(Key, list_to_binary(IV),
list_to_binary(Crypt))).

That's all there is to it! Now you can add AES encryption to your application, whether it is for messaging or file storage. If you would like to find out more about the Erlang AES implementation, go here.

Tuesday, November 14, 2006

Sensationalism in the GNU/Linux world

Today I came across the following blog post entitled Is Ubuntu Set to become Non-free?

Basically they complain how Ubuntu is going to want you to use proprietary drivers for using the default composite manager. The thing that bugs me is that Ubuntu is already non-free. Their own philosophy(which the author even states) specifically says they allow for specific cases of having non-free software. To me, you can't be slightly free or non-free, you are either free, or you are not, it is just that simple.

Try telling that to digg readers though. It is funny to go through their comments on this article, and read many of them say "No", Ubuntu is not going to become non-free.

I think Ubuntu and Debian are both partially to blame here. They pretend they are "free" when really they are not, so now a mass of people believe that is what having a free distribution means. More importantly though, sensationalist posters who are just merely looking to grab attention of the digg crowd are to blame. Why someone would goto the trouble to distort facts and ramble about misleadings just to get a reaction from the digg crowd is beyond me. I guess some people really are just that narcissistic.

Monday, November 13, 2006

Richard Stallman Talk

The pictures for Richard Stallman's talk is now up on my flickr page. You can view all of them here: http://flickr.com/photos/diginux/sets/72157594369802498/

Also, if you would like to hear the audio of the speech, go here: http://www.chicagolug.org/uploads/4/49/RMS.ogg

Sunday, November 12, 2006

gNuisance (aka gNewSense)

Very recently the FSF announced a new Free GNU/Linux distro gNuisance. I fully support any and all free software and wish them the best of luck, but I feel their choice of basing gNuisance off of Ubuntu is a poor choice. Right now if you want to use a free GNU/Linux distro, your options are limited, and most of them aren't very fulfilling. That is why I think, instead of branching off of a distro that was branched off of another distro is a bad idea. Other people have already tried this, and it seems that the problems of the original distro(s) holds the new free distro back from its full potential.


It is time all of us free software lovers got together and really start a free "Nu" GNU/Linux distro from scratch. This will allow us to make choices based on what is best for freedom. It also allows us to make the best possible distro out there, so people won't use it just because it is free, but because it is good and they just plain want to use it!

Friday, November 03, 2006

Idea for System to Conserve Energy

I have an idea in order to make consumers more energy-aware and to conserve more. We should adopt a pay-as-you-go methodology for energy.

For example. When you goto a buffet, you don't eat all the food you want, then have the restaurant decide how much food you have consumed then charge accordingly. Almost no system operate this way except for the energy system. So each month you use so much electricity, then get charged one sum at the end of the month.

I propose instead, that you pay as you go. For example, if you wake up in the morning and want to boil some water for tea, you should have to consciously pay 50 cents(just guessing) to do so. If you want to watch TV, you should have to pay the amount it costs for the electricity to run it for one hour. If we did this, people would more likely make smarter choices, since they are confronted with the consequence of their actions right away. Consumers tend to be more conservative in buying when they are forced to pay upfront, instead of in payments over time.

While I am not sure how easy it would be to implement this idea, I don't think it would be that difficult and it could lead to a future where we are more aware of just how much energy we use/waste.