This is The Mechanic, where Alex Wiltshire invites developers to discuss the difficult journeys they underwent to make the best bits of their games. This time, Football Manager [official site].

Do want to play a cavernously deep simulation of a world of viciously competing factions? Do you dream of leading your people to glory and dominating all comers? Do you relish bending complex systems of law to your advantage? Do you savour the idea of surveying the world for the sharpest operators and spying on your rivals’ smallest decisions?

Forget Crusader Kings 2. Its network of aristocratic machinations is a kid’s toy next to Football Manager. And nothing in Football Manager is quite as vast and encompassing as the transfer market, in which hundreds of thousands of players, scouts, agents, and managers live out digital careers in an international scene of countries and leagues. 25 years in the making, Football Manager’s transfer system is a blend of artificial intelligence, maths and hard data, and it’s designed to simulate the real business of football, behaving credibly into an infinite future of football. “We haven’t perfected it,” director Miles Jacobson tells me. “But we’re pretty close.”

The transfer market was a major reason why the original game, called Championship Manager, took off. Even as it was being developed by brothers Paul and Oliver Collyer from their bedroom in 1992, the aims of the series were set. Its tagline was “The most realistic football management simulation ever!” And that was reflected in its transfer market. Typically, management games of the time would offer each week a random player at a random price to choose to buy, but Championship Manager featured a flexible market which acknowledged that players don’t have a single value for all comers. Just as in the real world, a player can be worth very different amounts to different clubs.

Jacobson illustrates the point with a modern real-world example: “One club chief executive told me this summer that he got a friend of his in Spain to phone up a club in France to find out how much they’d sell a player for, and they were quoted €6 million, and then when he phoned up, he was told €16 million.” Over the years, as regulations have tightened and Football Manager’s own ambitions have expanded, it has grown to model all of the causes of phenomena like this; they’re incredibly expansive and even to someone as unmoved by football as me, they’re fascinating.

There are economic effects, as illustrated by Jacobson’s story. English clubs are simply richer than most others across the world, so they’re charged more money for players. Competition comes into play, too. A local rival or the clubs in the same division will likely want more money for their players because they see them as a challenger to their positions.

Some of the variances in value between countries are down to them having different registration rules, which set how many foreign players can be in a squad for domestic matches. On top of the individual rules imposed by each country’s FA, all teams competing in European competitions sanctioned by UEFA need four players who were homegrown in the club’s country, and four homegrown in the club itself. Some of these rules didn’t exist when Championship Manager first appeared. There wasn’t even a defined transfer window, setting the times of year when clubs can register new players in their squad.

Then there’s the world of contracts. Another of the original Championship Manager’s innovations was the ability to set up contracts which paid a weekly salary and then awarded bonuses on scored goals. Now there are hundreds of possible clauses, including minimum release fees, which set a minimum for the amount another club can bid to buy that player. They can end after certain dates and a new minimum release fee release clause can be set for the season afterwards. The possibility space in which managers can manage their funds, attract players and massage their morale and drive is extraordinary.

There’s the personal world. When a club makes an offer on a player, does that player believe they will reach their potential at that club? Do they believe that club will be a stepping stone to better things? Will they be happy there forever? Do they think they’ll actually get to play or will they be stuck on the bench? Some personality types want to play every week, and they’ll take less money if they’ll be getting the chance to be on the first team. Other players are out there to earn as much money as possible. Some think they’re not going to be good enough to play and see a chance to rinse as much money as they possibly can out of the contract. A younger player might have huge belief in their ability and settle for lower salary but a higher appearance fee. And then there’s the human side. Players can get homesick, and they’ll look at the city and even the number of players who speak their language before signing a contract; if the club doesn’t seem like a good fit, they might not go.

All these factors are constantly churning in Football Manager; each manager, scout, player and agent is weighing them up and making decisions. “It’s an incredibly complicated and complex part of the game because all of those clauses require believable AI,” says Jacobson. Any decision you can make in the game, the AI can, too. The contractual clauses have to be believable, and since you and all these other actors are all in the simulation, everyone is responding to everyone else. “The amounts of maths in the game is absolutely incredible. We should’ve thought a few years ago of selling to Google as an AI company rather than becoming part of Sega.”

The decisions around the transfer market are based on a process called shortlisting. Clubs look through their squads and their players’ abilities and then, limited by their scouting knowledge and reach, look at other players in the world to see the options they have to improve themselves with the resources they have available. Scouting means that some clubs have better knowledge about the world than others, but still, when it comes to transfer deadline day, the game can slow to a crawl as every club in the world is re-doing their shortlist.

The detail in all these systems is where Football Manager’s magic is, the deep and involving play that satisfies millions of players who on average sink 200 hours a year into the game. Right now, Jacobson is managing a club which is about to get stung by a £5 million financial fair play fine because of the high salaries he’s paying. But he got into a European competition, which means he needs more talented players in his squad. “I knew I’d get a fine and what it’d be, and took it into account with my transfer spending. I’ve spent £5 million less than I could have and I won’t get in trouble with my board at the end of the season.”

That’s why Football Manager focuses so much on reality. When minimum fee release clauses started appearing in the real world, Sports Interactive jumped to ensure the AI could start putting the same clause into its contracts. And when Neymar’s move from Barcelona to Paris Saint-Germain cost €222 million, making him the world’s most expensive player, they had to ensure the AI could be capable of making a similar deal.

And in reality, there are little tactical nuances, such as a well-known way of finding great players for low, low prices in Romanian and Ukrainian clubs, another real-world quirk that seeps into the game. Or there’s a get-rich-quick method for Venezuelan clubs, whereby they can sell their players to Spanish clubs, which can get European work permits much quicker than other Euro countries. By putting a sell-on fee on their original contract, the Venezuelan club gets a nice bonus when the Spanish club sells those players on to a rich English organisation at a higher price.

Jacobson sees such tactics as features rather than problems: “They’re not really exploits, unless the real world is an exploit, and maybe it is.” And it all naturally balances out through transfer regulations and wider economic shifts (“when Brexit kicks in, you might not have the ability to do that any more”), and the fact there’s a limited supply of cut-price superstars anyway.

Meeting the complexity of reality makes the system robust, with many little systems performing individual checks and balances that tend to steer things correctly. But Football Manager also has to take into account player perception. Injuries, for example, occur at 80% of the rate they do in the real world because players, who experience seasons across hours rather than months, don’t find the real rate credible (in fact, they often believe the game’s reduced rate is too high). As for the transfer market, the simulation doesn’t feature inflation, other than in one league, the American MLS, because it came as part of Sports Interactive’s licence.

“The rest of the game we keep at real-world values because inflation is a bitch, and perception-wise, if a player when you start playing the game is £5 million and then, 13 years down the line, is £50 million, that’s not going to sit right with the believability, because people always base their knowledge on what’s in the real world, not on what’s going to be there in the future.” Jacobson maintains that the lack of inflation is also part of Football Manager’s general drive to transparency: if some system goes haywire and the market combusts, Sports Interactive could blame it on inflation, and that wouldn’t be cricket (football) at all.

He describes all these interlocking systems as a ‘giant jigsaw puzzle’, and as a whole it has, by and large, grown organically over time, with new systems being bolted into it. They’re tested and tweaked until they behave credibly, through automated testing and overnight soak tests, with the systems outputting data on spreadsheets. But the team also plays the game, because it reveals problems that are easy to miss in reams of data. For example, there’s just been an issue in the beta of Football Manager 2018 (the full release is this Friday) where every new goalkeeper it generated had a rating of one for passing. It was just a bug, but if beta testers hadn’t been playing six years into the build, they’d never have noticed.

But six years of play is just the tip of the iceberg when it comes to how long Football Manager is engineered to remain believable. It’s meant to be played to infinity. All through that time, the transfer market has to keep churning, and the players in it have to maintain that balance of great and middling and bad, with the odd wonderkid from Angola appearing to keep things spicy. As you might imagine, planning for infinity isn’t easy: “The problem with wanting it to be infinite is that every game is different. It’s bastard-hard to get right.”