Latest Project: Node.js + Bootstrap + D3

July 3, 2016 at 5:07 pm (Computer Science, JavaScript, NodeJs, Programming, Rant) (, , , , , )

I’ve started putting together an app I’ve been planning for a while. I’ve been trying to select a tech stack that would allow me to focus on the “meat” of my idea instead of spending too much time setting up boilerplate stuff. In the past, I’ve ended up wasting days just setting up technology stacks and libraries just to find a limitation that would eat up even more of my time or even flat-out block further progress. This time around, I think I should be okay; I’ve selected Node.js and Express for my launch point.

I’ve decided not to bother with MEAN.IO right now since I won’t need MongoDB right now and I’ll be using D3 (the visualization library) instead of Angular. Express provides me with the basics for routing and serving web content (more stuff I don’t have to do). I’m still not really a fan of Jade/pug as a template engine, but it’s workable.

I’ve also added an REST API on top of it for accessing my Trello account (via it’s own REST service). I’d like to do some sort of interesting visualization of my content using D3, so now that I can serve up the data I’ll need, I can actually start building the good part.

One of other boilerplate tasks coming up is to set up a client-side package manager (Bower) to manage my dependencies. I will likely also need a task-runner to build my project stuff, although I’d like to consider using NPM for that instead of Gulp/Grunt.

Permalink Leave a Comment

Aftermath of Zombie Mansion Alpha 1 Build

July 18, 2014 at 12:40 pm (Game Development, Games, Graphics, Java, JavaScript, Processing, Programming, Video games) (, , , , , , )

So at this point in time I’ve had multiple people play through my game demo. The results were actually better than I thought. I think only one person wasn’t able to run it (still not entire sure why, but that’s future Jake’s problem now). There were a couple major issues, but those were found and fixed as well. One of the bugs was that I didn’t include the assets for the 3D objects, so when the players entered the room with columns, the game crashed. There was also some scripting errors driven by not having necessary images wrapped up in the resources archive. Logging definitely helped out there.

The last major issue is unsolved, but lies with some code I threw together for the level selection screen. I think some of the click events aren’t going through, or it’s not loading the levels properly. I think this may have something to do with that particular tester running the game through a zip file though. I was shocked to find out that it worked period though.

I got some pretty decent feedback from one tester in particular though. He gave not only bug reports, etc, but opinions on controls, aesthetics, and game flow as well. Most of those things were explained away as “placeholder” stuff, but still; it was useful information to know what a tester/player is thinking when they see that stuff. When I show most people my game, I need comments like “looks neat and retro” or “I like the camera spin feature”, but not enough people pay attention to tiny details.

Anyway, that’s the update. I haven’t had free time to cut a second build or to work on new levels or anything.

Permalink 2 Comments

Automation 4 U

June 28, 2014 at 2:29 pm (Computer Science, Game Development, Games, Graphics, Java, JavaScript, Processing, Programming, Rant, Teaching) (, , , , , , , )

So, this will be nothing new for some of you. This isn’t even something new to me; I have a day job where I’m a professional software engineer and we do this at my job all the time. I’m talking about automation and automated processes. This could be anything in your project development process where you have the computer automatically do something for you. An example could be a script that backs up your files to a different drive that you can just run when you want. It could be as complex as a build step that automatically deploys your binaries or runs unit tests.

My disclaimer: A lot of this is technical stuff and directed towards programmers, but even if you’re a graph artist, you can still benefit from this. Everybody that uses computers for projects will need to back up their files for instance.

I’ve only recently realized just how important this all is for regular, personal projects. I’ve always known that it saves time, but my initial mindset was that I’d rather get my project up and running and THEN waste time implementing the time-saving stuff after I get it together. I’ve been reading this book I bought from Amazon that talks about indie gaming from a business, “get your act together” perspective. The book can be found here. I’m still reading it, and some may or may not agree that it’s a good book, but it provides some good ideas for how to take your hobby projects to the next level and keep your process renewable. This means saving time and money on mundane processes, etc.

I am still in the process of automating many aspects of my project, but it really crept up on me just how much time I was wasting on manual things. Here are some of the processes I perform just for my Zombie Mansion project:

  • Backing up files from two areas on my system to my external hard drive
  • Deploying JAR files from my Eclipse solution to my Processing solution to use in my game
  • Removing alpha channels from sprite sets (I built a tool to do this, but it’s still manual)
  • Putting together standalone builds of the game software
  • Packing and compressing image resources for game builds
  • Merging animation sequences together for access by the game engine

These are just things I thought of off the top of my head this morning. Some of them will be easier to do than others, and some of them are specific to my project. All of them eat up time though and are tedious things. Here are a few tips and ideas for how I plan on solving some of these issues though. Please read through just in the off chance that it inspires something or gives you an idea or two.

Deploying JAR files to another solution

For this, I intend on using ANT with Eclipse. This is pretty much a standard for serious Java projects, but it’s taken me a long time to start to improve my processes (usually I want to work on the fun stuff or the stuff that has a visual out-come). Visual Studio has its own build steps and things you can run. Alternatively, you could write a script/BAT file that will grab the files from your output directory and deploy them. This doesn’t require a full set-up of a 3rd party tool and it should be quick to do. It just might break and won’t be as robust.

Backing up project files

This is something I’m already part way through implementing. I’ve written most of a BAT script that will grab the project files from specific directories and dump them in one area so I can back them up (it will optionally zip them as well). To make it a bit easier, I’ve started using virtual drives, but this isn’t necessary. If you’re interested in what virtual drives are or how to set them up easily, email me or post a comment. I can give you some resources or just write an article. Here is a snippet of what I have so far (I’ve been taking bits and pieces from the interwebs, so most of it is borrowed code anyway).

I wanted to dump the files into a folder that would be timestamped so I wouldn’t have to worry about overwriting anything. This is one way of how you’d accomplish it using a BAT script in Windows:

set hour=%time:~0,2%
if "%hour:~0,1%" == " " set hour=0%hour:~1,1%
set min=%time:~3,2%
if "%min:~0,1%" == " " set min=0%min:~1,1%
set secs=%time:~6,2%
if "%secs:~0,1%" == " " set secs=0%secs:~1,1%
set year=%date:~-4%
set month=%date:~3,2%
if "%month:~0,1%" == " " set month=0%month:~1,1%
set day=%date:~0,2%
if "%day:~0,1%" == " " set day=0%day:~1,1%
set datetimef=%day%-%month%-%year%_%hour%-%min%
echo %datetimef%
xcopy "C:\Test\A" "C:\Test\B\Backup\%datetimef%" /E /I

This will copy everything in your source directory (the first argument) and store them in a custom folder with a timestamp. You can use multiple source directories as well if you have things spread out like I do by just putting in an extra line. The last two arguments are switches to tell XCOPY to use the full source directory (and children) and to assume I mean the destination should be a folder.

Removing alpha channels from image resources

This one will be a bit more complicated. I have a tool I wrote to do this, but I want to streamline this. Now, I wrote up a full project plan with a product backlog, but then I realized even that was too ambitious. I plan on taking some items from the list, but I also plan on it being a purely script-based tool. It will run on the command prompt and will use my engine’s scripting engine for customization (as opposed to using config files). At this point in time, it’s cheaper for me to use scripts than config files since I don’t have a streamlined approach to reading them yet. ANYWAY, I will be writing this as a project in my game engine solution and it’ll have a unit test project to go with it. I’m still working out what tests I will need for it since it works with images, but it’ll be centered on testing the RGB values of generated images before and after the script runs. It’ll also test image sizes for when I add the feature to compile multiple animation sequences together.

Anyway! To summarize this; automation is good. It saves a HUGE amount of money (time is money). If you ever have dreamed of selling a game, you NEED to get in the habit of doing this. The more you do it, the easier it will become and the more effective you will be with your time. Be as lazy as possible with your projects; that’s why we’re programmers! (Although you don’t need to be a programmer to benefit from this).



Permalink Leave a Comment

Zombie Mansion: Alpha Build 1!

June 23, 2014 at 2:54 pm (Computer Science, Game Development, Games, Java, JavaScript, Processing, Programming, Rant) (, , , , , , , )

So I’ve finally gotten a build of the game working! I can’t post it yet for a variety of reasons, but I’ve sent the build out to some people to try it. It’s mostly to verify that the game works as expected and is stable. It just features the level I showed in the previous videos and a couple of extra smaller areas.

Last Saturday night I had a few panic moments when the builds weren’t working as expected. I had an issue where the resource unpacker code I wrote wasn’t actually unpacking the images from the compressed assembly; it turns out it was still trying to load them from the local directory. The issue has since been fixed thanks to all of the logging architecture I recently put in. There’s still several areas that could use more logging, but there’s enough now to sort out common issues.

Another bug that logging helped uncover was with the asset manager system. I have code that manages any images and ensures you only load one copy into memory. This helps to keep a cap on the memory usage of the software as a whole. However, there was an issue where I had slashes in the reference indices that were going the wrong way! This is a pretty common issue with programming to be honest. Devs frequently write code for their own system and then find out that nothing works on other computers or operating systems. Thankfully, the logging system helped uncover the fact that it was double loading certain resources.

Now if I could just muster the effort to change the spelling mistake I made with naming the logging variables…

Permalink Leave a Comment

Javascript Object Inheritance that C#/Java Coders can Understand

February 18, 2014 at 10:22 am (Computer Science, JavaScript, Programming, Teaching) (, , , , , , )

So, at work I’ve been using Javascript as a primary language for a while now. While I am likely not an expert, I’ve picked up some neat tricks. Since I work with an office full of C# coders, I need to write code that they can understand quickly. Therefore, one of my first motivations is to write code that can be understood by non-Javascript purists.

So let’s build a simple example of how to achieve objects and inheritance using Javascript. While there are more than one way to create objects in Javascript, I’ve been using this approach as several good/reputable sources have suggested it, and it resembles C#/Java somewhat. Note: I don’t condone the act of trying to make Javascript into a language it isn’t, but I do support readability. In this case, our reader understands a separate language and they have no reason/incentive to learn ours. So we will commit as few crimes as possible to make our code understandable by people that don’t know Javascript.

So here is our base case: Shape. It holds a position coordinate with a public accessor.

function Shape() {
  var _x = 0,
      _y = 0;  
  This acts as a constructor for us and looks familiar-ish to C# coders. 
  initializeComponent() {
      _x = 5;
  this.getX = function() {
    return _x;

  this.getY = function() {
    return _y;

  Can't forget to call our own constructor.

So this is our base class. We’ve defined X and Y and Javascript will treat them as private variables. When you instantiate the object, you can only access them via the public “GetX()” method (I’ll show instantiation shortly). You will also notice the function “initializeComponent”. This is what I call a constructor, but I stick to this function name just by convention. You can call it whatever you want, within reason; Javascript reserves some keywords. You’ll see at the bottom of the class that we are calling this constructor ourselves. What’s with that?? Well, to Javascript, the whole class is a constructor, but if we had our code spilling everywhere then it would be messy and not at all like C#.

The last thing to notice is that our public accessors are attached to a “this” keyword. “This” will refer to the instantiated object, and the function will attach itself as a property of that object. This is different from our private variables, which aren’t properties of the object, but are accessible from within those public functions. Without getting into details, this essentially lets us mimic the behaviour of C#/Java.

Now to the good part: we want to instantiate our object!

var ourObject = new Shape();
ourObject.getX(); // This returns _x
ourObject._x; // This returns undefined as it is not accessible

So this is how to instantiate the object. Everything works as expected. Now lets talk about how to make a new class that inherits from Shape. Incoming code:

function Circle() {
  var _r = 0;
  this.GetRadius = function() {
    return _r;
Circle.prototype = new Shape;
Circle.prototype.constructor = Circle;

Okay, so we’ve seen everything in Circle already, but what is that noise after the class definition? So again, without getting into details (which are already everywhere on the interwebs), the first line is setting the class to inherit from. This means that if you instantiate Circle, you can do operations such as:


This is a valid operation. Exciting. Now what was that second line? We need to set the prototype’s constructor to point back to our Circle class. This allows us to use the “instanceof” operator and have it work as we would expect. Now, it isn’t necessary to do this step, but it plays nice when other people use our code.

So that’s how we can achieve something along the lines of inheritance with Javascript. I’ve hidden lots of important details, but if you want to know more, ask or search for it. I should also note that my example doesn’t give you the power of protected fields. For example, Circle can’t directly access _x.



Permalink Leave a Comment

Impending game demo (by request only)

January 7, 2014 at 1:33 pm (Computer Science, Games, Graphics, JavaScript, Processing, Programming, Video games) (, , , )

So I’m working on getting some levels ready for a demo finally. I need to re-skin the levels to not use *ahem* borrowed art assets before I can do that though. Eventually, I’ll probably post it or public access, but for now it will be released by request only.

Permalink Leave a Comment

Forgetful Coding

August 7, 2013 at 3:23 pm (Computer Science, JavaScript, Programming) (, , , )

So I just found out today that I had apparently written JavaScript code that does full view management for web apps and facilitates data passing between views.  It does some nifty stuff that handles tedious things like asking if a view has unsaved changes and gracefully handling those cases, etc. The kicker is that I had completely forgot that I wrote this stuff a number of weeks later! I started writing some new web code at work and wondered why what I was doing seemed familiar, but had poor design. Turns out I did it the “right” way earlier..

Permalink Leave a Comment