Night Trap – Switching Branches

Sega CD Night Tap

You can find parts 1 and 2 of this series here:

We’ve made a lot of progress with Night Trap this weekend. I started by further compressing the videos on the prototype site, which will allow for smaller and faster downloads, as well as quicker camera switching. I won’t be making any additional changes to that codebase for a while, however.

In programming, you can create what are called “braches”, which allow me to create another code base without affecting what is already there. Imagine branches on a tree, if you will. The image below explains it well.

Courtesy of

Courtesy of

I can now work on a new branch, called Alpha, where I can add a new set of code for the latest build of the game.

There a few benefits to this:

  • Can code without breaking the prototype site
  • Can deploy to another test site, thereby having two builds at all times

When  have a stable version of the Alpha branch, I can push it back to the Master branch when I’m satisfied with all of the changes. Either way, you’ll always be able to visit the two sites.

Another deployment

If you head over to, you can see where the latest changes will appear. Azure websites allows you to connect your website to a repository, such as GitHub, and pull any changes from there.

Previously, I was uploading all of the code to the Night Trap repository on my GitHub account, and pushing it to the Master branch. Azure was then looking at that branch, and any time I made a change, the Azure website would then replicate it on Azure.

Azure Github I also have the ability to have multiple deployment slots. So I can now create a new deployment (test) site, and point it towards that Alpha branch that I created just before.

Recent additions

This weekend I took time to upload most of the clips from roughly the first 5 minutes of the game. I had to convert them from .sga -> .avi -> .mp4, then upload them all to Azure Media Services, which allows me to stream them all back to you as .mp4.

AMS gives me a URL for each file, which I can then set as the media player’s source in HTML. So that video player on the website points directly back to Azure for the video feeds.  Here’s what the dashboard looks like:


You’re probably thinking “How does he keep track of what all of those files mean?”. Becuase of the active community in the Facebook group, we’ve been collectively diving into each file and pulling out information from it, as I noted in the previous post.



From there, in the code I can create an object for each room, and reference the url back to the file in Azure. The code looks like this:

Now I can easily set the current camera to one of those feeds. I also know what is happening at each of those feeds because of the brief comments.

The hard part

The part part behind all of this isn’t playing with the video footage. It’s actually having to recreate the game to the best of my ability, without seeing any of the source code. Even if I could, it would be difficult to fully understand anyway, as it would have all been written in 68k Assembly.

I’ve started to architect some of the code and piece it all together. You can see the main.js file, here. That is what I will continue to flesh out over the next few sessions.

In the coming weeks

I’ll be moving a bit slower, as I am away for work all of this week, and the following week I’ll be in Costa Rica on vacation. So fear not — this isn’t going away!



Leave a Reply