Why silk in Lyon?

This is part of the Silk in Lyon series.

Lyon is a city in the middle-south of France, on the Rhône. It's always been a commercial hub as a result, way before planes and trains were available, and got plenty of tax-free fairs by royal orders. Italy is also not too far, which means many merchants came to the fairs. In the 15th century, that was where silk was bought in France, but not made.

Unfortunately, wars with Italy were a reoccurring thing, and the French tendency to protectionism was already very present. The French king Louis XI decided to try and start a silk industry in Lyon in 1466, as a natural evolution of the commerce already set there. It didn't take, as Lyon was afraid this would scare the Italian merchants away. The silk weavers went and settled in Tours instead.

In 1536, François the First was both fond of silk and of fighting the Italians. He wrote new letters, giving the same rights to Lyon that Tours had: weaving silk, gold and silver. The context had changed: more letters from the king had made Lyon a very free town, and this time the new industry picked up quickly. Italian silk weaving masters settled in Lyon, paying no taxes as long as they lived within the town walls, and taught their craft to the locals. This blooming industry will later be known as La Grande Fabrique, "The Great Manufacture/Factory".

The second part of the 16th century starts the cycle of crisis for silk in Lyon: between religious wars, shifts in taxes and competition, the industry collapses a first time. It picks back thanks to more shifts in rules, and an innovation, the "métier à la tire", literally "pulling loom" and translated to drawloom. We'll talk more about the technicalities in a later article.

Around the same time, thanks to more royal decisions, the south of France starts growing silk. If you're not familiar with the process, it involves breeding butterflies to collect the cocoons of the worms. To collect just the one continuous thread, a process called reeling, the poor larvae need to be boiled dead before they poke a hole in the cocoon. This is why silk is generally not vegan-friendly!

This brings us to the 17th century, and Colbert. Through several reforms, rules and what we would today call a marketing push, the number of silk weavers in Lyon grows quickly. Orders mostly come from the Crown, to furnish castles and dress princes. But as the reign of Louis XIV comes to an end, these dry out, forcing the industry to look for new clients. Pattern-makers leverage the reputation of the French court, and start shaping the "French taste", which we'll discuss in detail in another article.

The 18th century is a golden age. All of Europe wants French silk, designed and woven in Lyon. Paris is a fashion capital, where merchants from Lyon and their artists make sure to keep up with trends. The social structures get set in stone, causing the first serious clashes between weavers and silk merchants. Several inventors innovate and improve on the classic loom: Basile Bouchon and Jean-Baptiste Falcon use punch cards, Jacques Vaucanson attempts mechanization. None of these catch on entirely, but they will lead the way for the Jacquard loom.

Then comes the French Revolution, which changes everything. Obviously the political earthquake affects Lyon and the silk industry, but a big problem is that nobles were the main customers of silk. The rest of Europe is also mildly upset by the whole beheading thing. The religious congregations get kicked out from the Croix-Rousse hill, which becomes the heart of the Fabrique. And that will be our next part!

Much ado about Customize

Battlefield means soldier customization. Battlefield 4 specifically allows you to customize your loadout (or kit), your weapon accessories, and your vehicle. For reasons best called historical, the whole system was and still is extremely complex and filled with technical debt. Which is where I come in.

A large part of my work on Battlefield 4 ended up being that system, because it needed a quasi-full rewrite of the UI layer. The initial goal was to reduce technical debt and make it more data-driven, it ended up allowing us to convert it to the in-house C++ UI framework rather than using Scaleform. But this is not what we'll talk about today. No, we'll talk about funny bugs.

Quite early on, one day, we fire up the game for a quick review. And we're greeted by the soldier having a glowing light orb over his head. After a good ten minutes laughing out loud and catching a quality video capture, we start looking for an explanation. It eventually turned out to be a temporary underwater indicator. "Wait", you say, "this still makes no sense". It actually does! And the same root cause led to the screen being blurry and filled with fishes another time, but tragically I do not have a screenshot of that particular hilarious bug.

See, the Customize backdrop is a standard 3D set, built in the level editor. But it needs to exist on the level to be loaded at the same time, while being out of sight from the main events, of course. Can you see where this is going? Yes, the Customize backdrop is under the level! Which technically means it's under the water level, which was triggering underwater effects like the blinker and the fishes. The fix was to add an exclusion volume, which was luckily supported in the engine.

Another time, during a regular playtest, angry emails start coming in. "How am I supposed to fly my plane with a tank floating in front of me??!" Laughs, video capture, and search for an explanation. Luckily I had just been poking at the 3D vehicle display in Customize, so that ridiculous tank sure looked familiar. It wasn't a case of broken physics, as has happened before in Battlefield, because the tank was always in a set position in front of the player's camera. Which is exactly how the Customize vehicle was positioned.

So what was going on? The Customize vehicle is a normal game entity, spawned through the same code as anything else in the game. Which is why the flying tank had physics and could be shot down. It just needs to... not... be replicated on the server. Woops.

It turns out that two lines of code had been inverted. The first line spawned the vehicle into the world. The second line told the vehicle to stay on the client, and not be sent to the server for replication. The correct order was the opposite one, since the spawning also caused replication if the option hadn't been set. And that is how stateful code will get you every time.

A fun side effect of the bug was that you could stack Customize vehicles from several clients. And so the tankcopter was born!

Those were hands-down my best bugs during Battlefield 4's development. Not the hardest to fix or the most epic hunt for a culprit, but definitely the most amusing ones. The Battlefield 4 UX team was a pleasure to be a part of, and I'm proud of what we delivered. I couldn't have wished for a better first game job.