Pages

Monday, July 25, 2011

Visual Studio Express

I had been making good progress on project Unison, getting about three-fourths of the messages out of the game successfully. I had noticed a particular one fairly early, but decided to delay tackling it until later because it looked to be a symptom of other, smaller bugs. Finally, I had to tackle this bug; for some reason, a message would completely stop in the middle, but only after several messages had been sent in quick succession, and it would fix itself a few messages later. It's probably something to do with a loop condition or data integrity check; however, I can't figure it out because Visual Studio C# Express 2010 doesn't support multi-threaded debugging.

While Unison doesn't use dedicated threads yet, it does use events heavily. The problem lies in the MsgParcer class, but without being able to select which thread I want to step through, there is no way to fix the bug without serious hoop-jumping.

The current flow chart. Apologies for the handwriting.

The FrameMessenger Addon in the game collects messages, formats them, and colors the pixels on a special grid according to the data being sent. Each frame is displayed for one second—which is a nice round number for debugging only, I hope to move down to less than a tenth of a second when things are ironed out. The ScreenShot class (abbreviated "SShot" in the picture) takes a picture of the grid and passes the picture to FrameWatcher which converts the raw data to a normal array. At this point, RawFrameEvent is fired—I use an event because I already had to use a delegate for callbacks, so it was trivial to use a potentially more useful event structure.

MsgParcer (yeah, I can't spell) picks up the RawFrameEvent and, like the name suggests, parses the messages. As each message is parsed, another event is fired, NewMessageEvent, for all the messages that pass the data checks, and MalformedMessageEvent for those that don't pass. Once the NewMessageEvent is fired, the message is complete and fit to be used. At this point, I don't have the malformed repair or the fragment classes implemented and the MsgFilter class isn't used, but I'll get to those and more eventually.

Visual Studio C# Express 2010 handles debugging multi-threaded applications by treating them as single-threaded and walking through all the threads, each doing one action then moving to the next thread. Because the events are fired every second, and each frame event can contain many messages, I might have a dozen threads in the pipeline when a break point (a point I have specified for the application to stop and let me look at what is going on) breaks the process. Since VSC#E 2010 handles threads by not handling them, I have no way to know which thread I'm looking at.

This is so frustrating because Visual Studio C++ Express 2010 handles multi-threaded projects, but doesn't have Intellisense which helps write code much faster, especially as the complexity and number of classes increase in a project. Visual Studio C++ Express 2008 has both Intellisense and multi-threaded debugging, but will require going down to .Net Framework 3.5 (currently targeting 4.0). Downgrading shouldn't be a big deal, but aren't the version numbers supposed to go up, not down?

Research Fail
While writing this post, I stumbled upon Microsoft's DreamSpark program. A few minutes later and I'm downloading Visual Studio 2010 Professional. Nice. Well, my rant has been dashed to pieces because I didn't do some basic Googling. I really don't feel like deleting most of this post merely because it is outdated by five minutes of research, so I'll leave it as a reminder to myself to research first, write second. Besides, it serves as a good overview of how Unison is progressing.

Taekwondo
I took first place in Forms and second in Sparring in the 2011 Atlanta Regional Tournament. My sisters and I all had only one competitor to go against in our rings—very disappointing. I'm getting quite annoyed at being beat by camo belts in sparring (I lost against another camo last tournament). I will have to focus on sparring more and prepare for the Panama City tournament.

No comments:

Post a Comment