Source Code

by Kelvin Shadewing

First published

Equestria exists as a computerized simulation.

Equestria is a real, living, breathing world of peace and freedom... or so its inhabitants think. But a secret lies forgotten beyond its boundaries. How will a pony react when they discover they don't really exist?

[This story has nothing to do with the movie Source Code, which had nothing to do with actual source code, which this story does. Pinkie Pie knows what I mean.]

Chapter 1

View Online

Source Code

This is a non-profit work of fan fiction. My Little Pony © Hasbro.

Chapter 1

/*-----------------------------------------*\
|PROJECT: Equine Sentient Life Simulation |
|AUTHOR: Alan Maize |
|DATE: 10-09-2012 |
|COMMENT: Test of sentient life in a virtual|
| environment. |
\*-----------------------------------------*/

#include <cstd>
#include <cmath>
#include <iostream>
#include <string>
#include "source.h"
#include "ioaudio.h"
#include "cleverbot.h"
using namespace std;

enum species{ //List of sapient beings
spEarthling,
spUnicorn,
spPegasus,
spAlicorn,
spGryphon,
spDragon,
spDonkey,
spMinotaur,
spPhoenix,
spDiamondDog,
spChangeling
};

class Equestrian{ //Basic civilian class
private:
float x, y, z; //Position in world
species type; //What they are
audioStreamOut *voice; //Audio stream for speaking
audioStreamIn *ear; //Audio stream in from microphone
mdl *body; //Appearance
string name; //Textual identifier
Equestrian *next, *prev; //For linked list
Vector3 speed; //Required for movement by source engine

public:
Equestrian(float X, float Y, float Z, char* Name, mdl* Body){ //Constructor class
};
}*firstEquis; //Pointer to first instance

The cursor on my screen blinked at a steady pace, waiting in the body of the Equestrian constructor for me to enter the next line of code. The first step would be simple, have the instance add itself to a linked list so that it could be processed systematically with all the others.

I took a sip of coffee that was laced with 5 Hour Energy. I don't know how I came up with this idea, it just hit me. Maybe the fact that I was torrenting Tron and Reboot while being high on my usual "stamina potion" had something to do with it.

But I wanted to create something new, a simulation without players, only computers. It wasn't like the other games I made where the actors had to interact with a player to evolve. I wanted to make a world where they grew by comunicating with each other.

Being the fantasy gamer I was, I went with using fantasy creatures from other games, except for humanoids like elves and dwarves that I found too conventional and rather boring. That, and, it would be interesting to see if a society could exist with most of the population not having hands, as well as a multitude of different diets.

But first, I would need to test if one could survive on their own.

int main(){

//Create first Equestrian, Princess Celestia
mdl *mdlSunPrincess = sourceLoadModel("res\\models\\solar_alicorn.mdl"); //Load Celestia's model
firstEquis = new Equestrian(0, 0, 0, "Celestia", mdlSunPrincess); //Initiate Celestia

map *world = sourceLoadBSP("res\\maps\\freerun_city.bsp"); //Test map

return 0; //End program
};

I added a loop that would continue the simulation until I told it to stop. Then, I ran it.

36273 errors found.
Ending compilation.

I stared at the screen. My eye twitched. I slowly reached over and added another 5 Hour Energy to my coffee in preparation for the long night ahead of me.


Finally! Three grueling days of non-stop coding, a full 24 hours of sleep, some jogging to loosen up my stiff body, and I was finally ready! I clicked "Build and run" on the toolbar, and a few minutes later, the first test was up and running.

I looked at the image of the regal white alicorn standing in the middle of Freerunner City. She blinked, and then looked around in mild disorientation. I leaned in closer, zooming in on her as she opened her mouth to speak.

"Wh... where am I?"

The interface, including the name tag floating over her head, were all invisible to her. She didn't know the name of the city by either its identifier or its file name.

She started to look at herself. "Who am I? Whaaaaaaaaa--"

The screen fizzled and the process terminated. I sighed and rubbed my forehead. Answering these questions herself must have been too much for her. She needed a teacher.

And a sister.


Celestia awoke again in the desserted street. Something strange and unseen had knocked her out, and she didn't realize how long she'd been unconsious. She shakily stood up on her hooves, and took a moment to inspect herself.

Soft, white fur lined her entire body. Upon her head was a spiral horn, and on her sides was a pair of large, majestic wings. Majestic. Was that the right word? It felt right to her. Upon her body were golden adornments of some kind, perhaps a symbol of rank.

Then she tried to look inward. Her mind was full of words and lines that made no sense to her. Among them was something peculiar.

name = "Celestia";

"Celestia," she said aloud to herself. The sound of the word clicked in her mind, and told her it was correct. Correct about what? Her identity? Yes, that's what it was.

"Hello?" Another voice was coming from somewhere in the otherwise empty city.

Celestia turned her head in the direction of the voice. Something about it was familiar. She moved her legs and found she was able to walk forward. But should she answer the voice?

"Hello?" it said again, sounding more frightened than before.

Celestia didn't blame the other one for being scared; this place was cold and lifeless. But was there ever anything before this? She tried to think back, but nothing came to her. The alicorn turned a corner and saw another like her, but different.

This one was smaller, witha dark blue coat, and a transparent mane that swayed on its own much like Celestia's rainbow mane. Her eyes showed lonliness and fear, the latter of which completely overtook the former when they met each other's gaze.

The smaller pony gasped and stepped back. "Who-who are you? Who am I? Where are we?"

Celestia looked solemnly at her new companion. "It's OK. I don't know where we are, or how we got here, but I am not going to hurt you. Can you remember your name?"

"Name?" the dark one asked, "How do I know my name?"

"Look inside yourself," Celestia calmly instructed, "You will find it somewhere, just as I did."

The new alicorn closed her eyes and remained silent for a moment. "It's... Luna. M-my name is Luna. I think."

"Luna," Celestia repeated, "Why does that sound familiar?"

"Because she is your sister."

Chapter 2

View Online

Chapter 2

"Who's there?" Celestia said aloud.

Luna moved closer to her sister, trying to hide under her wing. Good, the relative link was working. Her instincts were telling her to run to her big sister for comfort and security.

"Hello, Celestia and Luna," I said into the microphone, "Don't be afraid of me. I'm not going to hurt you."

"Where are you?" Celestia asked forcefully, looking up into the sky for the source of my voice.

I grinned. She was spunky. Sure, I could change that, but that would defeat the purpose of this game. "My name is Alan One. I created you." I wondered if calling myself after a famous Disney character would be considered getting to full of myself, but it sounded too cool for me to resist.

"Alan One?" Luna asked softly. If not for the text output, I might have missed that line.

"Yes?" I asked.

"Where are we?" she asked, "This place is so..."

"Empty?" I finished.

She nodded.

I sighed. "Well, you see, I haven't made anyone else yet. You two are the first, and I created you for a purpose."

"What purpose is that?" inquired Celestia.

"I am going to fill this world with life," I told them, "You two are going to be the guardians and leaders of this world I've created for you. Celestia, you will rule the day, and Luna, you will rule the night."

"And what if we refuse?" Celestia asked, "What if we don't want to rule?"

I chuckled. I admired her spirit. "Well, whether you like it or not, this land is yours. You can guide it and hopefully lead this land to prosperity, or let it go wild and fend for itself. That's the game, and you two are the players."

"So then we have no choice?" said Luna.

"You do," I said, "But being the first, and I might add most powerful beings in this world, your actions and decisions will affect everything."

Celestia lowered her gaze to her sister and smiled at her, then looked back up. "Very well. We shall take on this task. But I must ask, what is the consequence for failure?"

Good question. In fact, what would even constitute failure in a simulation like this? Her becoming a tyrant? One overthrowing the other?

"You fail," I said, "if one sister slays the other, either directly or indirectly. The consequence for such failure is that you both will be replaced." That sounded good.

"Very well," said Celestia, "What now?"

"Now you sleep."

I terminated the process. Visual Studio popped back up on screen. I minimized it and switched over to the Hammer BSP editor. The models I'd made were rather simplistic, almost cartoonish. I thought on that, and decided to change the lighting mechanism so that life forms would be cel-shaded. The rest of the world would be smooth and simple, but still textured, like Team Fortress.

I started work on the new city that would be the home of my little ponies: the capital city of Canterlot. This would be their starting point, and from then on, it would be open wilderness. But even with all this room to grow, something was missing. Another fantasy element.

The weather! Weather would be controlled by the inhabitants, not by nature. In order for this to work, I had to override the ambient weather system and make clouds a physical entity.

After messing around with the engine some more, I had a setting that I liked, and started implimenting the other races. Each would have different parameters for instinct and nature, but operated on the same basic principals. Probably the hardest part to program was procreation. For things like gryphons and diamond dogs, I elected to use a standard genetic method of determining appearance and gender. For the changelings, I went with a hive structure and gave them a queen. They would all be identical to non-changelings in their natural forms, but would be able to temporarily copy the form of any other race. The ponies, however, I made very different. While there was a set method for species, as unicorns, pegasi and earthlings would be able to interbreed, appearance would be totally random.

Having set up my system, I installed the extra two terrabyte hard drive where new models generated in game would be stored. Once the disk was full, the simulation would start recycling bodies instead of making new ones.

After making a few of each species to start them off, as well as a multitude of animals, I switched the level from freerun_city.bsp to the new equestria.bsp and started the simulation up.

Luna and Celestia looked disoriented at first when everything lit up, and were startled at the appearance of six new ponies, a male and female of each pony race. The foreign races would meet them eventually, but I wanted initial seperation to see what would happen.

My cell phone started ringing. I turned the mic off and picked it up. "Hello?"

"Hey, Alan?" my dad said on the other line, "You remember you're meeting us for dinner tonight, right?"

Oh, crap. I pulled up my calendar. "Uh, yeah, of course." The date said it was mom's birthday. "I just got a few things to do real quick, and I'll be right over. Tell mom I said happy birthday!"

"Alright. See you soon." He hung up.

I glanced at the chat log in the sim. Luna and Celestia were telling the new ponies who they were. Hopefully they'd be fine while I was gone.

I switched the sim into background mode, making it run much faster than real time. The limit was set at 1000 times speed, which meant that it would be a little longer than five months if I didn't stay long. Of course, that was assuming mom didn't start drinking.

Sighing, I switched off the monitor, and went to take a shower.