Pocket Tactics Postmortem


Pocket_Tactics_final

I am now three games into my goal of making one game each month, for a year. This month, I made a strategy game called Pocket Tactics. Check it out here, and check out my #1GAM progress here.

I’m rather ambivalent about my February entry. Don’t get me wrong - I am proud of what I accomplished the last month. I pushed the Crafty framework to the boundaries of what it could do. Architecturally, my code is the cleanest I’ve ever created. The game looks decent - not great, mind you, but it’s passable. The game is complete, with a win condition and everything. It’s even got sound effects.

It’s just that… well. The game isn’t very fun.

When I opened up the #1GAM website on the first day of February, I took one look at the theme - maps - and immediately knew I was making a turn-based strategy game. I’d tried to create one before, but it was beyond my powers as a sophomore in college - especially since I was attempting to make it 3D and multiplayer. It’s safe to say I went into this project with little experience with creating strategy games, but I was confident that I could make something that was playable.

I went straight to the handy stack of paper at the side of my desk and started drawing. Perhaps I could make a fantasy-map generator, and then have some sort of wargame on it? My mind immediately went to Final Fantasy Tactics. But what if I made some sort of realistic war simulator, where you controlled armies with limited intel? What if you had to actually scout ahead, and manage your supply train? It would have limited vision, and unit classes, and… while a cool idea, this idea was way too complicated for me to finish in a month. This is, however, the idea that I went with in the beginning.

I decided on Crafty as my game framework, as I’d had success with it in my first Ludum Dare entry that I’d written just two months prior. This decision worked out at first; I already had a git repo with Node and Bower, so as soon as I set that up, I was ready to get coding. That very day, I created the initial prototype of the map generator. It only consisted of a simple polygon deformation - basically, I took some few points in the shape of a rhombus, and then randomly moved them around a bit. Here’s the result:

Pocket_Tactics_initial

It does, actually, looks a little like a continent if you stare at it long enough. However, I immediately knew that I’d have trouble with it, for a couple reasons:

  • It’s hard to untangle the edges that are crossing each other.

  • Movement around on the map would be hard to implement, since the map wouldn’t be tile based.

That map generator was essentially scrapped the next day, and I started looking around for alternatives. Not too long later, I found this post by Red Blob Games, describing a way to create maps from Voronoi cells. It is a very cool algorithm, and almost perfectly suited to what I was doing. This is where I solidified my idea; I’d make a turn-based tactics game based on a map with irregular cell layout. That is, instead of being square or hex-based, it would be random polygons. In general, this idea is looked down upon since it’s harder to reason about strategically, but what is #1GAM for if not experimentation?

it was simple to grab an implementation of Fortune’s Algorithm (which computes voronoi cells from points) and a perlin noise generator to generate some terrain. About a week later, here’s what I had:

Pocket_Tactics_map

Not too shabby looking, all things considered. However, the next week passed, and what I had at the end was really not all that different:

char_small

At this point, I had just barely any hint of gameplay. I had “units” in the form of squares you could move endlessly, but nothing else. Half the month gone, and the game still wasn’t playable. Looking back, I don’t know exactly where that time went. Much of it - too much of it - went into the map generation algorithm, refining things that would never make any real difference to the final product. For example, I created rivers, but they actually have no effect on the gameplay in the final product.

One thing I remember for sure is that a lot of the time went into something you’d never expect them to - GUI elements. Crafty has no built-in support for GUI elements. Every entity you create - that is, everything displayable - is a “game object”, in that it exists in the game space and not on screen space. That means if I put the minimap at the bottom-right of the screen, then move the screen, the minimap will scroll with the rest of the terrain.

I made a big mistake there; I should have limited my use of Crafty to things it was good at. It doesn’t have support for GUI elements because it doesn’t need to. I ended up modifying the source code of Crafty to support a couple of operations I needed, and everything worked out, but this burned a lot of time. I should have created normal DOM elements to make up the GUI, and used regular Javascript events to trigger events in the game space. This would have made things much easier. It’s the classic problem of “how much should I consolidate?”

At that point, I had a map generator, a minimap, and some useless units. I also had a weekend family gathering for Chinese New Year coming up, which essentially meant four days of non-work. All this added up to barely 10 days to complete the rest of the game, and all of those days would be work days.

This is the point where I would normally say that I almost gave up. This always happens in my projects; I’m elated when I start, force myself to work through some burnout, and then quit midway through. This time though… it was different. I never even gave quitting a thought. This may sound strange to some of you, but really, this was a revolutionary feeling for me. It had never happened before. What was different this time?

It’s weird; you’d think that having a deadline would stifle creativity, but it seems to do the opposite for me. It makes me think about things differently, plan out the features I can create and cut the ones I can’t. It made me reach new levels of determination; I was going to complete this game. Instead of trying to create programmer art, I bought Oryx’s excellent sprite packs. I immediately got to work on the gameplay, dropping the rest of the features I had planned for the map. I dumbed down my idea, making it simple encounters with symmetric enemies.

gaem

I worked like a dervish, barely stopping to see friends. Snow was falling in North Carolina at this point. That meant as soon as I’d stopped working my job, I started working on Pocket Tactics. Being honest here, I could have worked harder, but I am very glad I did not. I could have pulled all-nighters, to the detriment of my job and my friends. Here’s just a couple reasons I didn’t do that:

  • Getting regular sleep allowed me to work more productively. The few days where I did end up staying up later than I intended, I was tired and unwilling to do any work the next day.

  • Talking to friends brought things back into perspective. I won’t say exactly what we discussed, but it definitely reinforced why I got into #1GAM in the first place.

  • Being sleepy on the job would not only have hurt my projects - it would have hurt me. I love working on side projects, but I couldn’t do it with work on my conscience.

I was very lucky on a few fronts in those last days of February. Firstly, my family didn’t mind me working on the game during the Chinese New Years’ gathering; this was huge, as it gave me another two weekend days to work on the game. Additionally, the feature that most frightened me, AI, took much less time than I expected because of the groundwork I’d laid out in the code beforehand. That was totally unexpected, but extremely welcome.

The days passed in a haze, and I honestly cannot remember exactly what I got done on which day - though it is all in my git history. I know that I worked on music and sound effects the last two days, and I wish very much that I’d had more time to work on those. In any case, I got it done, and the result’s up for everyone to see.

Pocket_Tactics_final2

Again, I do feel proud of what I accomplished, but the problem is that I am much, much more proud of the code than I am of the game. The game simply is not very much fun; it’s playable, sure. Everything works. The AI isn’t too dumb, and the game doesn’t look too bad. But when the entire game consists of move-attack-repeat, well… it can’t be very much fun.

While I am disappointed with Pocket Tactics, I think I can call this one more a win than a loss, not least because of the lessons I learned from creating it. My two main takeaways are:

  • When they say “know your tools”, they mean it. I’ve learned that Crafty is not suited to GUI elements. Next time, I’ll use an external tool for creating a GUI.

  • Go for gameplay as soon as possible. I should have been aiming for gameplay as soon as I started; instead, I spent way too much time on the map generation.

The two things I am really glad I did are:

  • Created a very clean architecture. Making decoupling a policy made coding this project not only amazingly easy, but also fun. It’s likely that I would have given up much earlier had I not made later features easy to implement. Much of that had to do with the Crafty architecture itself, so maybe it’s not such a bad thing that I chose it again this time.

  • Cut features relentlessly. In the end, this saved me; had I tried to pack more features into the game, it would not have been completed.

So, what’s up for this month? A third of the month in, I haven’t even gotten to work due to PAX East, so it’s got to be something simple. And yet… I’m at peace with that idea. Something simple, with fun gameplay at the core?

Sounds like just the thing.