Sunday, March 27, 2011

And it's away!

I've just submitted Praetor to the Zune marketplace for inclusion in the WP7 app catalog. It will take several days at least before I know whether they're willing to include it as-is or require changes first.

It's been almost exactly one full year since I started development, and this is unquestionably the biggest game I've tried to produce under my one-man "Random Software" hobby label. The final package, fully compressed and encoded for release on a cell phone, is 24MB; anything beyond 10MB is considered sufficiently big that you need to connect your phone to a computer to download it, so this lands squarely in the Epic category as far as cell phone games are concerned.

I'm releasing Praetor exactly as my wife wisely suggested: rather than finishing the full hundred battles immediately, I've done a solid 25--including the first mini-boss and completing the entire Earth Magic saga. If this Episode 1 proves popular enough to justify the extra effort, I'll push ahead with Episode 2 where we wander into the lands where Water Magic prevails--and then on to Air and Fire if my enthusiasm stays strong.

So, congratulations to me! All three readers of my blog can rejoice. With projects that take a year to complete, it's pretty rare to get one to this stage of completion--and that feels pretty good. I'll post again if/when it finally shows up in the Zune marketplace.

Thursday, February 3, 2011

Praetor Progress


When we last left our hero--on Christmas day 2010--he reported in with 4 Praetor battles completed and good hopes for the future. Today, about 5.5 weeks later, the total stands at 23 completed battles and the game is looking great.

My wife is pushing me to declare victory at 50 levels, composing the game for a decent storyline completion halfway to my original goal and releasing it to the general public at that point with an upgrade (or "expansion pack" as she calls it) to follow down the road. And I have to admit I'm starting to like the idea; Praetor is turning out to be a lot of fun, and I'd like to see if it can actually build a following or not before I plow N more months of effort into it. At expert difficulty each battle still takes me 5 to 10 minutes, so 50 levels is between 4 and 8 hours of game play--perfectly fine for a 99-cent cell phone game.

I've also started adding more material to the web site--a couple of new screenshots and the beginnings of a strategy guide to help you get through the levels. Some of them are pretty tough, and reading through the guide you can see how your tactics have to shift as the opponents get stronger and you get new pieces to work with.

Monday, January 3, 2011

Robots.

Not really gaming related, but it's taken up some of my free time lately so I wanted to share my latest toy.




Several other amateur-robotics photos and videos are collected in that same path, available for browsing on http://www.randomly.com/richard/robot.

Saturday, December 25, 2010

Praetor: Not Dead!

It's been a few months since I posted here--a gap that started, appropriately, just after I declared Praetor past the hard bits. Heh.

The delay has been caused by a new project starting at the office, which has consumed all my free time. The office is shutting down (as in, fully powered off while they swap power transformers or something) for a whole week during the holidays, though, so I can't make any progress on my Official Work and have plenty of time to play with Praetor again.

A few months ago I hired an artist to provide the big map, a 4-megapixel image that the game will reveal progressively as you work your way through the campaign. He delivered that in October, and it's perfect. A lesson from this: invest a little and farm out the things you can't do well to someone who can. If I'd done that map it would've looked awful; instead, this key piece looks like something out of the Lord of the Rings and it adds credibility to the whole project. Here's a small piece from it to give you an idea:


In addition to incorporating this gem, over the last few days I've made a lot of little changes: polishing up the tutorial, fixing bugs, rounding off the UI (adding an options dialog, delete-game popup and so on) and even adding some new content.

I've also made the executive decision that this first release will provide the campaign game only: no two-person online play yet. That's an unpleasant step back but it's very freeing; there was a good month of work needed to allow two-player games, and I don't want to waste that time. Now I can focus on the campaign, which is really the essential one-player RPG part anyway.

The role playing campaign takes place over 100 battles that occur as you work your way through the world map. Last week I had one test battle available; now I've thrown that test code away and have 4 finished battles instead--each with its own enemy, sound effects, game strategy and incorporation into the campaign narrative. In other words, the game is now 4% complete. Experience says it takes about two hours to add each battle at this point, which means I'm about 192 working hours from finishing the app.

That sounds like a lot, but in truth it's pretty exciting. Just as I predicted last time, I'm now seeing Praetor marching forwards: every few hours I extend the campaign a little further, and I'm already seeing my character increase in strength and gain new playing pieces as he racks up victories. And best of all, the freaking game is fun--I'm really enjoying the test play, and am still learning new ways to use the pieces I have.

This thing's going to be a winner, and I'm all excited about it. :)

Saturday, September 4, 2010

Progress? Yes, that would be lovely. Thanks.

I think Praetor has finally gotten past the Hard Part.

Every project reaches a point where multiple subcomponents have become functional--maybe not finished, but at least functional--and it's time to integrate them. That's when the real hairball begins. Integrating the audio, the rendering engine, animation sequencing, the storage subsystem and so on turns the complexity knob up to eleven. If the subsystems aren't individually stable or if their interfaces were designed poorly then the whole thing usually cracks and the project ends. On the other hand, if it hangs together, the the rest of the project gets easier and easier.

Being such a large project (okay, large for a one-man outfit anyway), Praetor has had an unusually long period of integration. Fortunately, though a number of minor problems have turned up from time to time, its separate subsystems have held up very well indeed and I believe the worst of the work is over.

At this point one can start a new Campaign, read through some filler RPG elements, mess with the world map, challenge enemies and actually play a full battle against the enemy. If the player loses there's more RPG elements and the player gets to retry; after a victory the world map expands and new options appear. The computer AI--rewritten three times--plays a tough game and moves quickly. Changes in the game are saved persistently, and one can pop in and out of the game without any ill effects--perfect for handling inbound phone calls for example. In other words, it's acting like the real, final game should.

But having passed the tough part doesn't mean it's anywhere near halfway done.

This project is unusal for me in many ways, not the least of which is that it involves a lot of content. Most games I produce rely on either fixed or random initial conditions; they don't have narrative, they don't require a series of fifty different playing boards or anything. I pick projects that are simple like that because I don't have time (or adequate creativity) to fill in all those details.

Praetor, though, needs a lot of content. The campaign alone involves a hundred different battles, each with its own playing field and custom opponent, and most of them use new types of cards. There are narrative elements throughout the campaign, and unique graphics and sounds for all this stuff. And I only have a small fraction of that finished: one territory's battlefield, seven or eight different cards and "TODO: show something meaningful now" text appearing for the campaign RPG elements.

All that stuff is bulky, but none of it is particularly risky. So at the point the game looks like it will make it--it's just a matter of time.


^^^
Hey, look, new screenshots!

Monday, August 23, 2010

When AI is plenty A, but not so I

Normally one of the parts I like best about writing a strategy game is implementing the computer opponent. Trying to find a balance between heuristics and raw CPU horsepower is almost as much fun as playing an AI-enabled game and losing to it for the first time.

In Praetor, though, the AI is a pain in the ass. The problem is that each player has way too many options.

Consider chess: on the opening move you have 20 different moves from which to choose. A computer player could pick the best first move by simulating the board after each one of those 20 moves, and deciding which of the resulting boards looks the best. Not so bad, right? Just 20 moves to consider--can't take too long. That's called a "1-ply" search.

But regardless of the computer player does first, the second player then gets a turn--and he likewise has 20 moves to pick from. If the computer player wants to consider his opponent's responses, then for each simulated move it makes it needs to consider each possible response by the opponent. That would be a "2-ply" search, and it means the computer would be setting up and studying a total of 400 boards to decide which first move is probably best. As the game progresses the number of options each player has will increase a little because the board opens up, but then it also starts decreasing again as pieces come off the board. If we average those effects and assume that each player always has roughly 20 moves to choose from, then a 3-ply search would require the computer to consider 8,000 boards, and a 4-ply search would involve considering 160,000.

In Praetor, an average piece has about 18 squares to which it can move--maybe limited to 12 in a typical case because of terrain or other pieces being in the way. The player can play cards from his hand, and most cards either let you pick a target piece or square to manipulate. Some pieces have special abilities they can invoke, and others will happen to be within range to attack enemies. And here's the real pinch: most actions a player takes use up some energy, and a player's turn continues until he runs out of it. So instead of just picking which single piece to move or card to play, a player needs to pick what order to do those things in for each turn. Is it better to move then play this card, or play this card then move?

All those options mean that, just a few turns into the game, a player typically has millions of possible ways to play on each turn. Which means that even a simplistic 1-ply brute force search is out of the question (remember, the first release vehicle is a cell phone: not much CPU to spare). So what to do?

Heuristics to the rescue. A modern chess AI for your desktop will easily walk 8- or 9-ply deep--that would be 512 billion chess boards if it were walking that tree brute-force (e.g., considering every option). There's no way that's going to happen, which means chess AIs also rely on heuristics to prune that vast tree of options.

The goal of heuristics is always the same: to quickly identify probably-pointless moves and discard them, so you can reduce the number of choices that you have consider at each stage. With Praetor, since the game tree is so wide, I need to rely on heuristics that prune pretty heavily in order to get good moves in any kind of reasonable amount of time.

The first heuristic I've chosen is the most drastic: instead of considering in depth the result of moving every piece to every square, I'm going to have the computer quickly consider each square and pick exactly one to consider in depth. That immediately reduces the millions-of-options-per-turn to just hundreds-of-options-per-turn. I also plan to heuristically restrict where particular cards can be played: no point in sending a fireball there since it wouldn't hurt any opposing pieces, nor there since it would hurt mine. Sometimes sacrificing a piece would let the AI win the game six moves later on, but most of the time it's dumb so I won't even let it look.

Monday, August 16, 2010

Praetor in Pictures



They say a picture is worth a thousand words; I hope so, because I'm many thousands of words behind in posting to this blog and yet I have a lot of pictures to show.
(Click the picture--or right here--to see a lot more stuff.)


As my family will tell you, I'm still working full speed on Praetor as I try to get it ready for an early launch with the Windows Phone 7 devices that are coming out later this fall. This is such an ambitious project that I don't think a 2010 launch of the game is realistic, but I'd like to have it substantially complete by the end of the year anyway.
I've got a lot to post about move sequencing, network gameplay and computer AI--just too busy coding to explain what I'm doing. So hang in there, more posts are forthcoming as things slow down.