Monthly Archives: February 2014

An arcade-style shoot-’em-up in Unity

It was the appeal of video games that got me into programming in the first place, really, as was the case for much of my CS131 class at the University of Montana. It turns out that making video games has almost nothing to do with playing video games, so many of my classmates didn’t continue with the program. I made a Tetris clone once, but that was the extent of my ‘game development,’ since PHP and C# CRUD apps are worth money to business and government customers and games aren’t.

But since I wanted a well-defined problem in an understood space, Unity beckoned. They provide top-notch tutorial projects, one of which is building an arcade-style “space shooter,” of the sort I loved to play as a kid.



The tutorial walks you through creating a player spaceship, adding the ability to shoot lasers, and providing some asteroids as hazards to avoid and destroy. However, the assets they provide with the tutorial also include an enemy spacecraft, and in the interests of illustrating that I can do more than just follow directions I decided to add him to the game as well.

Again, this isn’t perfect. The idiomatic design pattern for the project is to spawn the lasers a short distance in front of the spaceship using a GameObject to hold the offset, and I spawned the enemy laser by using an offset in a script. You can shoot down the enemy lasers since I re-used the collision detection from the asteroids, which is either cool or silly. And it might be nice if the enemy ship moved around, or if I used the assets provided to create some variety among the asteroids. If this were a production game, we’d want progressive difficulty and probably a persistent high-score system. As it stands, though, I’m happy with the project for what it is.

You  can play the game here, or you can follow the tutorial to create your own game.

Why I’m giving up on the CKII thing

I’m giving up on the CKII thing.

I hit a roadblock which isn’t a show-stopper: the topology used by the game is an 8 bit-per-pixel indexed bitmap, and .NET prefers to edit 32 bit-per-pixel bitmaps. The conversion between the two is well-understood, so that’s not the end of the world.

However, I’ve just interviewed for a couple of jobs in a row which didn’t care about my degree and wanted to see specific experience with the frameworks they use. Now that’s understandable, perhaps even commendable… except that it puts me in kind of a rough spot. There are zero jobs for CKII modders.

You could argue that showing the persistence to finish a nontrivial project is important, and you’d certainly be right about that. (I’ll finish the next one, promise.) But I think my efforts are probably better spent working on a well-documented problem domain that’s obviously relevant to business needs than on a trial-and-error effort to make a glorified toy.

Furthermore, there’s apparently something with the new patch where it’ll crash if your mod doesn’t do rivers and adjacencies between islands properly. There are the problems associated with creating dynamic and interesting characters. There was the sudden realization that I can’t just leave the ocean provinces at the same size as the land provinces, and that the vanilla game seems to have each land province border one ocean province: how would I go about drawing workable ocean provinces dynamically? Simply squishing them together into kingdoms wouldn’t work, because any given county might border two ocean kingdoms, and then it’d crash.

I’m gonna go write a web app.