Today, I am outing myself as double geek: I play the on-line game World of Warcraft, and I love programming. As you’ll see, there’s a connection. Both are endeavours that can be pursued also on, or from, a small island in the middle of the Indian Ocean.
I feel this might be a longer and geeky post, even if I only scratch the surfaces.
World of Warcraft
World of Warcraft, or WoW, is a multi-player role-playing game. There is an open 3D-world, full of wonders, dangers, challenges, and magic, called Azeroth. Your character – that’s the person in the game-world you role-play – can freely move in it, doing quests (achieve certain objectives), or cooperating with your friends to accomplish tasks that you alone cannot. Your friends, of course, are the characters in the game-world being role-played by other (real, human) people all over the (real) world.
WoW is a deep, complex game, not a simple first-person shooter. I might write more about this in another post. There are different races of people, such as humans, or night elves, and you can be a hunter, a warrior, a druid, a shaman, and other such classes. Each class has different abilities, strength and weaknesses. You need to learn professions, and earn money, to create items you need and to make a living. There are different languages. There is quite a history (lore) behind all what’s happening. In short, to be good at this game, and to enjoy it, you must invest quite some time. It’s not for the casual gamer. I have been playing WoW since 2009.
My main character, Ygrayne – if you’re also a geek into celtic culture and sagas, you recognise the name of the mother of King Arthur, and his half-sister, Morgaine, priestess of Avalon – is a night elf druid healer. She can shapeshift into animal forms, such as a Raven. How cool is that?! I am a bird, I can fly! I am from Nighthaven, my native language is Darnassian, though I also speak the Common language to communicate with other races.
Healers casts spells to heal their friends in combat when they get injured by the opponents. FWIW, a healer is my model of a manager: your team must assume their responsibilities and be able to do their jobs, but you enable and support them, provide and keep up the needed context for them.
So where’s the connection to programming?
Well, WoW provides a the possibility to extend your game-experience with so called addons, little programs to support your gameplay. They are created using the programming language Lua. I love Lua. It’s a brain-child of a very small team of people, which shows in its consistency and elegance. There’s no standards committee blurring and bloating the concepts and their implementation. The run-time system is a few hundred kilo-bytes of executable code (yes, that’s kilo-bytes). Everything is simple and clear, you’re in full control. In this respect, it’s comparable to Modula-2 and its creator, Niklaus Wirth. I loved Modula-2 as well, back in the day, when programming fault-tolerant real-time systems.
As healer, I need to see how my buddies are faring in combat, ie. what their status is, and I need to cast my healing and supporting spells on them (isn’t it awesome to be able to cast spells?!). For this, healers use a so called raid-frame, which is basically a matrix, in which each cell represents a team member and their status. Clicking on a cell casts a spell. As I have many different kind of spells, I need to be able to click with all three mouse buttons, rotate the mouse wheel, and modify these actions with the shift, alt, or control keys on my keyboard. I – that is, my character, but in-game, I am my character – move around using my left hand on the keyboard, unless for special cases of complex movement, where I use the mouse.
Having used raid-frame addons of other developers, a good year ago I decided that I wanted to create my own. For the fun of it. For the love of programming. To have exactly what I want. While I had some Lua knowledge and skills, I didn’t know anything about addon programming. So I embarked on that journey.
Raid-frames are among the most complex addons for WoW. The size of your team can be anything from five to 30 players. In combat, there’s a lot going on, and your raid-frame needs to keep up, monitoring thousands of events per second, and scanning a pletora of status values for all your buddies each second. And you need a clear graphical user interface to represent all this, as you must make split second decisions, and take actions accordingly. And as Blizzard, the creator of WoW, does not want you to automate the gameplay, your addon cannot simply call a Lua function to cast a spell, but must be integrated into an elaborate security framework, which allows the game run-time system to control and limit your actions. For example, some program code needs to be passed as text string, and the run-time will compile it for you. Or spell casts must be predefined in a frame, which can be checked a load time.
Long story short, after some initial trials I came up with this design, where each cell in the matrix, representing a team member, is an autonomous software unit, that assembles itself when a player joins the team, and that will do all the monitoring and spell casting upon click just for that player. The different functionalities are provided by independent modules, or classes, which are instantiated by the autonomous agent per team member as needed. Some platform-level modules provide common services for the functional modules.
I have been a sucker for simple, non-convoluted software solutions, and the related conceptual and structural aesthetics, all my life. In this respect, I am happy with what I came up with. Small footprint. Easy to maintain and extend. And it works like a charm.
Real testing can be only done in-game, as I need groups of people, and real combat. Software testing through game-play – does that sound like fun?!
So there you have it. My geekdoms coming together in a symbiotic way. Twice a week, I raid with my online friends, late at night, and extend and tweak my addon in between, if needed. All for the epic goals of Azeroth. :)
Ah, and by the way, speaking of geekdom, my addon is called Asha, after a female character in the Game of Thrones books.