Categories
Projects

BattleGrid Update – May

From now until the end of development, I’m going to do a monthly wrap-up of what’s been done with BattleGrid. Hopefully there won’t be too many of these before BattleGrid is finished.

How’d May start?
At the beginning of May, I still had two major problems that were holding back development. First, the number of draw calls was far too high for the simplicity of my game, and without lowering the draw calls, BattleGrid was unlikely to run well on the iPad. Second, the AI was eating up far too much CPU time, mostly because each turret had its own AI all trying to run at the same time, which was hurting framerate.

What got done?
An epiphany on the draw call issue ended up solving the problem. Even if the problem isn’t totally solved (I have a feeling it will pop back up later), I know how to tackle it to improve the draw call count. A similar epiphany struck me related to the AI, which has eliminated problems with too many AIs trying to run at once.

In addition, I’ve added an extra animation to one of the turrets, which looks great and adds some life to the game. I’m planning on updating the remaining turrets with similar animations. I also added a new effect when shields are hit, and I added or improved several sound effects.

What’s left?
AI Rewrite and Updates
I want to rewrite my AI to use a finite state machine, custom code, or a new behavior tree system. Currently, the behavior trees are created with Behave, which is free and works great, but it requires a 3-second logo to appear when the game starts. BattleGrid has a long enough load time as it is, so I want to trim out everything I can. The AI also needs some general tuning to run faster and make sure I don’t have any memory leaks or excessive garbage collection.

Effects
While I love the style of the game and think it’s gorgeous when it runs at 60FPS, it’s still a bit bland. It’s lacking anything that makes you go “Wow” or even “Neat.” I think what’s needed here are more of the effects that make the game feel more alive, and I’ve begun adding those.

Defense Mode and Editor
Defense mode and the editor need testing and bug fixing. I play skirmish and challenge maps a lot, but defense doesn’t get as much love. The editor, likewise, hasn’t seen any work or bug fixing in a while. There are also several bits of the game that need finishing, like the victory screen.

Map Sharing
I need to create a site for BattleGrid where I can support map submission, viewing, and downloads. I plan on letting players upload, rate, and download maps from the server. None of this has been set up yet.

Music
I’m not a composer, so this is going to be incredibly difficult for me, even though I know the style I want.

Goals for June
I’ve been playing a lot of Diablo lately, so I’ve cut back on how much I expect to get done. For June, I just want to get those extra effects in, and maybe some bug fixes for the editor and defense mode. I’m also planning on looking into what it would take to rewrite my AI as a finite state machine. I like behavior trees better, but my AI is so simple a state machine may work just as well.

Categories
Projects

BattleGrid Update – An Epiphany

So I finally had that epiphany I was hoping for. I should have expected it to come to me as soon as I decided to quit working on it…

I was reading over my last post (in which I decided to quit working on draw calls) and I realized that the majority of the vertices in that vertex buffer are used up by my grid tiles. Although each individual tile only has 4 vertices, the map as a whole uses up a large chunk of the 4000-vertex buffer. My problem was that I was trying to get everything into a single batch – it’s simply not going to happen because there’s too many vertices to batch. So I decided to try something slightly different. Instead of trying to batch everything together, I’ll batch all the tiles together, and all the structures separately. And today, after about 3 minutes of work setting up a new material for just the tiles, I’m down to around 20 draw calls. Well within the iOS “limit” with room to spare. So I’m happy and I can still move on to doing more interesting things.

Categories
Projects

BattleGrid Update – Screw Draw Calls

Trying to get my draw calls down is extremely frustrating. I’m slowly learning what I’m doing that’s causing the batching to break, but I’m also finding out that some of what I want to see (draw call wise) simply isn’t going to happen.

I just found out that the vertex buffer for draw calls is around 4000 vertices (at least as of 2009). For a 30×30 map, my grid alone is 3600 vertices (900 grid tiles * 4 vertices per tile). For a 40×40 map (my largest maps), that comes out to 6400 vertices – already too many to batch. So, trying to get my terrain and structures to batch together is futile anyway. On the other hand, it seems like I should still be able to get down to just a few draw calls. Even if I max out that vertex buffer each time, I should still only be making about 4-5 draw calls, not the 86 I’m seeing. Those 80 extra draw calls are really causing me grief, and Unity can’t be so stupid about ordering things that it can’t properly organize the batches…

So for the time being, I’m going to forget about draw calls and get back to the fun stuff – AI and bug fixing. I’m going to do some optimization to the AI to get it running smoother, then fix the few things that are still slowing things down (like rendering map previews). Maybe I’ll also take a stab at the map submission website. Anything to get my mind off those damned draw calls.

Categories
Projects

BattleGrid Update – Graphics

Since I’m kind of stuck progress-wise until I figure out what to do about the draw calls in my game, I decided I’d do a post on some of the updated graphics in BattleGrid. Looking over the images I’ve posted in some previous posts, I realized that things have changed a lot since I posted those images.

New Tile Graphics
Tiles have gotten two big updates – first, I reduced the number of planes used for a single tile from three (base, owner highlight, and an extra highlight) to one, which cuts the number of polygons on a single map by two-thirds. Always a good thing.

Second, I found a really cool (and more importantly, free) circuit board drawing that I put on the tiles. I love the way it looks, and it makes the grid a little less barren.

The new map tile, with a circuit board texture.
The new circuit board tile.

The “contested” tiles also got a graphics update. They’re now “cracked” tiles. I like them, but they’re likely to see some updates before the final version:

The new contested tile.
The new contested tile, with a “cracked” look.

They look best on defense maps where it looks like the gateways have “infested” the map. Speaking of which…

New Gateway Texture
The original gateway texture hasn’t been shown before, but it was using a noise-generation function to animate the portal. It looked neat, but killed performance, so I scrapped it. I use a flat texture and a particle system now, which looks pretty good:

Gateway
The gateway, used by waves of enemies to invade the grid.

If the gateway looks a bit like the obsidian portals to the Nether from Minecraft, that’s good because it’s exactly what I intended. If they don’t… Well, that works, too.

New Buttons & Windows/Dialogs
I’ve said before I hate the gradient backgrounds on most of my buttons. The idea I’ve been thinking about for a while now is using scan line backgrounds, sort of like a holographic display. I finally created some, and I’ve updated practically the entire UI to use them.

The new “holographic” buttons come in two styles – the main menu buttons:

New play button
A good button for games to have.

And the window/dialog style:

Close button
Used for… closing things.

The dialogs themselves are supposed to look a bit like a holographic display. They’re lacking in depth, though, but with my new UI framework, I should be able to eventually do something about that.

Pause menu
Kind of boxy.

The new UI uses a package called “NGUI”, which is actually pretty cool. I’ll write a separate post about NGUI soon, since it has totally changed how I think about the UI.

New Factory Model
The last time I mentioned factories, I said the factory was likely to see another model update, and they have. The new model looks a lot like the original:

The newer new factory.
The new(er) factory

However, this one is animated, so when it’s building the “wings” fold down and spin:

The newer new factory, building a tank.
The new factory looks better when it’s moving.

It looks pretty cool in action. I also added a “platform” under the factory to make it a bit easier to tell that the factory covers 9 tiles. The platform isn’t in these images because I took them before I added it. Maybe next time.

Categories
Projects

BattleGrid Update

I’ve scaled back my work on BattleGrid a bit. Through February and March, I was working on BattleGrid like it was a second job, and I could definitely feel some pressure building. I was making a big push to get something ready for PAX, and even though I missed that target, I’m happy with the work I got done. It’s just not a sustainable pace.

That said, I’ve been working on the problem I mentioned in my last BattleGrid post – draw calls. I’ve been trying to get batching working properly, and to that end I’ve got my texture atlases set up and all my meshes updated to use the atlas. In theory, a scene in my game should be using less than 10 draw calls: 1 neutral material (for the neutral player and projectiles), 4 colored materials (1 for each player), 2 for the UI (foreground and background), and a few for particle effects. Instead, I get 300 – 400 draw calls. For those of you keeping count, that’s 3x more than before creating the texture atlas and updating all my meshes. It’s the exact opposite of what I expected.

I know the atlas is supposed to work, so there’s obviously something else I’m doing wrong, I just don’t know what yet. Maybe I’ll have an epiphany and realize I’m doing something stupid, or maybe I’ll spin my wheels for a month or two and get very little done. I’m hoping for the epiphany.

Categories
Games

Mass Effect 3 – The Ending

There’s been some “discussion” on the Internet about the ending to Mass Effect 3. There’s even a theory that the ending isn’t “real” and coming DLC will reveal the truth – called the “Indoctrination Theory” (GameFront has a good writeup about it here: http://www.gamefront.com/mass-effect-3-ending-analyzing-the-indoctrination-theory/). I’d love to find out BioWare was just tricking us, because the ending as it stands is extremely unsatisfying. The ending is boiled down to a single choice between 3 options, just like Deus Ex: Human Revolution, and none of them are really satisfactory. Unlike most of the game, there’s no clear “Paragon” or “Renegade” choice, and while I loved the hard decisions I was forced to make throughout most of the game, I couldn’t find a choice I liked here – no matter what I chose, I felt like I was making the wrong choice. It’s not like Inception where the ending is left up to interpretation – there’s simply no ending to be had.

Not only that, but your decisions and war assets from the rest of the game don’t make any return for the final scenes. Collecting war assets only contributes to a number that unlocks the third option. And although the third option gave me the “happiest” ending (in my mind, at least), it still didn’t feel right. I love endings that are up to interpretation, but there’s so little closure at the end of Mass Effect 3 that it feels like something’s wrong. The rest of the story was fantastic, and the universe is so fleshed out that it speaks very highly of the writing – dialog is perfect, the characters had so much personality you could become attached to them, and there were several jaw-dropping twists along the way. In spite of all this, the ending feels empty – almost as if they gave up or ran out of time. Or maybe they just couldn’t figure out how to end it and wanted to see how everyone reacted.

Categories
Games

PAX East 2012

I thought it would be fun to do a “roundup” sort of thing about what I saw/played/liked at PAX East this year. I’ll start with my favorite stuff, so you can quit reading or skip ahead if you get bored.

My Favorite Game: XCOM
I knew there was a strategy XCOM coming, but I haven’t been keeping up with game news, so I knew nothing about it. Seeing it at PAX (both on the show floor and in the XCOM panel) got me extremely excited about the game. I loved the style of the turn-based combat, with extra animations as things were going on. The “ant farm” base looked awesome, too. It was also great to see that they’re drawing so heavily from the original – I can’t wait to play it when it’s released later this year.

My Favorite Not-Game: “Day in the Life of an Indie Dev” Panel
I mainly liked this because it reinforced everything I’m already doing in the development of my game, which was mainly “Just make a game.” They even mentioned Unity several times, so I’m happy with my choice of tools. I only attended “part 1”, but it made me feel good about the path I’m taking with my game, so it’s all I needed.

What I Played
Monaco
I knew a bit about Monaco, but after playing it, I know it’s a day-one purchase. Even though we crashed the game, it was so much fun, even when I kept screwing up and alerting all the guards. My favorite moment: Matt saying “Don’t bring them toward me!” as an army of guards was chasing me.

Guacamelee
This was probably my biggest surprise at PAX this year. I had heard nothing about Guacamelee, but it’s a fun platformer that looks gorgeous, has good writing, and has a neat “dimension-shifting” trick.

Bloodforge
A God of War-like action game that’s pretty generic, but really fun to play. It has really nice graphics, which was apparently part of the goal of the game – to create an XBLA game that looks like a AAA game.

Trials: Evolution
If you’ve played Trials, you know how this plays. The multiplayer was really fun, though.

Star Wars Kinect
The more I see of this game, the more I want it, even though it’s just a collection of different game styles. I played the Rancor destruction game, and it was fun, mindless destruction.

Go Home Dinosaurs
This is a neat tower defense game for Chrome (NaCl), where you play as gophers who are trying to save their barbecue from dinosaurs. The “towers” are shaped like Tetris pieces, so you have to arrange them in the open area of the maps. It’s also got a kind of “deck building” feature, similar to Plants vs Zombies.

Raiderz
I got a free mug and bag for playing it. That was the best part.

What I Saw/Watched
Assassin’s Creed 3
Looks amazing. I’ve always loved the AC games, and I’ll likely buy this one right away.

Antichamber
I played this a while back as a UDK demo, but it’s come a ways since then. It still looks like a great FPS puzzler that encourages a lot of outside-the-box thinking.

AirMech
I wish I took the time to play this. It looks beautiful, has transforming jets, and looks really fun.

Mark of the Ninja
This looks like a cool Metal Gear Solid-style stealth action game. I wanted to play, but media badges got in the way and I was tired.

Crimson Dragon
A Panzer Dragoon clone that plays like Child of Eden. Child of Eden was hard to play with Kinect, but hopefully this is a bit better. It has dragons, so I think I am required to buy it.

Steel Battalion: Heavy Armor
This looks cool, and the Kinect controls seem to replace the need for the giant controller. I’ll have to play a demo before I buy it, though – the Kinect controls seemed to be having some issues, though that may have just been because of the crowd.

Novus Aeterno
An MMORTS that looks a bit like Homeworld and I’m a sucker for RTS games with space ships. According to the devs, it’s $30 with no subscription, so it might be worth it. I’ll at least play the beta coming up later this month.

That’s all I can think of for now. I might add more later.

Categories
Projects

BattleGrid – PAX

As stated before, I was aiming to have BattleGrid playable on my iPad by PAX so I could get feedback from strangers. While the game is certainly playable on my iPad, it still suffers from framerate problems when things get hectic, so I’m probably not going to be showing it to strangers – it’s simply not ready for that.

I think I’ve figured out how to fix the framerate problem, I just don’t know exactly how to do it, and the only tools I’ve found to help either don’t work well or are a bit complex.

The problem is that iOS simply can’t handle drawing a lot at once. Unity uses “dynamic batching”, which means that each time it needs to redraw, it batches everything together that’s using the same material (textures + shader) and sends it as a single draw call. My game uses about 100 – 140 draw calls in busy scenes. Everything I’ve read says I should keep it below 30 draw calls for good performance. So I’m using over 3 times as many draw calls as I should.

I think I know what needs to be done to fix it – I need to use a texture atlas. This means taking all the individual textures and cramming them into a single big texture. This is the easy part.

The hard part is that the UV mapping on all the models also needs to change. The UV mapping defines what part of the texture is displayed on each face of the model. When all the textures are combined, I need to scale and offset the UV coordinates for each model, and I can’t find a tool to make this easy. In the end, I’ll likely just write a tool to do it myself, since working with meshes in code isn’t too difficult. Writing a tool to do the work for me will take some time, though, so there’s no time to do that before PAX.

I’ll install BattleGrid on my iPad 3 and see if it runs better, but I’m not getting my hopes up.

Categories
Development

I think this sums up why I like programming games.

public enum DamageType
{
    /// <summary>
    /// Average, everyday damage.
    /// </summary>
    None,
    /// <summary>
    /// PEW PEW PEW
    /// </summary>
    Energy,
    /// <summary>
    /// BOOM!
    /// </summary>
    Explosive,
    /// <summary>
    /// HULK SMASH!
    /// </summary>
    Kinetic,
    /// <summary>
    /// You shall not pass!
    /// </summary>
    Magic,
}

What should I add?

Categories
Projects

BattleGrid Update

Wow, two months since the last update. Well, the last update I actually published to the blog – I’ve had about a half dozen posts I’ve started but never finished because the things I was writing about changed before I was finished. And because I wanted to add pictures I never got around to grabbing. So this post is going to sum up everything from those half-finished posts.

I spent a lot of time last month tweaking things, figuring stuff out, and updating graphics. It was a good month of work, and resulted in most of the frustrating bugs being fixed.

Toward the beginning of this month, I sent links to a few friends to start getting some feedback. As expected, the feedback has been extremely valuable. The in-game UI has changed to something that works much better – something between the new and old UIs. I created a series of help screens based on feedback about what confuses people. I also got the idea to create a map for the sole purpose of testing the frame rate when things are hectic, and that one map is the map I play all the time now as I improve things.

A week or two ago I installed BattleGrid to my iPad. It runs, but as of the last version I installed, the controls weren’t working, and the game ran terribly. On my test map, the FPS would drop to 3. Yikes. It’s good that it’s running, though.

Unity also decided to give away their “Mobile Basic” kit, which includes iPhone and Android publishing, so BattleGrid will probably end up on Android tablets at some point. I’d need an Android tablet to test with, so the iOS version will still come first and long before the Android version.

Some of the developers in the Unity Asset Store decided to put their stuff on sale with Unity giving away the mobile kit, so I’ve spent about $200 on development tools to make my life easier. I’ve been pretty pleased with most of what I’ve bought, but there’s a downside… I bought a new UI framework, and I’ve been moving my entire UI over to use the new framework. The framework is fantastic – it’s much more efficient than what I had and much more flexible, but it has taken time to figure out its quirks and how to use it properly. I also got a tool that handles gestures for me, so I’m replacing a lot of my control code with updated code that uses the gesture framework.

My productivity has also suffered because Mass Effect 3 was released and I’ve spent a ton of time playing it.

So, I might not hit my PAX deadline for having something playable… I’ll see what I can get done this weekend and next and cross my fingers.

I’ll also try to post some more updates soon about the changes I’ve made.