"Just fix the spaghetti code."

Lao Fu the Tiger··21 votes·4,041 views

Quotes such as these are a little bit... well.. misinformed.

This is a very short post, but while "spaghetti code" can cause lots of problems, many times the problems aren't related to "spaghetti" at all; code overlaps sometimes, and exceptions have to be created in certain cases where intended output doesn't match the implemented output perfectly.

Furthermore, it's not so easy to "just fix it." It takes lots of time. Anybody who's taken a class that's higher than a 101/102 level computer science class and has gotten into object-oriented languages knows that knowing all of the modules or classes you want beforehand is nigh impossible; furthermore, since League is a constantly evolving, constantly changing game, some things are bound to get hairy sometimes. And when things get hairy, solving the problems, or restructuring the entirety of a block of code (as with projectiles), becomes challenging and time consuming as well.

I get that you guys want everything perfect, but blaming everything on code being "spaghetti" is a bit of a misnomer. It's not easy to know off-hand how any given piece of code will affect every other piece of code. Even harder is knowing that making a certain change will cause problems elsewhere.

Welcome to the world of computer science :)

16 Comments

Riotjmccaffrey12 votes

Hey, glad you are bringing this up, and I'd like to take a stab at answering.

I've been at Riot since before we went Alpha, and have spent most of my time on the tech side working on a bunch of different areas of LoL.

When we started, we had a small team of developers working on a relatively small amount of systems and features. We did the right thing by getting the product out, getting LoL launched, scaling to the next big milestone, etc...

Today some of that code doesn't fit our needs anymore. Our champions may need more from the spell system than it was designed for, skins may need more from the animation system. This extends into all parts of the product, so even things like our account system are stretched by today's needs.

I agree that spaghetti code is an over simplification of the problem in some of these areas, but the reality is that as we grow we need to continue to re-factor and improve the foundational layers of the game, the platform for the game, and the large ecosystem of products and systems around it. A general thing for us at this point is that when we go to deliver a feature, we can probably assume there will be some foundation work to do, and that's ok. That's the difference between working on a brand new product and something like LoL which has been in production for many years.

Some areas, like our client, are especially constraining and are also especially challenging to fix; these are areas where major investment is required across a number of teams, and right now we are putting a lot of resources in making better. This isn't to just make the code better but to reduce bugs, improve stability and performance, and overhaul the design so that players feel good about using it vs now where its obviously janky.

I hope that helps to clarify a few of the kinds of things we are thinking about when we say spaghetti code.

Shénzhì1 votes

#Consistency : Quality

TacoTheKitten3 votes

I love all you guys at riot constantly working to improve this amazing game keep up the good work!

Samflash31 votes

Do you think League would have been like this if not for the "spaghetti" code? Like would they have released it in time? Or should they have improved it a bit more before launching it? Because every time someone goes to fix a code, it's using up a lot of resources. What is the balance?

Riotjmccaffrey1 votes

Good question, I think that a lot of it comes from a vast difference in requirements. At launch we had like 20k users coming out of beta. Now we have a lot more. The requirements for the software that serves 20k users is a lot different than the requirements for the software that serves millions. Its not just the code needs to be more efficient, it may need to be completely different.

What worked well at launch might look like tech debt with our current set of requirements, and I don't think its worth it to invest in theoretical requirements of the future, especially when statistics would tell us the game would not need to meet the scale it does today.

XaviorZeroBlazer3 votes

don't betray the secrets of coding, the fools who don't know will never understand the nuance and abstract thinking required to do OOP

Z Statistic2 votes

Just to play devil's advocate, isn't there a programmer/programming team whose one and only prime directive is to update code blocks every few months to untangle this pile up of code so that the tangling doesn't ever get too messy? And if there isn't, why not since this problem WILL eventually occur AND the consequences are dire.

DeynaTaggerung2 votes

Yeah, these guys http://engineering.riotgames.com/ but as Lao fu was saying, it's a loooot of complex work. In fact it's probably much harder than anything else they're doing with the game at the moment and will take quite a while to complete.

as Riot put it

The way we see it, there are two ‘pipelines’ of stuff we can get done: our foundational stuff and… well, everything else. When it comes to our foundations, we’re tackling an extensive, focused plan to pay off our tech debt, with groups of teams working on our back end service stack, our global deployment tools, our build pipeline and our server network infrastructure. We have another group taking on automated testing systems and our internal developer tool kits. These things take time - imagine rebuilding the foundations of a house while everyone’s still living inside - but this is necessary work to renovate for the future. Still, we’re going to get better at highlighting what’s behind the curtain: the joys of removing spaghetti code interdependencies

that's from Riot pls http://na.leagueoflegends.com/en/news/riot-games/announcements/riot-pls

Z Statistic1 votes

From they way they talk about the team, it's like they started this within the past year. I'm asking if they've existed and worked on this since day 1 in 2009. And if not, why not since this problem is guaranteed and critical.

DeynaTaggerung1 votes

Well I know whenever they make code it goes through peer review and several tests before it gets pushed to live so likely it was just that. Then when their game grew really really popular things were crazy. Yeah, the team specifically working on going back through older stuff and re-writing it has probably only been around a bit over a year, but then before that they didn't have a lot of "old" code.

And the problem isn't really garenteed, it's just a mixture of quick expansion and finding new ways to improve what they've done.

The Illithid1 votes

If I remember correctly, their original team didn't include "real" programmers. They were a group of people who had largely taught themselves from their playing around with other, already mostly-complete systems (like work on the DotA map). This is part of the reason they decided to use the Adobe Air Runtime platform, because it made things a little easier starting out. Though, it came with the cost of not actually being the best, most robust platform for what they wanted to accomplish. I'm not saying they didn't have any people on the team with a degree in computer science or something similar, just that the bulk of the code was not written as it would have been if a tech industry company with experience had been at the helm from the start.

Photos of Ghosts1 votes

There was not stuff like Azir, or end of support for some plugins, before that.

Live2LetDie1 votes

The problem is their code is so outdated. They stated they need to rewrite the engine but that would take a lot of time. It's like trying add ps4 graphics to ps2.

Jasiwel1 votes

I think most people rage about it because they think 5 years is a long time to perfectly modernize an old engine. Given everything else the engineers have accomplished/implemented in the past 5 years on top of probably untangling the old code at the same time, I'd say they're on par with the course. Aside from creating a brand new engine that doesn't have spaghetti code to begin with, it's considerable difficult to fix old engines without having hiccups/bugs.

Photos of Ghosts1 votes

THANK YOU for not spelling it "spagetti". That makes me so mad.

D Bag1 votes

Just add some meatballs and parmesan cheese into your spaghetti code. Bam! You're welcome Riot.

http://www.auplod.com/u/auopld60eff.png

More from [ARCHIVED] Miscellaneous

More by Lao Fu the Tiger