Sunday, September 13, 2009

Under the Hood of Our Kitchen Automobile

Just like almost all other muds in existence, the Sea of Storms runs by the grace of its volunteers. Most of the people inhabiting the mud today do not know those who started it, and I am one of those individuals. As such, the codebase I am toying with today has suffered 10 years of coding by different TSoS volunteers, and it shows.

It might even be said that Smaug is a crappy codebase from the beginning. Our version is well over 10 years old, and while we of course made our own modifications, the latest Smaug that was released has had bugs fixed and features added. Simply Smaug, without our realm-specific changes, is already a beast - no coder wants to venture into it if he values his sanity.

To give an idea of the things that many mud coders need to deal with, there is an abhorring lack of comments in the code, indentation exists in such a way that it tends to make the code more confusing, mysterious variable names, randomly hard-coded numbers, and oh, did I mention there are no comments? Think of a city where they speak a language you do not speak, and street signs are missing or beyond your ability to pronounce: the only way to get around would be to make your own map of sorts.

Especially for me, who never coded on a mud prior to joining the TSoS staff, it is really easy to get lost. Now that I am done with the city analogy, I will compare TSoS with a bowl of spaghetti. At the base you have Smaug, where every strand of pasta has a purpose but it is very hard to comprehend a bigger picture of how they all fit together. And when you get our own modifications, you can think of it as throwing some sauce into the mix, hiding even more from sight. The end result is very tasty, but to me, it feels as if I am preparing dinner while using someone elses leftovers. Mmmm, TSoS.

Take today's kitchen affairs for example... a player came to me and went 'yo, Kim my man. I can weary [[his]] ass off, but it is only my ass getting tired'. I went to investigate, and yup, somehow, weary had become a rather dull weave that didn't do much (besides tiring the weaver out). I quickly found the cause: yesterday, we had introduced some updates, including some new weaves. This required some changes elsewhere in the big file o' weaves, and numbers that basically define the importance of these weaves changed as a result. Oops.

Now, the Code is not supposed to check for any numbers in specific (they only rank the 'importance' of a weave), but one of our past coders had a moment of wisdom and decided that since refresh and weary were so much alike in effect, they should be very much alike in the code. Smaug isn't truly meant to turn weaves into such siamese twins, and using the number that signifies importance, he managed to make it possible to recognise a weary from a refresh weave.

Did all that go over your head? Don't worry, most people do not have the programmers mindset, and I figured it might be nice to explain a fair bit to those who do like to know how things work. But if you think this post is just pure junk, just log on @ tsosmud.org, port 7070, and send me a tell to inform me that I need to stop blogging.

- Kimadi

No comments:

Post a Comment