Multi-Version Compatibility #179
Replies: 1 comment 19 replies
-
If we did want this feature, I believe there are two fundamental ways to implement it in a viable manner with C# for this game. 1) Ifs and lookup tables We do runtime checks for packet changes and dynamic lookups for enum values. Over the years I've come up with a way to handle enums that doesn't suck completely, which I'm using in other projects, and it works pretty well in my opinion. For example, here's what a packet sender might look like. public static void ShowEffect(Character character, EffectId effectId, EffectParameters parameters)
{
if (Game.Version < 20050311)
throw new GameVersionException("Not supported by this version.");
var networkEffectId = MEnum<EffectId>.GetValue(effectId);
var packet = new Packet(Op.NET_SHOW_EFFECT, character.ObjectId);
packet.PutInt(networkEffectId);
if (Game.Version >= 20060802)
parameters?.AddTo(packet);
character.Region.Broadcast(packet, character);
} The StopMusic
PetGaze = 1000
PetBuff
#if VERSION >= 20060801
MagicalMusic
PetPvp
#endif
Curtain This is one way we could handle enums. In the context of ToS, we could look at the property ids for an example of how this might be used. In the normal code, a normal enum would be used, but when the properties are supposed to get sent to the client, we look up the value the property id should have for the currently selected version and send that instead. Maintaining the enums would require some effort, but I believe it's manageable, and throwing in a few simple ifs when adding new packet fields isn't that much work. 2) Branches This option was suggested by Tachiorz back when we first discussed this. Basically, we would have compatibility branches for certain versions, so if you wanted kToS support for example, you might use the branch I imagine that with this approach, you might keep one branch that is relatively free from version dependent enums, and then create branches off of it, that add the version dependent files, like ops, properties, etc. Finally, you might make master the default compatibility branch for the latest iToS, since it will be the most-used version for us. This approach would presumably be pretty clean, but it would require a lot of branch hopping and potentially confuse users and contributors. It would also let us only support so many versions, because we can't viably create dozens or hundreds of compatbility branches. Non-Viable Two options that aren't viable in my opinion are |
Beta Was this translation helpful? Give feedback.
-
Supporting multiple versions of a game's client is difficult. It's a lot of work and it can be complicated. However, especially in a game that has changed as much as ToS has over the years, such functionality might be highly desired by users. Maybe you want a feature back that was removed, maybe you want to use a client from a region that isn't supported anymore, or maybe you just want to experience the game as it was during the beta. There are situations where modifying the client a little bit doesn't cut it, or where readding features would take a considerable amount of work. Not to mention that not every user has the technical knowhow to do these changes.
Originally, we just started emulating iToS because that would become our hometurf, and we were too busy getting the basics to work to worry about keeping multiple clients compatible. That being said, if we do want multi-version compatibility... it should be kept in mind rather sooner than later, because that decision will affect the design of several systems, and adding support for it later on might get messy.
Advantages
Disadvantages
This was already briefly discussed once in #47, but ultimately I decided against it at the time. That was pre-Rebuild though, and I'd like to point your attention at the first comment on that issue.
The game did last longer than 5 years, it did already have one major update that is on the level of Renewal, and I would wager that quite a few users might be interested in going back to pre-Rebuild. Not to mention all the other smaller changes, and who knows what will come in the future.
Beta Was this translation helpful? Give feedback.
All reactions