Title: The Difference EngineRating: RSummary: Sheppard remembered dying in Afghanistan, but since he was still walking around he didn't pay that memory too much mind. (Sheppard/McKay)Warnings: Canonical character death. Thanks and credit: To hija_paloma for Sheppard's euphemism translations, and to every SGA fan on my LJ for proclaiming there were tons of Sheppard Is A Robot fics, which turned out to be a cruel and unusual lie.

Tria Prima:An alchemical theory put forth by Paracelsus,that the universe is composed of three elements:Salt, Mercury, and Sulfur. In human terms,salt represented the body...

John Sheppard died in Afghanistan.

He remembered dying. He brushed it off as a psychological glitch, some kind of sympathetic reaction to Holland's death, a coping mechanism that let him get past survivor's guilt and failed rescuer's guilt and my friend's fucking dead okay guilt. He remembered taking fire, a bullet in his shoulder and one in his torso, piercing the liver, killing him, despite the fact that he hadn't been shot at all and had only taken a head injury, which left a scar but nothing more.

One of the base psychologists told him the liver was the seat of anger in some eastern religion or other, he hadn't been paying much attention. He was clearly angry at Holland for getting shot and himself for failing and the military for not backing him. Except really he wasn't, he was just sort of numb.

He was stuck on base through recuperation for the injury he did take and until the board reviewed his actions, but they let him keep flying, training hours with babyfaced kids and the occasional supply run, nothing in combat, nothing close to combat. The psychologists and doctors kept an eye on him, and he had a tendency to drift into the mechanic shop and fuck around with engines out of boredom, but in all it wasn't so bad. They cleared him for flight again, he flew again. Finished his tour. Got the fucking hell out of that godforsaken desert.

He'd felt like he could never get cool again, like he was going to spend his life eating sand and hot wind. He didn't care about winning the war, didn't hate the Afghanis or the Iraqis or anyone, he'd just wanted to fly fast things. Getting out was okay by him.

He put in a request for remote duty and found himself transferred to McMurdo. Antarctica. Cold. Awesome.

General O'Neill's handshake felt oddly comfortable and his face was familiar; he had a moment where he was uncomfortable that he couldn't place the General, but then he brushed it off as irrelevant, not like O'Neill would remember him anyway. And nothing mattered really except getting in the air, getting the helicopter up and fighting the wind and the updrafts on his way out to the science station. They didn't talk a whole lot.

Until a giant glowing penis with tentacles tried to kill them.

"Hey, so, that thing back there," Sheppard said, sounding more anxious than he felt, which was not anxious at all really.

"Drone," O'Neill grunted, as the elevator began to descend.

"Am I the only one who thinks it looks like a giant glowing cock?" John asked.

"That's the spirit," O'Neill said as they stepped into the science station. There was a brief look in his eyes, something clinical and studious, but it didn't last. He just got waylaid by some guy in glasses and told John not to touch anything and disappeared.

John looked around, scanned the faces and bodies, came to a conclusion: he was the new kid at school and it was lunchtime. Nobody was looking at him but everyone was watching him. Still, there was plenty to see down here, and he figured if he tried to do something that would blow them all up someone would stop him, so he wandered. Which was how he overheard a man talking about firing and deactivating the -- drone -- and discovered who his would-be attacker was. He really did want to be angry at Carson Beckett for being the reason he and General O'Neill were late that morning, but Beckett apologised and anyway he seemed like a nice guy, so after an initial flare of...of something, John let it go and took to studying the cool art-deco chair next to him. It was pretty interesting.

The impulse didn't come from anywhere conscious, but seriously, how dangerous could it be to sit in a chair?

A chair that moved and sucked his head back and propped his feet up and ooooh. Power.

He felt it not so much in a tingle along his skin or a sharpness in his spine but in binary dancing in front of his eyes and the feeling...as though he'd been on battery power and someone had just plugged him into the wall. When the sensation finally leveled off he found there were new faces in front of him, new but familiar -- a dark-haired woman and a pale man who talked faster than anyone John had ever met.

He knew that name almost as soon as it was spoken -- Doctor Rodney McKay. There was an intense familiarity about McKay, stronger even than O'Neill, but it wasn't like John got thrown together with astrophysicists very often and McKay would be kind of hard to forget.

He reached out to shake Dr. Weir's hand.

"Pleasure to meet you, John Sheppard," she said with a smile. An uncontrollable urge to protect her washed over him, startling him -- he hadn't felt anything that intense in months. And goddammit, really, where had he met McKay before? McKay acted like he knew him, knew his rank before General O'Neill even introduced him.

Major, think about where we are in the solar system.

***

The meeting never happened. Definitely not.

McKay didn't sit in the chair and stir sugar into his coffee while O'Neill wasn't reading through a results brief and studying the accompanying informative printouts.

"Enough crowing. You get to take your toy with you, just try not to break him."

"Short of death he's pretty difficult to break," McKay replied smugly. "The microwires might show up in an autopsy but not before, and if he takes a direct head-hit we'll have worse things to worry about than the cybernetics, but other than that..."

"You know, I've seen this movie, I don't think it ends well," O'Neill continued. "You didn't build lasers into his eyes or anything?"

McKay rolled his eyes. "He's autonomous, like any human being. We've programmed some...suggestions into his subroutines, and I'm not sure the emotions AI is functioning properly, but he'll chalk that up to PTSD if he thinks about it."

"You are one fucked-up mad scientist, you know that?"

"You asked me to build you a robot, General. I built you a robot. It's not my fault he's more useful to me than to you."

***

To the day she died Elizabeth Weir didn't know that John Sheppard had died in Afghanistan. There was no reason for her to know. McKay would have felt guilty about this, but he suspected if she knew she'd eventually find out about the subroutine he wrote into Sheppard, the ones that urged him to protect Elizabeth at all costs, and that knowledge just couldn't take any of them anywhere good.

The Executive Safety routine was superceded only by the Common Defence one he'd written in after arrival: Protect Atlantis.

It was very complex code.

***

The longer John spent with the people of Atlantis, the tighter he would bond with them as his neural net engaged its facial-recognition patterns and began filing away data to be incorporated into his Charisma circuitry. The preliminary test had been beyond Rodney's wildest expectations -- he'd integrated seamlessly into McMurdo, accepted the research station without hesitation, and lit up the Control chair like a Christmas tree. Aside from requiring some coaxing from O'Neill to join the mission (the Obedience program couldn't be too firm or he'd just be an idiot soldier, but it responded most strongly to General O'Neill), John was well ahead of the curve.

In the first few days after the raising of Atlantis there was a sort of informal Senior Staff dinner each night; not so much that they all wanted to sit together, as that they all knew that it made the underlings uncomfortable if the bosses sat with them. McKay sat on one side of Elizabeth, Bates on the other, Carson and the head of Botany, McKay couldn't be fucked to remember her name, across from them.

"You know I think this is the first time I've seen Major Sheppard eat in the mess?" Elizabeth remarked, gently indicating with her fork as Sheppard sniffed an apple, tucked it under his arm with a water bottle, and inspected the sandwiches.

"He's had a lot of catching up to do," Bates said stiffly.

"We should ask him over," Elizabeth suggested. Carson glanced at McKay and they shared a grin.

"No, not at all," Elizabeth looked surprised. Under the table, Carson kicked McKay in the shin triumphantly. "He's been nothing but friendly with me. I think we'll work well together."

"He's not bad," Bates put in.

"Hey! Sheppard!" McKay called, waving his spoon in the air. Sheppard's head whipped up sharply. It was true that there was a certain...intensity of gaze that could probably be tweaked, but McKay wasn't comfortable working on pure aesthetics just yet. There had been that one time with the early prototypes when someone decided a seduction subroutine would be a good idea and Zelenka had blown out three monitors trying to contain it.

"McKay," Sheppard said in measured tones.

"Come, eat. Do you want all that sandwich?"

This time Carson's kick was scolding.

"Nah," Sheppard said, offering him half.

"Thanks," McKay said, ignoring Carson's glare.

***

"And we have...sleep," McKay called, tapping on the laptop's keys. He'd remarked to Carson once, in a moment of downtime between surgeries, that he'd played piano as a child. Carson could believe it; McKay typed a hundred and forty words per minute (a hundred and thirty if the keyboard was unfamiliar), and you didn't get that kind of dexterity by accident. "Initiating remote connection."

Carson moved to stand behind the two men, comprehending perhaps a quarter of the readouts on their screens. He could barely code HTML, let alone rewire a cybernetic brain; his job was to keep John Sheppard's body alive and make sure the muscles and mechanics didn't interfere with one another in any way they weren't supposed to.

He knew every inch of John's body; he'd laid every microwire, patched up all three bullet wounds, led every major surgery on the Major's mortal shell. And from where he stood, his work was done. Any medical attention paid to John Sheppard henceforth would be strictly for injuries he had yet to receive.

"Boys," he said, clapping each of them on the shoulder, "It's been a long day. I am going to officially hand off the care and feeding of Major John Sheppard. Consider the medical withdrawn, with compliments."

"Is not much more to be done here," Zelenka agreed.

"Weekly monitoring," McKay replied. "We can cut it down to weekly. Oh," he added, intrigued.

"He's learning," McKay said proudly. "He's learning how to use his gene. This is great, until now he's just been storing memory. Now he's trying to cross-reference it and spontaneously generate new knowledge."

"Not trying, doing," Zelenka added.

"Congratulations," Carson said. "It's a boy."

***

It started as Radek's hobby, Artificial Intelligence, and blossomed when he was admitted to the Stargate program. The Ancients had a handle on AI technology, but didn't seem to make much use of it; between their hardware and the new software coming out of the top programming schools, Radek really just wanted to see if he could get a top-notch Sims game going. When McKay got bored (frequent!) he would join in, helping write new code, helping write code that would allow the program to write its own code.

Radek called it a virus and infected a small wheeled robot with it, the kind they were building at MIT. The robot had four wheels, four arms, an infrared sensor, and about a gig of memory. They left it alone for the night, left it on to see what it would do, and in the morning it had two more arms and a display screen for ease of communication, and they were down a monitor and half their spare parts.

"Don't you ever get scared?" Ford asked him once, on one of their early missions. Teyla and McKay were both asleep on the other side of the fire, and technically it was Ford's watch, but John wasn't particularly tired and he knew how boring watch was.

"Sure," John lied. "All the time. Especially in Afghanistan." He could remember being scared in Afghanistan, at least.

"Because you sure act like you know you're invincible."

"Well, it freaks people out," John said.

"Yeah, it freaks me out."

"Nobody said you had to be a smartass like me," John replied. "Do your own thing, Ford. Whatever gets you through the tour."

Ford grinned. "Now you sound like my grandad."

"Is he Semper Fi?"

"He was, yeah." Ford shrugged. "I'd just like to be able to look at someone pointing a gun at me and think, yeah, bring it."

"Well, the worst that can happen is you die," John said easily.

Ford looked at him, frowning, and John wondered what he'd said.

"That's not bad enough?" Ford asked.

"Nah," John answered, thinking of the memory of dying in Afghanistan.

"You believe in Heaven?"

"Don't care." John poked the fire with a stick, pinpointing the precise faultline on one of the logs, causing a huge gout of fresh flame to burst upwards.

"And you think death's not so bad, huh?" Ford challenged.

"I don't really think about it at all," John said. "Huh."

"Huh?"

"That's weird, isn't it?" he asked, a note of uncertainty in his voice.

"Whatever gets you through the tour, sir."

In the complex corners of John's brain, there is a line of code. Most of his programming isn't if-then, because they'd need millions of those for every possible situation. It is a complex network of mathematical probabilities and calculation formulas. Still, this one line, because it is important, is pretty basic.

When all other options have been exhausted and it is in the best interests of the general population to do so, suicide to ensure the safety of the population is mandated.

McKay never realised this would erase the fear of death, nor that John's innate adaptable programming would extend this mercy to others, as well. McKay called it the killswitch, but it would have been more apt to call it the Mercy-Killing Code.

***

There was a No Mercy Code as well. That one John wrote himself, subconsciously, because while the Executive Safety code provided him with the impetus to protect Elizabeth (or any future leader of the Atlantis mission) it didn't leave him a lot of instructions on how to do so.

He was fully aware that you shouldn't feel nothing after killing a platoon of enemy soldiers by flicking a switch, but nobody else seemed particularly bothered by it.

Still, his recognition software had identified Dr. Heightmeyer as a potential diagnostic tool, and the sensation of discomfort over not feeling greater discomfort obviously indicated something was wrong with him.

"Was there something you wanted to talk about specifically?" she asked, as John fidgeted with his hands and pulled reluctant faces. Deep inside him something was telling him that a direct interface would be so much easier than language synthesis, which was imprecise.

"Yeah," he said. "I killed a lot of people during the storm, when the Genii tried to take Atlantis."

She nodded. He considered what other details to share.

"They were the enemy," he added.

"Does that make you conflicted at all?" she asked.

"Not really," he answered reluctantly. "It's more the whole...lack of conflict."

She tilted her head. "You feel good about killing people?"

"I just don't feel very bad about it."

"Because they were the enemy?"

"You still feel bad about killing people when they're the enemy," he answered, remembering the sick sensation the first time he'd realised that a weapon he'd just fired had actually taken another person's life. He didn't feel very sick anymore. "Or you should, anyway."

"Why do you think you should?"

"Because people do." This was completely and totally useless.

"How do you know?"

"I just know," he replied. "It's implicit. You kill people, you feel bad about it. That's some kind of instinct, right?"

"And you feel bad because you don't feel bad about killing people?" she asked.

"Well, it's not healthy," he said, already calculating how long this session was supposed to be. Potential diagnostic tool, his ass.

"But you're seeking help for it," she said. "That's good, don't you think?"

"It's what you're supposed to do."

"You believe strongly in what you're supposed to do."

"Yeah, that's..." dim frustration loomed. "Yeah."

She nodded. "How can I help?"

He sat for a while. Seriously? Here he was, saying he couldn't fix this on his own, and she was telling him she wanted him to tell her how to fix it.

"Also I don't think I have dreams anymore," he announced. She raised an eyebrow, but he knew she would let it slide.

"I haven't had a dream I can remember since I left Afghanistan. Maybe before." Definitely before, but he didn't think the lack of dreams was attributable to Holland dying, especially since that kind of thing was supposed to give you nightmares.

"Well, we can work on that," she said. "We'll start small, with that, okay?"

"Okay." And she gave him ten thousand stupid little mental tricks to help him find out when he was dreaming, like counting his fingers and looking at clocks and setting his alarm so that he'd wake up out of REM sleep.

Then he got up and said thank you and went to see McKay and McKay waved his hands at him and said who fucking cares? Do you really miss dreaming? Do you really want to be miserable because you killed a bunch of guys who incidentally were being led by a sociopathic megalomaniac who knifed me? which was infinitely more reassuring because actually, all those things were facts. He didn't want to be unhappy that he'd kicked the shit out of the bad guys and he didn't really care about dreams for the sake of dreams, and if McKay could think weird shit like that it must be all right. Not that McKay was a baseline for sanity or anything, but he was a pretty pragmatic guy.

Dropped down from weekly to monthly checks, McKay found some of this logic in John's base code and felt inordinately proud.

***

Prime-Not!Prime was invented to test the neural net's calculating speed, played first on a computer interacting directly with a neural construct not yet installed in John Sheppard's brain-dead body (which at the moment housed a perfectly alive brain and was tooling around Afghanistan blowing shit up). As the calculating speed reached human reaction-time and then surpassed average human reaction time, Zelenka looked more and more pleased. They introduced a randomiser, so that every once in a while it would get one wrong, because humans weren't infallible. Rodney programmed the randomiser into his social interactions as well, paired with the Charisma circuit. Eventually this meant that occasionally Sheppard said something deeply awkward. It also seemed to affect his ability to read and react to body language, but only in intense situations.

In those early days in Atlantis they egged Sheppard into the game because they wanted to make sure nothing was degrading as line after line of new programming appeared in the monthly checkups. It caught on among the scientists as an actual game. Rodney enjoyed it.

***

Carson tried not to show how familiar he was with John's body, every time the Major came to him for a patch-up from sparring or some hell he'd caught out in the field. It was doubtful John would have noticed, but there was no need to call attention to the almost microscopically thin scars where arm met shoulder, where leg met hip, where spine met sternum, even as his hands instinctively found them and made sure they were still stable.

"How does it feel?" he asked, knowing full well that the fibula was fractured.

"Not too bad. Stiff," Sheppard replied, flexing a muscle. The microwires would have tightened around the bone, immobilising it and setting it at the same time. No need for a cast, and the wires would take the weight off the bone itself.

"Pain? Out of ten?"

"Three," which was Military for Five, and there were jokes to be made about soldiers' ability to count, but Carson let them slide. Perhaps the wires were clenching off the nerves, too.

"I think it's a slight sprain. Keep it elevated for a few days. No running, and try to stay off it. I'll give you a brace," he added.

"Sexy," Sheppard sighed.

"They are, actually. Women love a helpless man," Carson said. When he looked up from his tablet, Sheppard had a thoughtful, perplexed expression on his face. "Surely you don't need any assistance in that regard, however?" he asked delicately.

"It explains a few things," Sheppard replied.

"Such as?"

"Do you think oblivious counts as helpless?"

Carson grinned at him, parentally proud. "Having fun in the Pegasus Galaxy, are we?" he asked, and turned to fetch a few condoms out of the supplies locker along with the brace-bandage. Sheppard caught one of them between his fingers, held it up, frowned.

"If you make me demonstrate on a cucumber I'm going to be very put out," Carson observed. Sheppard tucked the foil packet against his palm and shook his head with a slight smile.

"Just remember to get her name and try not to seed the galaxy with obscenely talented black-haired daredevils," Carson told him, and clapped him on the back and sent him on his way.

McKay once asked Carson if he thought Sheppard would be, you know, capable, and he'd replied easily, "Why not? It's an autonomic response to pleasure. We've got the fully organic brains we were born with and we can hardly control the damn things, so I don't see why he shouldn't be able to. He can feel pleasure, can't he? In the brain?"

"Oh, there are algorithms," Zelenka had said dismissively. "Linked in to the socialisation and achievement modules. He should feel pleasure when he does something correctly. Intellectual pleasure," he amended, when Carson gave him a horrified look.

***

Rodney saw definite signs of pleasure in Sheppard's reaction when he was promoted to Lieutenant Colonel, just barely within the acceptable service-years range. He knew from years at the SCG that not many people, and nobody with a mark on their record, made LtC promotion the first year they were eligible for it. But, there was Lieutenant Colonel John Sheppard. And he was beaming.

"I don't even know why, you know?" Sheppard said, practically vibrating with pride as he sat at the cafe table in his full dress regalia. "Why it's so satisfying. It's not like I ever cared about this stuff."

"Well, you," Rodney said, and then didn't have anything else to say, so he stopped talking.

"I mean I wasn't competing with anyone. Besides, it's not like it means anything when you're already military commander of a city. Garrison? We're a garrison, aren't we? Maybe an outpost."

Rodney grinned a little into his coffee cup. "You're not itching to dig up a phone book and call all your old Air Force pals and gloat?"

"Nah. And nobody here knows what it means. Civilians never do. Except that I'm in uniform."

There was a Purple Heart ribbon on his pin insignia, a plain purple strip. Out here near the mountain, they got a lot of ex-military around; the man pouring the coffee noticed the ribbon too, and Rodney doubted Lieutenant Colonel Sheppard was paying for his meal today.

"It just feels good," Sheppard said. There was a slight undertone in his voice that Rodney didn't immediately grasp; Sheppard was watching him, glancing at the saltshaker, at the other diners, back to him.

"Oh, for fuck's sake," he said, when the penny dropped. Sheppard wanted to be petted. "Yes, Lieutenant Colonel, we're all very proud of you, I think you're just the bee's knees. Men want to be you, women want to be with you. Happy now?"

"You have to call me Colonel. You have to introduce me to everyone we meet: This is my friend, Colonel John Sheppard," he said, holding out a hand to an imaginary person sitting next to him and gesturing with his other to indicated said imaginary person.

"Lieutenant Colonel," Rodney corrected, right before this is my friend hit him upside the head.

"Colonel," Sheppard insisted. "Proper military parlance, LtCs are addressed as Colonel in speech and correspondence."

"I'm not military, Lieutenant Colonel," Rodney retorted.

"Colonel."

"Lieutenant Colonel."

Sheppard growled, and Rodney rolled his eyes as dinner arrived.

This is my friend. He warmed to the sentiment for a good three hours until it occurred to him that along with being a pretty nice thing to say it was also an indication that the Colonel's neural net had been reworking his base code again. Zelenka would be over the moon -- not only had their cyberboy with the clockwork brain survived a year in Atlantis, he was thriving and getting promoted.

It took almost the entire trip back on the Daedalus for Rodney to realise that he was going whole weeks at a time without thinking of the Major -- the Colonel -- as a machine or an experiment. This was, in fact, his friend, Colonel John Sheppard.

He wasn't quite sure how he felt about that.

He wondered what Sheppard had been like before the shooting.

***

Zelenka and McKay argued for days via secured-server email about how the bug genes got into the neural net; Zelenka thought the mutations must have caused brain regrowth, putting pressure on the cybernetics, while McKay insisited that idea was stupid, something he'd picked up from a horror film, and that clearly it was just the altered bloodstream causing misfires where Sheppard's nerves interfaced with the electronics. Carson refused to settle the debate, citing doctor-patient priviledge for the first time since they'd activated Sheppard after the shooting.

"He's hardly an experiment anymore," he said, and McKay and Zelenka both felt a little ashamed.

***

John liked Atlantis, much more than he'd liked pretty much anywhere else he'd lived. He liked knowing every face he saw in the corridors, and it was weird how much more people seemed to like him here. Maybe it was the allure of command.

He didn't like the stroganoff the mess served. He didn't like it when anything tried to attack his city or Elizabeth. He didn't like it when he and Elizabeth didn't agree. He didn't like the Wraith. He did like killing Wraith, and big explosions, and flying the puddlejumpers, and sitting with McKay and Zelenka at lunch. He didn't like it when someone hurt anyone on his team. He'd been over the moon when he got promoted, high with pride and achievement, but that lasted only a few hours before fading into faint, amused pleasure.

It all felt very muted, slightly unreal, none of it passionate, and he wondered if he was messed up, mentally. He liked this, he disliked that, but he didn't love or hate anything. Even the Wraith. He said he did, because that was requisite, everyone hated the Wraith, but he didn't really feel any burning emotions at all.

It was kind of nice, actually, not to feel fear anymore, or guilt over events he couldn't control. He felt uncomfortable when he did something he knew he shouldn't -- stole Rodney's pudding, or cheated a little when he was sparring with Ronon -- so at least he knew he still had a conscience. But even then it was like a twitch, not even a twinge.

In his second year on Atlantis and for the first time since Afghanistan, John felt something deep and searing and insatiable, and it was anger. Homicidal, paranoid anger, at least that was how he classified it later. After they'd detoxed him, after they'd pumped the bad bug genes out of his system and made him human again, he remembered the flavour of anger on his tongue and the white-hot pressure in his head. It was ten kinds of unpleasant, it was very very uncomfortable, and it made something squirm deep inside him to know that he had almost turned on Elizabeth. Elizabeth, of all people.

It lingered for days, until finally she put down the report she was reading as he hovered near her table and told him in no uncertain terms to stop pestering her and get the hell over himself.

He decided he could cope with this numbness, whatever it was, if it meant never never never feeling anger like that again.

***

John Sheppard did not remember being brain dead. Who would?

He remembered the day he filled out the paperwork for the military in the event of his death. He decided to donate his body to science, grinning a little because he was thinking of the old joke about donating his body to science fiction. He did not remember, because he'd been brain dead at the time, that McKay stood on one side of him and Carson stood on the other on the long plane flight from Afghanistan to Cheyenne Mountain where Zelenka was waiting with the Ancient technology and a cybernetic brain. Beckett was having a hand-wringing moment about the ethics of removing a man's bullet-scrambled brains and replacing them with a computer, and McKay said to him, "Suck it up. He's technically dead. He donated his body to science. We are science. We get the body."

John remembered dying from a bullet wound in the shoulder and one in the gut, but for him that never happened any more than the bullet that entered through his skull just behind his right ear and switched off his brain. The scars were gone and in the end he only lost about a week, which for all anyone in Afghanistan knew he spent recuperating from a head wound in the infirmary.