-->
Recent Projects:
Current Project:

Exceptional Journals (in no order): [Eliwood] [Steve Healy] [Ravuya] [Mark the Artist] [Scet] [Ysaneya] [Mayan Obsidian]
My Personal Website
| Thursday, February 19, 2009 |
 Two tales of woe, with a happy ending. |
Posted - 2/19/2009 11:59:32 PM | I was first tempted to call this entry, "Why I loath Java", but I think I've calmed down enough to go on about this in a more civilized manner. I'll intersperse a few screenshots on the left and right margins to make things feel more interesting.
An Evening Tale: A "Heap" of Trouble
For the longest time -- and only on certain people's systems -- there would be this strange occurrance whereas the player would experience a sudden 'freeze' or pause in gameplay for a split second, every few seconds. This did not seem to lower the framerate or updates-per-second, and happened uniformly at some same rate. However, on other systems this would happen similarly, but the effect would vanish after several seconds. To further mystify this problem, it would happen to me if I ran Skirmish via WebStart, but NOT if I ran it from my IDE. Très bizarre!
This being initially back in October or November, and I had been baffled for a while. I had first begun profiling in order to try and determine what portion of the code was causing this behavior. At first I suspected that the garbage collector was at fault, and that it must be complaining because I was creating so many 'Vector2's (a 2d vector helper class) all over my code in places like rendering and elsewhere. I somehow convinced myself that this was the root of the problem, and wrote a system on top of the Vector2 class that would maintain a pool of reusable objects to keep heap size down. The details are fuzzy, but I must have convinced myself that it worked, somehow, and carried on with life.
Not long after, my good friend Dean told me that he still regularly experienced this "pulse lag" bug, as he so aptly named it. I had not realized this, since I was still always running the darn game from my IDE! It turns out that the bug was still present, although only a handful of the testers would experience it. Oh man! Weird!
It was at that point that I decided to give it another go at the profiling, and figure out what the heck was going really going on. So, I did. This time, the source of the time-wasting looked to be the networking. I ran a few (admittedly VERY basic) tests to see if this was the case, and indeed it did seem that the raw network calls (recv and send) were sucking up a lot of CPU time because they were blocking the main thread from doing other useful things like rendering. This surely must be the root of this problem! So, I went off on a mini-project to make the entire networking system multithreaded. Several challenging weeks and a dozen or two hours later, that was implemented. Swell.
Not swell. The testers that had the "pulse lag" bug were still experiencing it in its full glory. However, most people noted that the framerate had increased by a decent margin. I once again had not fixed the bug, but Skirmish became a little faster through my efforts, and I learned a lot about concurrency.
Once again, today, I took a stab at figuring out where the bottleneck was. It was the strangest thing. It seemed almost like every time I cleaned up some code, it jumped to a new spot. Again and again. Puzzled, I took a moment to stop and take a few steps back and think about this thing. Surely these few areas of code were not of pinnacle efficiency, but they don't account for this kind of periodic freezing to occur. The only thing that would make sense would have to be..
..garbage collection. Or, more specifically, the heap size allocated by the Java virtual machine. In some ways, I am to blame for not allocating and handling objects a little more responsibly, but the VM was vomitting every few seconds because the heap was just too small. And, in a very anti-climatic ending, I simply increased the heap size for the VM and everything was well. Testers confirmed that the elusive bug was nowhere to be seen.
Is that a truly tale of victory? Or did I just evade my own inefficiencies by increasing the heap size? I'm still not sure whether I feel satisfied or disappointed. I was really expecting a grand victory, full of music, dance, and perhaps a large feast. Still, I won't complain. It works, goshdarnit. It works. 
The Other Enigma: Windows Vista
On a equally pleasing front: Windows Vista is now able to run Skirmish properly.
If this sounds like news, then you probably weren't aware of this problem. To be honest, it wasn't something that I wanted to advertise. 
For the longest time, Vista users have been unable to connect to the master server. It would simply outright refuse to connect. Boggling, I know! Unfortunately none of the Vista testers were developers, so they didn't really understand how to get me the system log that the game would produce. Fortunately, I had my roommate around today, who has a Vista partition, to get one to me.

Much to my confusion, the line it produced upon connecting was an exception: "Invalid argument: sun.nio.ch.Net.setIntOption". Huh? I don't claim to be a Java guru, but I had never seen or heard of this setting before. My instinct was that one of the many integer-based parameters that standard network sockets accept wasn't appreciated by Vista.
After some searching, the closest thing I found to a satisfactory answer was on Marlon Pierce's blog, although it's not quite to the same details as my problem. Not being a big Windows fan, part of me wants to just say, "Oh, right, Vista stinks". But that kind of grumbling won't solve the problem.
Anyways, it turns out Vista didn't like that I was using the TCP_NODELAY socket parameter when connecting to the master server. I'm still a little mystified about why Vista doesn't seem to support this parameter, unless Vista does non-blocking sockets in some other way.
Once again, this fixed the problem. Vista users could now connect just fine. Ironically, since my previous problem required me to implement concurrency to networking, it was not a problem that the socket was not non-blocking. Again, not a satisfying victory. Oh well. 
Despite my ironic tone, I am actually very happy about the outcomes. Two of my longest-standing bugs are finally quashed, the the game has become a little more playable and stable.
Huge thanks go out to Patrik, my roommate, for all of his time helping me trace these bugs down, and of course to the kind folks who helped me test tonight. Yeah, you know who you are. 
| |
| Wednesday, February 11, 2009 |
 Ich reiche eine Prfung.. |
Posted - 2/11/2009 11:54:49 PM | It's that time of the year again! Mid-February to Mid-March is always ripe with midterms, which means two things: Reading Week and studying. I think that Reading Week is more well-known in the US as "Spring Break". Whatever. 
Tomorrow is my Intermediate German midterm, which I have been furiously cramming vocabulary into my head for for the last little while. I feel comfortable with the material we've covered though, so it should be just fine.
Next week is my Reading Week, which means a whole week's worth of time to study and otherwise spend time. I only have two midterms post Reading Week, so it won't be too intense. That means plenty of time for adventures and, of course, Skirmish Online development.
The last couple of weeks of development have been spent implementing concurrency into the game. More specifically, multi-threading the networking portions of the game. I had noted that there were occasional slowdowns in gameplay due to some (unavoidable) blocking in the UDP sockets. This was a big problem for people on lower-end hardware who got poor framerates already. We had already been studying threading and mutual exclusion techniques in my Operating Systems class this term, so I felt sufficiently knowledgeable to tackle the task.
I'd like to talk about the problems and traps I adventured through in my next post, since I need some precious sleep for tomorrow's midterm. 
Gute Nacht, Leute.
| |
| Wednesday, February 4, 2009 |
 Stallman rocks the room. |
Posted - 2/4/2009 12:07:13 AM | Good evening, Journal Land. Has it really been a whole month since I last posted? Time has been flying for me since the new year got underway. University has (as usual) been a flurry of new and interesting material. 
Stallman talks freedom
Last Thursday we were visited by the illustrious Richard Stallman. Many of you, being active developers, have probably heard of him. He gained much of his fame from founding the GNU project and being an adamant supporter of free software for over twenty years. He is also the creator of the well-known editor, Emacs.
Mr. Stallman came to our university to talk about free software and the GNU project. Myself and a friend, having had decided to go (naturally!), were quite excited to hear what Mr. Stallman had to say. Upon arriving in the theatre where he was to appear, we learned that his plane arrival was delayed due to weather, and ended up waiting an hour and a half for Father GNU to arrive. I busied myself with a near-due combinatorics assignment, so it wasn't so bad.
Anyways, Mr. Stallman finally arrived, and there was a very strong applause. U of W is renowned for its allure to Computer Science majors, so we had a big audience that were all quite excited to listen to Mr. Stallman speak.
The first part of his talk was focused on defining what exactly free software is, and why it is important for our society. So far so good. He mentioned the four freedoms that are granted to us by free software: it can be freely modified, it can be freely distributed in its original form, modifications can be freely distributed, and of course, it can be freely used and its source-code freely read. This does not sound like a big deal for people who are not programmers, but Mr. Stallman claimed that since there are communities around these products (usually), there is still the ability for others who CAN program to make modifications on your behalf. Mr. Stallman was very adamant about proprietary software being an evil that takes away one's freedom. Even the exclusion of one of the four freedom constitutes a product not worth using. He argued that not using any and all software that is not free (as in speech) should never be used, regardless of the sacrifice required. He was very adamant about this.
He was doing a good job convincing me until he mentioned that last point. I think that free software is a fantastic thing, and while I do not actively support it, I support the idea of it by using many different pieces of free software in my day-to-day computer usage. Still, to bar oneself from using ALL forms of proprietary software is no solution. Proprietary software has the benefits of being developed (usually) by a far more organized, experienced, and well-equipped team than a free software team equivalent. This is simply because of one thing: money. Free software is (generally) developed for free, in developers' spare time. It's undeniable that many companies work with and develop free software as well, though. With hundreds or thousands or millions of dollars and structured organizations behind these proprietary products (that includes commercial video games!), the level of quality and technological achievement greatly surpasses where the free software community stands. Does Mr. Stallman suggest that we all live five or ten years in the past and use those product simply because they preserve a set of arbitrary freedoms that he created? Plus, I've never seen any free software attractively shrink-wrapped. 
Mr. Stallman also had a segment on the history of the GNU project. It was interesting to learn that the GNU project was originally paying a developer to create a kernel for their operating system, but they ended up seeing Linus Torvalds' kernel, Linux, as a more feasible option. It turns out that Mr. Torvalds' kernel was not originally entirely 'free software' by the FSF's standards, so it was only a time afterwards that Mr. Torvalds ended up changing his kernel's license that GNU adopted it into their operating system. That's where Mr. Stallman suddenly grew very bitter. He was (still!?) very unhappy about how the public generally mistakenly began calling the GNU operating system with Mr. Torvalds' kernel "Linux". This perpetuated itself, and even today the operating system is most commonly referred to as Linux. I think even I am guilty of this misnomer. However, he still seemed very displeased that Mr. Torvalds received much of the fame of his and the FSF's hard work, and mentioned how many people mistakenly believe that Mr. Torvalds was the original father of free software, rather than Mr. Stallman. He also asked of us to call Linux "GNU/Linux" or "GNU+Linux" whenever we refer to the operating system. This was definitely the low part of his talk.
Things went up from there. He donned a robe and a placed a giant CD-ROM on his head, made to resemble a halo. He then jokingly introduced himself as Saint IGNUcius, of the Church of Emacs. He made several jokes that got a good laugh from the audience, such as "'vi vi vi' is the number of the Beast", and "using vi is not a sin; it is a penance". Hyuk hyuk. 
He closed his talk in a rather unexpected manner: an open auction. He had brought several items with him to sell in order to raise money for the Free Software Foundation. A plush GNU gnu (hah!) was sold for $75, a signed hardcover book of Mr. Stallman's (I forget which, alas) for $95, and afterward softcover copies for $25 each. There was also a booth outside of the theatre selling free software merchandise. I think they did pretty well that night. I didn't buy anything, as per my rights as a free software user. 
Finally Mr. Stallman requested questions from the audience. Things got pretty hairy here. There were several audience members that disagreed with the reasoning on some of Mr. Stallman's points, which I grew disappointed with how he handled. He became very outspoken, evangelical, and actually quite angry about anyone who disagreed with him on any of his points. In all fairness, though, he answered several (much more neutral) questions quite well.
Overall I am very happy that I attended the talk, even if I don't completely subscribe to Mr. Stallman's philosophies. I feel that I can appreciate free software more fully now, and understand the history of a behemoth like GNU/Linux (heh) much better. Despite it all, though, you still won't catch me using Emacs. (Okay, well, not too often.)
| |
"Good night, Monster Land."
"Good night, brave warrior."
|
| S | M | T | W | T | F | S | 1 | 2 | | 4 | 5 | 6 | 7 | 8 | 9 | 10 | | 12 | 13 | 14 | 15 | 16 | 17 | 18 | | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | | | | | | | |
OPTIONS
Track this Journal
ARCHIVES
August, 2009
July, 2009
June, 2009
May, 2009
April, 2009
March, 2009
February, 2009
January, 2009
December, 2008
November, 2008
October, 2008
September, 2008
October, 2007
September, 2007
August, 2007
July, 2007
June, 2007
May, 2007
April, 2007
March, 2007
February, 2007
January, 2007
December, 2006
November, 2006
October, 2006
September, 2006
August, 2006
July, 2006
June, 2006
May, 2006
April, 2006
March, 2006
February, 2006
January, 2006
December, 2005
October, 2005
September, 2005
July, 2005
June, 2005
|