Secure Facility 7: Central Control Room

So in the first post we talked about the base system, some lessons learnt and a little bit of overview, so now we’re going to go through the funky bits I built in some detail.  First off the Central Control Room Panel

Okay so first of the three props made was the central control panel screen, which looked a bit like this:

Screen with many flashing red lights and labels describing things being broken

Secure Facility 7 Central Control Room

Now a lot of this is just fluff, the players first saw this projected onto a large wall monitor in a dark and abandoned room, counting down until 9pm (the end of the game), and all the blinking red lights (and couple of green ones at the start of the game) were designed to let them know in no uncertain terms that this event has a time limit to it and something will need to be done :)

Now primarily this is just a pretty simple page, it has some natty features however.  For a start its mostly based on the excellent TimeTo jQuery Plugin which gives it its big chunky countdown clock, and nothing says urgent! like a clock with flipping numbers counting down :)

Second thing to notice about this page is the External Air Pumps.  At the start of the game these are still Green and good, but part way through (18:30) they entered a degraded state, accompanied by a loud klaxon noise, and finally they failed (20:30) about half an hour before game end, signalled by a long wailing siren that echoed through the corridors – all to keep the players on their toes for impending doom :)

Showing the three (Green, Yellow, Red) warning lights for degrading pumps

External Air pumps degrading

The air pumps were done with setTimeout() functions that used jQuery’s cool .toggle() function to hide one div and display the next in sequence, it also used the built in audio support from HTML5 to play the sound effects, which is actually pretty simple:

<audio id="alert" src="alert.wav" preload="auto"></audio>
<audio id="siren" src="siren.wav" preload="auto"></audio>
<script>
  var degraded_eta_ms = new Date("Jan 17 2016 18:30:00 GMT") - now;
  var failed_eta_ms = new Date("Jan 17 2016 20:30:00 GMT") - now;
  setTimeout(function(){
      $("#pumps_working, #pumps_degraded").toggle();
      document.getElementById('alert').play()
  }, degraded_eta_ms);
  setTimeout(function(){
      $("#pumps_degraded, #pumps_failed").toggle();
      document.getElementById('siren').play()
  }, failed_eta_ms);
</script>

To get that working I read Mozilla’s “Using HTML Audio and Video Guide” which is pretty natty, however that didn’t work at first, until I read this Stackoverflow post “Firefox won’t play .WAV files using the HTML5 <audio> tag?” which details how Firefox needs a specific bit depth (8, 16) as well as a specific number of channels (2) in order to work, a quick reencoding later and it just worked :)

There was a cool third thing the players didn’t get to see, in that when someone enters a door access code to try and open the front door (which will let in enough radiation to kill everyone inside pretty quick) it appears in the control room, and it plays an “Access Granted” noise, again this is a pretty simple bit of Javascript that uses .load() to pull in the output of a PHP script and repeats the earlier audio trick of playing a computerised voice saying “Access Granted”:

<audio id="access-granted" src="access-granted.wav" preload="auto"></audio>
<script>
  /* Check for main doors being operational */
  var have_granted_access=0;
  setInterval(function() {
  $( "#doors").load( "/door/external-door-access.php",
    function(response, status, xhdr) {
      if (response.length > 0) {
       //console.log("Recieved external door unlock, showing door div");
       $( "#doors" ).show();
       if (have_granted_access == 0) {
         document.getElementById('access-granted').play();
         have_granted_access += 1;
       }
     }
     else {
       //console.log("Lost external door unlock, hiding door div");
       $( "#doors" ).hide();
       have_granted_access = 0;
    }
  });
  }, 5000);

So where did those sound effects all come from?  The Freesound Project as normal :)  The access granted noise was Access Granted.wav by EthanolProductions, the others I’ll try and find the links for later.

But yeah it was a pretty simple bit of fluff in a way, but it gave the players a way of knowing the boundary of the game, and it kept the tension up by alerting them to the upcoming doom of the end of the game.

Next step: Door controls :)

Leave a Reply