Wherever you go, there you are.

The Plot of Control

0

In this post I am going to provide a chronologically ordered synopsis of the primary plot thread of Control. It should go without saying that this will be a complete synopsis, so massive, huge, bright-red blinking SPOILER ALERT!

A white stylized R on black background, the logo for Remedy games

If you have not played Control or are not familiar with this game, it is a third-person shooter developed by Remedy. The game has received high praise for its incredible graphics, being one of the first to earnestly leverage nVidia's RTX ray-tracing capabilties and DLSS AI performance upscaling. It is, without question, a beautiful game.

Control's combat revolves around a collection of unlocked abilities and form-swapping primary weapon, though the depth of combat is not necessarily one of the game's strongest selling points. Combat and game mechanics are fun and remain entertaining throughout, but it is not (and does not attempt to be) a game with a Dark Soul's level of combat detail or complexity.

Most fascinating to me, however, is the mixed reception to its story. Not so much from people who dislike the story, but rather, the number of people who claim the game has no story, or that the story is illogical or lacking in nuance or depth. This is a bit surprising to me because the story of Control is, in my opinion, its absolute best feature. Better than even the graphics, the plot of Control was one of the better video-game stories I've experienced in a long while.

Shadowy silhouette of a man's head turned in profile as he exhales cigarette smoke on a blurry blue background

Now, I can completely understand people who simply don't like the story. It is a world based on the surreal supernatural ideals of the SCP, the X-Files, Twin Peaks, and Stranger Things, to name a few obvious inspirational sources. And without question, that is not a style everyone is going to enjoy. Art is subjective, after all. But to dismiss the existence or depth of its story entirely is a confusing stance for anyone to take.

So, to clarify and codify both the existence and depth of the story of Control, I'm providing a complete synopsis of the primary plot thread weaving through the game. Again, MASSIVE SPOILER ALERT. Further, I should also mention that the world of Control is directly connected to, and part of the universe of, other games Remedy has produced; namely, the Alan Wake series. To this day I haven't played these games and I know nothing about their world or story, so I cannot speak to any connections that exist. I can only say with certainty that the plot of Control stands completely on its own and familiarty with these other titles is absolutely no requirement to fully enjoying this game.

Finally, I have done no research. The synopsis presented here is solely from what I remember about my playthrough of the game along with a few trips to the wiki for pretty pictures and to make sure I was getting names and spelling correct. If anything I say is in conflict with more learned sources it's most certainly me who is incorrect. Oh, and for good measure, one final time...

SPOILER ALERT! COMPLETE GAME SYNOPSIS

Banner image for Control the game featuring a red-headed female protagonist reaching out of the screen in front of a stylized background with the game title text above

PROLOGUE

This information is uncovered throughout the game through exploration and various cutscenes, lore objects, etc.

Jesse and her brother, Dylan, are part of an altered world event (AWE) involving objects of power (OOP) that occurs in the town of Ordinary while they are children. There are multiple effects, but the primary impact comes from the use of an object (a slide projector) to travel between dimensions/realities. As part of this event and the children's exploration of it, hostile entities eventually threaten our reality. A benevolent entity from one of the explored dimensions attaches itself to Jesse and her brother in an attempt to help defend our reality from this threat.

Researchers from the Federal Bureau of Control (FBC) learn about this AWE. They find and attempt to contain the objects from Ordinary in order to study the event that occurred there in accordance with the overall directive and purpose of the FBC. As part of these efforts they manage to capture Jesse's brother but do not capture Jesse. As Jesse grows and learns to cope with the events of her childhood she eventually sets out to find and rescue her brother from the FBC. During this journey she is in constant communication with the benevolent entity in her head that crossed over into our reality during these orginating events; an entity she has named "Polaris".

A circular, fractured, geometric pattern of light over a dark background

While researching the slide projector from Ordinary, the FBC accidentally re-connects to the reality with one of the hostile entities, the Hiss. This entity is essentially a memetic thought-virus propagated on some kind of paranatural equivalent to EM radiation (transmission/wavelengths). This entity manages to subvert the then-head of the FBC, Director Trench. As a result, Trench makes increasingly suspicious and irrational decisions for the FBC over the ensuing years, putting FBC researchers at odds with each other. This is ultimately revealed to be in pursuit of destabilizing the FBC in order to allow the Hiss to invade our reality.

One researcher of note, Dr. Darling, eventually makes independent contact with Polaris and is made to understand the threat to the FBC and our reality, but too late. He makes emergency preparations for the coming disaster in order to attempt to stave off the Hiss attack in the form of "HRA" devices that can protect people from the Hiss thought-virus. It is insufficient to stop the events that follow, but does provide protection for enough survivors to attempt to repel the Hiss attack.

ACT 1

The heraldic logo for the Federal Bureau of Control in black and white, with the motto Invenio Investigatio Imperium

The game proper begins in media res. With the help of Polaris, Jesse has "concidentally" arrived at the FBC in search of her brother just as Director Trench has opened the floodgates and allowed the Hiss to invade our reality. Jesse finds the FBC in an eeriely quiet and chaotic state as automatic measures, responding to the Hiss invasion, have put the FBC on lockdown. The only surviving staff are those who followed Dr. Darling's advice and began using the HRA protection devices. Details about prior events are revealed throughout the game as you search the building, in the form of visions, dialogues, cutscenes, and from reading, watching, or listening to various lore objects discovered throughout the FBC.

Jesse's first act upon arrival is to find Director Trench's office. It is revealed in a vision from "The Board" that he has killed himself, but Jesse is not told why. At this point Jesse discovers that the FBC building itself is an object of power/altered world event that is somehow deeply connected with entities from another plane of reality, known as The Board. The Board has its own long history and agenda with the FBC (that we will consider worldbuilding and not part of this plot), with the important bit being that the Board chooses the FBC's current Director by assigning a symbol of authority, an OOP that takes the form of a transforming weapon.

Upon discovering Trench's office and his suicide, Jesse takes up the weapon and is therefore assigned the FBC's Directorship by will of The Board. In the beginning this weapon can take only the form of a pistol named Grip, but later you can learn to invoke other forms. Jesse also begins to develop paranatural abilities, each one triggered by interacting with other objects of power contained in the FBC, but augmented in strength and control via Polaris' influence.

ACT 2

An image from quarter-rear perspective of a blonde, short-haired woman dressed in office attire standing with clipboard

Jesse continues to explore the FBC in search of Dylan, encountering enemies that are distorted versions of people, creatures, or items from our reality subsumed by Hiss control. She finds several surviving FBC employees trying their best to understand and repel the Hiss attack and save the FBC, foremost among them the Head of Research, Emily Pope. All of these employees recognize her as the new Director by virtue of her command over Grip, though Jesse is reluctant to assume this title. Her opinion of the FBC at this point is ambivalent; she uses the Director role only in-so-far as it will help her find her brother, and cares little about the FBC or its problems.

She aids these people in various ways in order to further her goal of finding her brother, but we'll consider all of those stories mere side-plots and discount them. Of note is the very first "employee" she meets, Ahti, the janitor. He is the only employee immune to the Hiss without the need for an HRA (other than Jesse). Throughout the game he provides assistance at key points, and it is slowly revealed that he is yet another ancient paranatural entity with a long history of involvement with the FBC, distinct from The Board. The remainder of the details around Ahti we will dismiss as worldbuilding/lore.

Jesse eventually makes contact with and frees her brother from FBC containment, but it is too late. He has been overwhelmed by the Hiss, but in a way that is different from the rest of the FBC staff encountered previously. Polaris, also connected to Dylan, has provided some measure of protection. Dylan appears to channel Hiss communication and intent, but he is able to resist the complete zombie-like takeover that turns other Hiss victims hostile.

With the help of surviving FBC employees, Jesse isolates and contains Dylan and communicates with him from time to time in order to try and understand the Hiss so she can find a way to help him. Part of this process involves fully uncovering the extent of the FBC's study, experimentation, and manipulation of Dylan, as well as their attempts to locate and capture Jesse. This turns Jesse's ambivalence of the FBC into a much deeper distrust, further leading her to reject any implication of Directorship.

Despite her new distaste for the FBC, Jesse's personal goal and the FBC's imposed Directorship goal are now in full alignment; she must uncover the source of the Hiss and stop it in order to save her brother. This will incidentally also save the FBC, which is The Board's goal.

During this period we also learn more about Polaris' nature. Polaris and the Hiss are, in many ways, old archenemies. Polaris has witnessed the Hiss take over other realities in the past and desires to prevent their success in our reality. Polaris is itself a type of benevolent memetic thought-virus/wave-pattern (or at least, capable of producing one) that counteracts the Hiss pattern/influence. Polaris had not revealed any of this to Jesse previously.

ACT 3

A spherical cage built from metallic triangular panels floating in a room whose walls are covered in antennas

Jesse eventually learns that Polaris' goals are not entirely selfless, and that the timing of Jesse's arrival with the Hiss invasion is not at all coincidental. The FBC, during their research into the events of Ordinary, had not just captured Dylan. It turns out they had also captured Polaris, who has been isolated and contained in the FBC more or less since the events of Ordinary and has been under constant study in the same way Dylan has.

Polaris first attempted to use Dr. Darling to prevent Trench from starting the Hiss invasion, but was too late. Now, Polaris has influenced Jesse to arrive at the FBC, again ostensibly in search of her brother, but at least in part also to repel the Hiss and save Polaris.

It is never explicitly stated and, as far as I know, never realized by Jesse, but the insiduous implication here is that Polaris has allowed Dylan to be affected by the Hiss to the extent he has in order to secure Jesse's continued motivation in fighting the Hiss after initially finding Dylan. No other explanation is provided as to why Polaris can fully protect Jesse from the Hiss' influence but not Dylan, despite ample evidence that Polaris' connection to Dylan is just as strong as to Jesse. Research logs reveal Dylan's mastery of similar paranatural powers as Jesse, and Jesse confirms multiple times in her internal conversations with Polaris that Polaris is connected to Dylan in similar fashion.

With the Hiss pouring into the FBC, freeing Polaris becomes Jesse's immediate concern. Unfortunately, Jesse's attempt to free Polaris fails and the entity is killed by the Hiss (or at least, the portion captured/contained by the FBC). With the death of Polaris (or that portion of her), Jesse nearly falls under the sway of Hiss influence. Ultimately she successfully resists, implying at least some of the protective nature of Polaris' pattern remains active in Jesse, preserving both her Hiss resistance and her powerful command over her paranatural abilities.

An image in quarter-front perspective of a standing red-haired woman wearing a pants-suit

With her desire to save Dylan unchanged, Jesse finally confronts the Hiss invasion into our reality directly by locating the original OOP recovered from Ordinary, the slide projector that opens the door between these dimensions. The final battle involves defeating the Hiss' representation in our reality and closing the door, stopping the invasion in its tracks. This frees Dylan from Hiss control, but he falls into a coma, his final fate left uncertain.

EPILOGUE

In the denouement it is suggested that, over the course of this journey, Jesse comes to believe that most FBC personnel are in fact working for ethically reasonable goals and that a significant portion of the evil perpetrated on her brother, herself, and the world at large by the FBC came primarily from the Hiss-influenced involvement of ex-Director Trench.

Jesse has grown to the point that she is ready and willing to accept her title as the FBC's new Director in order to lead it down a reformed, positive path. Having saved the FBC from the Hiss attack and having uncovered Trench's treachery, she appears in the end to finally embrace the Director role.

The Board seems mostly pleased with this.

Running Minecraft with a managed console (STDIN) using systemd, tail, and mkfifo+pipes

0

This post shows you how to control a systemd-managed Minecraft server by connecting its console (STDIN) to a named pipe.

If you have tried to setup a Minecraft server on linux using standard systemd service units you have likely run into the same pain I have. A Minecraft server is a process that receives control commands via console input (STDIN). There is no control application you can use to send messages to the server via IPC; even the simple act of stopping a vanilla Minecraft server requires a "stop" console command sent via STDIN rather than the traditional SIGTERM that you would expect to work for a linux service.

a crane lifting a pipe

There are many possible work-arounds to this problem. The most common I've seen, and the one I've used in the past, is to wrap the Minecraft Java process using a console "window manager" such as screen or tmux. But this solution has some downsides. These tools are not commonly installed by default, for one. Another issue is that trying to share a screen or tmux session with other users, or automate sending commands to that console, can be difficult and potentially brittle. Yet another problem is that screen or tmux controls the process' output. This means systemd cannot grab STDOUT and direct it as desired. If you prefer journalctl for your logging, for instance, losing access to the STDOUT dump is a bit of a bummer.

Perhaps most importantly, though, is that using a screen or tmux wrapper simply doesn't feel like the UNIX way. When we hear that we want to control a process via STDIN, the UNIX mind immediately jumps to pipes. Instinctually it feels like any solution not using pipes is somehow missing a better approach.

With these issues in mind, I was able to formulate a set of goals for managing my Minecraft servers that were not being met by my original screen-based solution:

  • server console input should be handled through a named pipe (mkfifo); this makes it easy to apply access controls and script commands, and feels appropriately UNIX-y
  • systemd should know that the "main process" is the Java process so it properly tracks when it dies
  • as few non-default tools as possible should be required (ideally, none)
  • the server output should remain unmodified on STDOUT so it can be sent wherever desired

I will first provide the files that enable the new solution, then go over the details of how and why it meets our criteria.

The necessary files

This method works to control any vanilla, Spigot, or PaperMC Minecraft server. It will also work on a BungeeCord server, though you will need to modify the stop command to send "end" instead.

Console commands can be issued to the server through the named pipe "/run/mcsrv/stdin". For example, running sudo -u minecraft sh -c 'echo tps > /run/mcsrv/stdin' will execute the tps command on the server console.

The systemd service unit file

[Unit]
Description=Minecraft Server
After=syslog.target network.target

[Install]
WantedBy=multi-user.target

[Service]
Type=forking
User=minecraft
Group=minecraft
Restart=no
KillMode=control-group
WorkingDirectory=/srv/minecraft
RuntimeDirectory=mcsrv
StandardOutput=journal
PIDFile=/run/mcsrv/server.pid
KillSignal=SIGCONT
FinalKillSignal=SIGTERM
ExecStartPre=mkfifo --mode=0660 /run/mcsrv/stdin
ExecStart=/bin/bash start.sh /run/mcsrv
ExecStop=/bin/sh -c 'echo stop > /run/mcsrv/stdin'

The shell script to start the server

Based on the service definition above this script should be saved as "/srv/minecraft/start.sh":

#!/bin/bash

MCDIR=$1
MCJAR=minecraft.jar
MCARG="-Xms2G -Xmx2G"

{ coproc JAVA (/usr/bin/java -server ${MCARG} -jar ${MCJAR} nogui) 1>&3; } 3>&1
echo ${JAVA_PID} > ${MCDIR}/server.pid
{ coproc TAIL (/usr/bin/tail -n +1 -f --pid=${JAVA_PID} ${MCDIR}/stdin 1>&${JAVA[1]}) } 2>/dev/null

The magic explained

Our service unit file specifies that a runtime directory should be created for this service. We create a named pipe inside the rundir using mkfifo as defined in the ExecStartPre directive. The --mode parameter for this call can be modified as needed to control the access permissions that are set on this pipe. This pipe is where we will hook the server's STDIN; anything sent to this named pipe will be received by the server console. Running sudo -u minecraft sh -c 'echo tps > /run/mcsrv/stdin', for instance, would execute the tps command via the server console.

We then start the server by executing the start.sh script. This script has what is probably our most specific requirement; it must execute with a shell that understands the coproc command. Luckily this includes bash, zsh, ksh, and a number of other very common default shell processors.

The startup script uses coproc to capture the STDIN handle when we launch the Java server process. Because this also ordinarily eats the process' STDOUT, we apply a pair of redirects to make sure that the STDOUT for the server remains attached to this script's STDOUT (which is, ultimately, what systemd will use as its interpretation of STDOUT for the overall process group). If you don't want the server output going into the systemd journal then change the StandardOutput directive to your preferred logging method.

Next we dump the server's PID into a pidfile that is also stored in the runtime directory. In our service unit we specify this file using the PIDFile directive. This allows systemd to properly associate the Java process as the main process for this service unit. If the Java process flat out dies for any reason, systemd will know. Change the Restart directive to your preferred failure behavior.

a graph of nodes

Now we need to hook our named pipe to the server's console. If you have investigated this before you may have realized how difficult it is to do this in the context of a systemd service. This is mainly owing to the semantics of a pipe being automatically closed after a single succesful writer closes its handle. A bit of research into the problem of keeping the pipe open puts us on the tail of, well, tail.

The script starts and backgrounds a tail instance that handles our pipe magic. While our server lives this tail instance constantly reads one line at a time from our named pipe and redirects this output into STDIN for the server. It is also set to "wait" on the PID of the Java process using the --pid parameter. This ensures it will clean itself up when the server stops.

To stop the service we tell systemd to send a "stop" command to the named pipe to shutdown the server cleanly. It will also send SIGCONT to the process group to make sure both tail and Java processes are not suspended. If the server fails to cleanly stop in the allowed time period systemd will then send SIGTERM to the processes. If you are running a vanilla server then this will basically force-stop the server. If you run spigot or papermc these servers will attempt to shutdown gracefully on receiving SIGTERM.

Note that the above signal methods can be modified to your preference. If you prefer to guarantee absolutely no chance of a forcibly stopped server causing data loss then you may want to change the KillMode directive to "none". This ensures that the server processes are left alone if the "stop" command doesn't do its job. The downside is the potential to leave orphaned processes that require manual intervention and cleanup. Also, if your server takes longer than the default service timeout to cleanly stop (90s) you will want to add the TimeoutStopSec directive to tell systemd to wait longer before sending the final kill signals.