The beauty of anonymous methods (aka lambda expressions)

Posted on December 20th, 2005 by Tim.
Categories: Programming, Tim.

Anonymous methods are a new feature in .Net 2.0. One who is unfamiliar with anonymous methods may not immediately see the usefulness of this construct. It would seem as if anonymous methods are no more powerful than named methods, but this is not true. Take this code for example:

delegate void voidDelegate();

void SetEvent(InputEvent ie)
        {
            Invoke(new voidDelegate(delegate() { 

                eventText.Text = ie.ToString(); 

            }));
        }

This is a function that sets the text of a form element. The problem with interacting with anything in the user interface, however, is that it must be done in the form’s thread. If you are in the context of another thread, you cannot set any properties of user interface elements (since this would not be threadsafe, and is enforced by the .Net runtime). The workaround for this, is to use the Invoke method, which does a synchronous invokation in the context of the forms thread. The difficulty with using Invoke is that it must be done with delegates. Normally, this would mean defining a new function to do the work or playing around with parameter lists to re-invoke the function with the proper context and parameters. However, with anonymous methods this can be done much more easily.

4 comments.

GameTap review

Posted on December 19th, 2005 by Tim.
Categories: General/Misc..

A few things have happened at blog lately:

1. The Chrises have been blogging a storm (or at least, Liuigi has been)
2. The sidebar is now approximately as tall as a negative asian.

As a result, I’m writing a review of GameTap.

So I downloaded gametap today, with rather low expectations. They offer a 14-day trial, although they require a credit card, which they will charge if you go past the end of the trial period. After the trial period is over, GameTap costs 14.95 a month. Once I registered with the service, the download and installation was straightforward.

My first surprise is that GameTap starts full screen, and stays full screen. Luckily, it has the option of minimizing the window easily, which is pretty much necessary, since download times within the application can be pretty high for the PC games they offer. However, there is no option for windowed display, which is a little bit annoying for people like me who like to play games and be on AIM at the same time. Especially the style of game that is most common with this service, the typical arcadish game that’s entertaining for a quick game or two before stopping, it would be nice to have the option of running in a window.

The user experience is impressive and seamless. I was slightly confused at the interface at first, since the games can be browsed through several different categorizations. For the most part, the interface is very clean, aesthetically pleasing, and easy to use. Unfortunately, the interface is too simple in some places, at the cost of functionality. The first instance of this I noticed was the lack of configuration options for gamepads/joysticks. There is a simple setup for each game that prompts whether the user wants to use keyboard/mouse/joystick, but there is no configuration of key bindings for keyboard or joystick. This is definately a problem with gamepads, which can have dramatically different button and axis layouts. I ended up abandoning the use of my XBox 360 controller with GameTap in favor of keyboard, which was much less enjoyable. The second oversimplification of the UI is the lack of any screen resolution configuration. This is, in general, a good thing for most people likely, since most arcade/console games were meant to run at a lower resolution. However, the screen resolution GameTap runs at is probably around 800×600, and this looks fuzzy on higher resolution LCDs (since it gets interpolated).

The game selection in GameTap is better than I expected. The selection of games is somewhat predictable, with most titles focusing on the type of games you would find in an arcade. Games are present from many consoles, including Atari 2600, Genesis, Commodore 64, and other old systems. Noticibly absent, however, is Nintendo. This is unsurprising, since there are many rumors that Nintendo will be offering some similar type of service for their older titles through Nintendo Revolution. The PC games available are mostly unremarkable, although more than a few notable strategy games are included, such as Homeworld and Caeser 3.

Running the PC games was somewhat interesting. Running Process Explorer showed the game I was playing (Caeser 3) running off some sort of virtualized X:. The image name was X:\Game\c3.exe or something. This tells me two things: Firstly, that GameTap is running nearly original versions of the PC games (definately not recompiled from source versions), and secondly, that the original game data is stored unencrypted in memory at some point in time, and thus could theoretically be copied to an unencrypted location. Doing so would probably not be worth it though, since most of the PC games available on gametap are available in the 5-10 dollar bargain bin.

Overall, I think GameTap is a great marketing idea on a way to capitalize on existing IP. The application is well written, and the selection of games is impressive (with PR claiming the collection will increase to 1,000 games). At 14.95, however, this subscription is comprable to an MMORPG subscription like WoW. Is it worth it? Right now, I’d be hard pressed to subscribe. However, if more classic PC titles were added, and a larger variety of games were available, I would be much more tempted. In addition to this, a few enhancements to joypad configurability would greatly increase my odds of subscribing to GameTap.

It’s 2 AM. I wonder if anything I just wrote was coherent.

~Tim

0 comments.

Stacks

Posted on December 17th, 2005 by Chengstein.
Categories: Food, Games, General/Misc..

I will do something for the blog, since i’m a stooge. I am going to test a product. I think this will qualify under games and food. Cheng has been up since 3:30 pm on the 16th, its 7:17 am on the 17th. Thats not too bad, but what about during today? Chengameepheus must stay up until 5 pm and will attempt to stay up longer. I’m going to test the new product

Gas would be proud.

I am going to see how long I can stay up. This should be interesting. I will check back in, probably later tonight.

Dec. 17th- (10:25 am)- Despite not feeling very tired, Cheng feels like he should keel over.

I went Strongman mode.

I actually haven’t tried an MDX yet, but will.

10:30 am - I was forced to correct a previous statement. I now, have to say i went Mark Henry-style.

Mark Henry

Age - 30

6′ 3″ - 390 pounds

Works as a professional wrestler for the World Wrestling Federation

Member 1992 and 1996 US Olympic Teams in weightlifting

Many times National Champion in weightlifting and American Record Holder

World Powerlifting Champion in 1995 in Superheavyweight class

Holder of World Record Deadlift of 903 pounds

HE’S A MACHINE.

(4:04 pm)- Cheng has managed not to keel over so far. I see cipher’s link, so i must answer. hahahahaahhaahaha, cheese and church. I will chugalug an mdx as a tester before I’m in prime position to keel over.

(9:38 pm)- I had a chugalug of mdx, then if forgot i had it. The one reason you know u’ve had it is because of the ninnish taste. I don’t think it worked too well, i nodded off a few times today, but not for any substantial sleep. “A safety can change the whole momentum of the game.”

Dec. 18th- (12:14 am)- STACKS. My dora isn’t advanced enough to play Fifa 2002 for no apparent reason. I don’t know if i should blame dell, fifa, ea, or some random company.

(2:28 am)- I guess my dora was too fast, won’t last. EA’s ploy is working though, i have a massive urge to buy the reduced price of game, most likely 04, possibly 03. 03 would seem like a minor upgrade. I don’t really think it makes sense to buy a game every year, i would normally go with the combo-pack every 4 or so years. The combo pack puts 4 games in 1, and makes them not so much, but they are a year or two old. Usually they throw in something like golf, but Tiger Woods is a machine. I really have to buy a fifa game, because Chengameepheus already has a disease.

(3:00 am)- The “disease” got me going.

3 Things You probably know about US soccer- 1)Freddy Adu plays soccer (and his age). 2) The US was in the last World Cup and did well. 3) We are in the next World Cup.

3 Things You might know- 1) Landon Donovan- star on US team, played in Germany and in the MLS. 2) Bruce Arena- US coach, spent years at the University of Virginia and a few in MLS before having great success with the national team. 3) The US team finished first in CONCACAF over Mexico (in 2002, US finished 3rd behind Mexico and winners, Costa Rica).

3 Interesting Things- 1)The MLS is developing talent- two major examples being Demarcus Beasley (PSV Eindhoven) and Tim Howard (Manchester United), who are both in europe after starts in MLS (Chicago and Metrostars). 2) US might be developing an interesting niche position. Already at an elite level, goalies seem to be abundant. It all starts with Kasey Keller at the top, and continues with MLS development. Tim Howard, followed by Joe Cannon, Thornton, and others in the MLS. 3) A group of strong defenders abroad, such as Berhalter, Bocanegra, Cherundolo, and big guy Onyewu.

Things to watch- 1) Watch to see how Arena decides to fill out his roster, with more to choose from than ever. 2) Watch how the Czech Republic, Italy, and Ghana are doing, as well as pre-World Cup matches against Canada, Japan, Norway, and Germany. 3) WATCH SOME SOCCER GAMES.

0 comments.