Update:Blog - Clan Updates: Engine Support
This blog was written by Mod Srowley and dates to 7 February 2011.
When we first started thinking about the clan updates, and the engine infrastructure work that would be needed to make it work, it sounded relatively straightforward.
We already had a system that handled cross-world communication between groups of players (the friends system), we could treat a clan and a clan list as being analogous to a player and their friends list, so all we needed was a slightly modified version of our player saved game and friends systems and we’d be ready to go!
How wrong we were... When we started to take a closer look at the details of the implementation, we realised that, conceptually, a clan is a much more complex idea than the player, and that we would have to think very carefully about how the software architecture was to be designed to make the system workable.
Why are clans so complex?
Firstly, only one player needs to access a particular player's saved game at any one time. Clan data should be accessed by many players, who might be in different game worlds. This is a more complex problem for RuneScape than some other massively multiplayer games, because we do not lock players to individual game worlds. Clans will be made up of players who could be on any game world at any time. We cannot store any clan data on the game world, we have to store it somewhere that's accessible from anywhere.
Handling data that can be accessed from lots of different places is tricky. It is easy to create race conditions (if you're unfamiliar with race conditions, check out this Wikipedia entry). The problem is that when you have multiple players trying to change the same piece of data at the same time, you can end up with clan data being out of sync or, worse still, corrupted. So, for example, say you want to change the rank of a player in your chat channel. Currently, only the owner can do this, so there is no potential race condition, but as soon as you allow more than one admin to change ranks, what happens if they both want to change that player's rank at the same time and to different things?
As an analogy, imagine you're at an airport check-in choosing your seat. At the adjacent check-in desk, someone else is doing the same. Let's assume you’re both first in line, so, when your check-in assistant opens the list of reserved seats all are empty. What happens if both of you choose seat 1A at the same time? If both of you got to reserve that seat, that would be the worst race condition error (and would lead to one of you getting very annoyed when you got on the plane to find someone sat in your seat).
Slightly less bad would be neither of you being able to reserve that seat. Ideally, though, one of you would reserve that seat, and the other would be told that the seat is gone before they left check-in. But that requires one check-in desk to know what is happening at the other in real-time. That’s a much more complicated situation than if there was only ever one check-in desk and one queue.
This has meant we’ve needed to work very carefully with Mod Michael deciding what every piece of clan information should be, where it should live, and when and where we need to read it and to write to it. Some forms of data need to be able to be updated live (changes made by admins, e.g. clan rank info), so need to be changeable from anywhere, and update itself wherever this is used. This type of data will live on a new Clan Settings server, which uses a ‘listener’-style protocol.
Other data, such as a clan's wins in Clan Wars, only needs to change whenever a battle finishes, and matters less if it is not updated immediately to all members of the clan wherever they are, so this type of data will live on a clan-specfic saved game profile, which only updates when we ask that server for the most recent information.
Secondly, we have to add an extra concept that the friends server doesn’t support, and that is the idea that a player can only be a ‘full’ member of one clan at any one time. One of the features we intend to provide for clans are highscore tables. We expect these will be an important way for clans to rate themselves against each other.
However, if we allowed players to be in more than one clan at a time, this becomes open to abuse. It could mean that players with ‘desirable’ stats would be recruited into many clans at the same time, merely to help with their position on the highscore tables, effectively making them meaningless. Mod Michael is, therefore, creating a system that will allow us to associate a player with a single clan, and for us to be able to check this on any game world at any time.
So, I hope you can see there is a lot of invisible engine work that needs to happen before we can provide you with the clan functionality you expect. This is happening, and we are solving lots of these types of problem as we come across them. At least we now have a pretty clear idea of what we can and will do, so now we just have the big job of implementing it all.