Categories
Projects

BattleGrid Update – February 2013

It’s been a while since I did a BattleGrid update, and it’s probably about time I caught up.

The last few months have been busy with Christmas, moving, and other miscellaneous real-life stuff. I started seriously working on BattleGrid again this month, and I’ve made some significant changes.

I’ve replaced the factory units twice – first to little drones and then to bigger flying units. Units are all airborne now, which saves time when trying to find a path (they don’t need to navigate around structures). The new units are a gunship and a bomber. The gunship features twin machine guns – my first unit with multiple weapons. The machine guns target independently, so the gunship can attack two targets at once or focus both turrets on a single enemy.

BattleGrid's new gunship
The new Gunship in BattleGrid.

The bomber has a four-torpedo “clip” – the first unit to use the “clips” feature in my weapon class. Once the bomber fires its four torpedos, it has to reload, so it’s defenseless for a short time.

BattleGrid's new bomber
The new Bomber unit in BattleGrid.

The third unit I’m planning is an interceptor that specializes in destroying enemy units, but is weaker against turrets and structures.

Along with these changes, I made some significant progress on pathfinding, so the units move very smoothly over the grid, which is something I was having trouble with before.

Since these units worked so well, I’m going to introduce bosses to the defense game mode that are bristling with weaponry.

With the enemies being airborne, I had to update the gateway model where they spawn. I added a nice new particle effect with the change, which I really like – it’s all swirly.

New gateway and spawn effect
The new gateway and spawn effect. (Obviously looks better in motion)

I replaced the map border so it doesn’t take up so much space. The new border is a series of “nodes” that attach to the edge of the map. I’m not quite satisfied with them yet, though.

I also went through the projectiles and lowered the poly count a bit. I figured I didn’t need much detail when projectiles are tiny and only on-screen for short periods. I fixed a bunch of bugs that have been lingering as well, so there’s been a good bit of progress lately.

New Plans
So with these changes, I’ve been doing some thinking about gameplay and balance. It’s been very difficult to get the factory units (gunships and bombers) balanced with the turrets, so my plan for now is to disable the factories entirely, and use the units only for the wave (survival/tower defense) mode.

Wave mode itself needs some work, as it doesn’t feel quite right. I’m not sure exactly what’s wrong or how to describe it – there’s just something about the game mode that doesn’t feel satisfying. Aside from that, I’ll need to make changes to the structure list for wave mode, as certain structures are useless against the now-airborne units. The artillery, for instance, isn’t able to shoot at airborne enemies. My best idea right now is to replace the artillery with an expensive anti-unit flak turret. I’ll see how the next few months go before I make any final decisions about changes to the skirmish and wave modes, but I know something needs to be done to improve the feel of the game.

Categories
Projects

BattleGrid Update – October

Goals for October
Effects and bug hunting – same as September.

What Got Done?
Like last month, this month has been slow. I continued my work on effects and tried out a few new things to make the UI a bit more dynamic and interesting.

I also expanded the AI a bit to make it more intelligent about structure placement, which worked out nicely – so well that the AI was placing structures in the same places I would have. Right now, it’s a little too precise (it can get stuck trying to place a structure in the same place as an existing structure), but that will be fixed by adding a little randomness to it.

What’s Left?
At this point, I’m mainly focused on cleaning out remaining bugs so I can get something that’s complete and playable. My biggest bugs (and some of the heaviest load) comes from my factories and mobile units, so I may scrap them (at least temporarily), and replace them with more interesting turrets.

There’s still the music to worry about as well as loading and saving, which is kind of important.

Goals for November
I want to finish some of the changes to the AI to make it work better, and maybe even get around to implementing the loading and saving.

Categories
Projects

BattleGrid Update – September

Goals for September
Effects and bug hunting.

What Got Done?
This month was pretty slow. I did fix some bugs and add or modify a few effects, but I didn’t get as much done as I’d have liked. However, I did start work on a level intro sequence, which should be nice once it’s finished. (I also added in code so the intro sequence can be skipped if players are impatient)

What’s Left?
Basically the same as last month:

Bug Hunting
I fixed a few annoying and game-breaking bugs in September, but there are still many more to take care of.

Music
While I’ve still got some ideas for creating music myself, I think I may have more success using the Unity Asset Store for some nice music. It’s pretty affordable, so I might try a few things, anyway.

Polish
I’m working on some effects to really get the “hologram” effect I want in the UI, and thanks to a few recent/upcoming games (Borderlands 2 and XCOM), there are some good examples of the effect to use as a reference.

Implement Loading and Saving
Still needs doing, and I still think it’s going to be difficult.

Goals for October
More effect work and cleaning out bugs.

Categories
Projects

BattleGrid Update – August

Goals for August
AI and effects, the theme from the past few months.

What Got Done?
A lot, actually:

Effects Updates
I updated how I handle effects to make things easier for future development. I also added some new effects and updated old ones. Specifically:

There’s now a build animation when structures are built. It started out pretty lame (structures rising through the ground), but now there’s a new particle effect that looks pretty good. Either way, it still adds a lot to the game and gives you an indication of when structures will complete.

I added a map border, Supreme Commander-style, that caps off the map nicely and hides anything under the grid (like structures being built). I’ve got some plans for a level intro that will make use of the map borders.

I added a quick effect when a player captures new grid cells that looks fantastic. I liked it so much that I modified the map generation to use the same effect. This is easily one of my favorite effects so far – it’s very simple, but looks nice in-game.

I added some new UI effects that make it clear when you acquire and spend resources. This wasn’t really necessary, but I’ve been wanting to show something when your resources change. The effect right now is pretty simple and has some potential problems (like never going away if your income is ticking at the right intervals), so it will likely see a few updates.

AI Updates
As described in my AI post, I rewrote the “strategic” AI. After that success, I decided to rewrite the other AIs (turrets and pathfinding for units). The result is a greatly improved and simplified AI across the board, so it performs better and is less error prone. It was a good month for the AI.

I also found the source of some problems I’ve been having with turret targeting, and I’m working on an interesting solution to solve it (basically, everything will “talk” to each other – “Hey shield, I’m targeting you!”). When the changes are finished, targeting should run faster since I won’t have to validate the target list when scanning for targets – it will be managed automatically as the state of units changes.

What’s Left?
I’ve decided to scrap the map sharing features until after launch, depending on user feedback and success of BattleGrid (or a Kickstarter, if that happens), so my to-do list is getting slightly shorter.

Bug Hunting
There are some odd bugs that crop up from time to time that need taking care of, and the easiest way to find them is to play the game. Hopefully I don’t get bored.

Music
Yes, still. However, I finally have some ideas about how to go about the music, which I’ll eventually detail in another post, once I actually have some results.

Polish
I’d have put “Effects” again, but that was getting boring. The effects already present need polish, and new effects might come in to replace them. The AI might need a little tweaking, or at least some of the numbers it relies on, but the AI itself is pretty satisfactory right now. Aside from making some minor improvements to make it a bit more intelligent about placement, I probably won’t touch it much more.

Implement Loading and Saving
It’s harder than it sounds. I have a storage mechanism for the maps themselves, but storing where every structure and unit is, plus their firing state (how long until they can fire again) is difficult. I’m thinking about simply storing where everything is and treating a reload like a challenge map – just load everything and start the fire cycles from there. It would just suck if you had the game-winning artillery shell in flight when you save and it doesn’t reload that way. Then again, if you were that close to winning, you’ll probably still win.

Goals for September
Mostly effects and bug hunting. I’ll also do some cleanup on the code to get rid of things I’m not using so I can hopefully pick out the code with the bugs easier. And, if I get around to it, work on the music.

Categories
Projects

BattleGrid Update – AI

One of the biggest hurdles I’ve had to face with BattleGrid is the AI. How do you teach a computer to play a strategy game? It’s obviously been done plenty of times, but I don’t have the expertise or experience that developers behind big-name RTS games have.

In general, I try to go simple when developing. The simpler the code, the less error-prone it is, and the easier it is to fix problems or add new functionality. I thought my first attempts at AI for BattleGrid were pretty simple. I had narrowed the number of things an AI might do to 5 categories: attack, defend, capture, expand, or extract (claim bitstreams). There was a lot of overlap between the 5 categories, but implementing each one was difficult, and they could conflict with each other easily.

I recently decided to try simplifying the AI further. I trimmed the 5 categories to 3 (expand, extract, and build), and then further to a single goal: build. Once I made the switch, the AI worked almost flawlessly – it never broke and even seemed to be playing intelligently at times. With this single objective – build – I could focus the AI on the important parts – selecting what and where to build. When something goes wrong (can’t build in the desired location, can’t afford the desired structure), it’s easy to abort and start over, letting the AI pick something new to build.

The AI’s thinking goes something like this:

  1. Pick a structure to build.
  2. Pick a location to build the structure.
  3. Wait until I can afford to build the structure.
  4. Build the structure.

It’s a simple process, and the first two steps are the important ones.

When selecting a structure, the AI uses several factors. First, if there are bitstreams in their territory that don’t have extractors, they choose to build an extractor (as any player should). If not, they look at all the structures they can build and choose one based on their aggression and the effectiveness of the unit against their enemies. If the AI’s aggression is low, they’re more likely to select a defensive structure like shields, factories, or artillery – structures effective when turtling. If it’s high, they’re more likely to choose missile turrets, blaster turrets, or outposts – structures effective for quick expansion and harassment. The second factor – effectiveness – makes an AI more likely to choose the best structure to counter an enemy. If you have shields, they’re more likely to pick factories (units can enter the shield) or blasters (bonus vs shields). If you have artillery, they’re more likely to build a shield. Between the two, the AI can make a fair decision on what would be best to build.

When placing a structure, the AI uses one factor primarily – fragility. This is a new value I added that tells the AI how “fragile” the unit is, which basically translates to whether the structure should be placed on the “inside” of their territory (closer to outposts) or on the edge. It’s probably not the most accurate term, since it’s different from the structure’s health or strength – the blaster, for instance, has low health but a fragility of 0, telling the AI to build it close to the edge of their territory. Shields, factories, and artillery have a higher fragility, telling the AI to put it closer to their outposts or core.

Between the two, I’ve seen some interesting habits. The AI is pretty good about placement of outposts – they usually go on the edge of their territory to provide maximum expansion. Turrets are placed in about the right ranges to counter effectively – missiles are usually placed outside the range of blasters, for example. They’re also more likely to use shields or factories, which is great. Overall, I’m extremely pleased that such a small change – and more importantly a change to a simpler design – has resulted in a fairly dynamic AI that behaves well and is easy to tweak.

More importantly, I’ve started to lose against my own AI. The harder AI cheats a bit (it gets more money than the player), but I’m having a hard time out-maneuvering it. Sometimes the AI is downright brutal, using outposts to box me in and restrict my resource capacity, limiting what I can build and leaving me to build blasters on the edge of my territory in a feeble attempt to fight back. And then the AI builds a new outpost, neutralizing my blasters and leaving me powerless, waiting for my inevitable defeat. Which is a wonderful thing when I’m trying to develop a decent AI to play against. Of course, that means I need to tweak some settings so a come-from-behind victory is possible – especially now that I’m finding myself in that position.

Categories
Projects

BattleGrid Update – July

There wasn’t much progress in July. Between the July 4th holiday, the Steam summer sale, and buying a new home, I didn’t have as much free time as I’d have liked.

Goals for July
My goals for July were to get some work done on the AI and effects.

What got done?
Toward the end of the month, I finally got down to business and worked on ironing out some AI bugs. The AI won’t wait for you to claim any bitstreams in your territory anymore (though they still seem to think a while before deciding to do something else), and they’re slightly less likely to go totally brain-dead later in the game. I also fixed an annoying bug with structure placement.

I also started running into a bug where my UI texture atlas is being sent to the web player at a really low resolution, causing the entire UI to look blurry. For the time being, I’ve been testing using a Windows executable deployment, which is great because the game runs at 150 – 200 FPS as a native executable. And BattleGrid looks pretty good when it’s running silky smooth.

I also started thinking about some new ideas for the graphics, and while I doubt I’ll use them for this game, I might use the ideas in a future project. Here’s a shot of what I was working on:

Voxelized blaster turret
The blaster turret from BattleGrid rebuilt using voxels.

What’s left?
AI Rewrite and Updates
I need to improve the AI a bit further, and there’s still the rewrite option open. I’m still not sure if I want to move to something else. Either way, the strategic AI is still pretty weak.

Effects
Same as before, I want to give some more life to everything.

Map Sharing
Still to-do, and tempted to scrap it entirely. I may just postpone it until post-release, since the editor is already working and players can make their own maps – they just won’t be able to share them.

Music
I’m starting to get some general ideas for the music, but I’m still stuck on the actual creation part.

Goals for August
Last month’s goals carry over into August – AI and effects. It’s going to take some epiphanies to figure out exactly how to handle the AI. I could make the AI smarter about picking and placing structures, but I’m not yet sure how to do that efficiently. Right now, structure placement is mostly random, aside from outposts.

The effects are a bit easier to get done, but they don’t feel final, so they’ll still need work until I find something I really like.

Categories
Projects

BattleGrid Update – June

Time for the June update, a little late because the end of June was busy… In June, I managed to clean up a few things, fix some annoying bugs, and do some general housekeeping. I didn’t get as much done as I would have liked, but that’s what I expected.

Goals for June
My goals for June were to add some extra effects, fix some bugs with the editor and defense modes, and look into some new options for my AI.

What got done?
New Effects
I added in a few new effects, but not as many as I’d like. Nearly every unit has a sound effect now, but they will likely need to be improved. I switched back to a few better-but-higher-draw-call effects (projectile trails) because of rendering improvements with the map and units.

Defense Mode Testing
I tested the defense mode, fixed a few bugs with it, and added some new UI elements for it. I think defense mode is about done – the only bugs left are general bugs not limited to defense mode.

New Resource Storage Concept
I had a new idea for how to handle resource storage to make it a bit more dynamic, so I implemented it. I’m happy with how it turned out, and I think it adds a lot to the game. I’m planning on describing the changes in a later post.

UI Update
I cleaned up my UI textures so it’s easy to create new pieces of the UI and should lower texture memory usage overall. I also updated the map previews to load from disk rather than being generated at runtime. While the runtime generation was neat, it was a huge processor hog. Finally, I added a new loading screen that features a progress bar so I can start to track loading times (and hopefully reduce them).

What’s left?
AI Rewrite and Updates
Same as last month, the AI still needs to be rewritten in a new system (if I choose to go that way), and I need to improve it overall.

Effects
There are still a few effects left to add. Mostly sound effects, but also some particle effects and maybe some miscellaneous environmental effects.

Map Sharing
Same as last month. I still need to create the website for BattleGrid map submissions. Along with this, I’ll need to update the UI in-game and think of an elegant way to let the player browse through possibly hundreds of maps.

Music
I’m still terrible at creating music. Even if I think I have a good idea, I don’t have the skills to make good-sounding music from it.

Goals for July
I’ll likely focus on the effects and AI for July, since they’re the biggest “gamey” parts left to implement. Once those are done, I’m down to the ancillary stuff like the map sharing site and the music, which I still expect to take several months while I try to build some music-making skills.

Categories
Projects

BattleGrid – New Gameplay Concepts

I’ve been considering some new gameplay concepts and decided to implement a few and see how they pan out. This post is about a new resource storage concept.

Currently, each player starts with a resource storage limit (“cache”) that is determined by how many outposts they control. The player’s base (“core”) provides storage for 100 bits. Each outpost adds storage for 10 bits. A player can keep building outposts to increase their storage capacity.

The new concept moves the storage to the grid cells you control. This means outposts are still the structure that provides more storage, but only because they expand your area of control. Grid cells started off as simply being the area you can build in, but now they’re much more important. Each grid cell you control can store 1 bit or power a structure. If you build on a cell, you lose the storage capacity for that cell, but gain whatever benefits come along with the structure (like being able to kill things).

This change has several side effects. Placement of outposts becomes a bit more important. Building an outpost on the edge of your territory is best, since it provides the biggest increase in storage capacity. However, overlapping outposts are still fine since it means losing one won’t cause a big dip in your storage capacity.

Another side effect, and the one I like best, is that building outposts to contest enemy control areas is an effective way of cutting off their storage – it’s like attacking their supply lines.

In the past, I found myself building several outposts around my base just to be able to build bigger structures (artillery and shields). It’s not a strategy that I intended, and it would be difficult to teach the AI the same strategy. However, the AI is already decent at expanding its control, so this change should put the AI on more equal footing with the player.

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.