Coding Projects‎ > ‎



The latest version is PatientBarrage v1.00, released on 7/5/11.
PatientBarrage v1.00 - Windows
(Linux and Mac OS X are unsupported, sorry!)

Extract the zip file to some temporary directory, run setup.exe to install, then run PatientBarrage.exe.  This is an XNA Game Studio 4.0 game, so you'll need to have the proper XNA Runtime and .NET frameworks, DirectX, etc. installed before running it.  -Theoretically- the installer should handle all of this for you.
Note: Start menu shortcuts are not created by the installer.  If you want shortcuts, make them yourself.
Note for 64-bit systems: If you try to install in the 64-bit "Program Files" (non-x86) folder, the game might still end up in your Program Files (x86) folder.

PatientBarrage, more properly known by its full name: "Touhou Teidanmaku: -Patient Barrage-" (東方停弾幕 in Japanese) is the final project that I did for an Artificial Intelligence class along with my partner.  Unfortunately he was really busy at that time so I had to do most of the coding for the game myself, but he was still invaluable as a sounding board for design and game ideas.

The game is based on the Touhou Project series of "bullet hell" shoot 'em up games, and features Touhou characters, but with a twist: the gameplay is actually a 2-player (or 1-player vs. AI) turn-based grid-based strategy game, not a shoot 'em up.  The idea for this came up somewhat spontaneously as we were thinking about our shared interests along with what kinds of things might be feasible to make an AI for.

The game essentially proceeds like this: Each player controls a character that occupies one space on the 2D grid, and during your turn you can move one space (or not), face whichever direction you want, and fire off one of 4 different character-specific attacks.  The goal is to maneuver so that you dodge all of your opponent's attacks, while firing off projectiles that will trap them and force them to get hit.

Since it can be hard to tell exactly where a bullet is considered to be, red (for player 1's bullets) and blue (for player 2's bullets) squares are overlaid on top of the grid.  Solid red squares with highlighted outlines represent grid spaces where player 1's bullets are currently hitting, which solid blue squares that are highlighted represent grid spaces where player 2's bullets are hitting.  A space that's being hit by both players' bullets is marked by a teal outline and purple square.  Fainter squares are also displayed at the future positions of bullets, so you can plan ahead to avoid them knowing where they will go next.

-6 different Touhou characters, with 4 attacks each
-Difficulty setting affects the intensity of the attacks (Easy, Normal, Hard, Lunatic)
-Four different grid sizes, from 9x9 (Tiny) to 45x45 (Huge)
-Different AI agents and heuristics (though you should probably only use the default ones)
-Cool music that features the Touhou main menu melody

For something that looks like an actual Touhou game, try disabling the grid, hit overlays, and outlines, and watching an AI vs. AI match (turbo mode optional). =)

The main PatientBarrage song that plays during the game can be found at my Bandcamp site here.


Reimu Hakurei


*Special Ability: Reimu can wrap around the edges of the screen while moving*
Amulet Shot: A narrow spread of cards.
Persuasion Needle: Long needles shoot straight forward.
Fantasy Seal: Projectiles that shoot out and then become aimed shots.
Border Amulet: A circle of cards that wrap around the screen once.

Marisa Kirisame


Stardust Reverie: Shoots out a circle of stars.
Asteroid Belt: Spawns multiple spirits which shoot stars outward on subsequent turns.
Milky Way: Shoots large 2x2 stars.
Illusion Laser: A screen-length laser.

Sakuya Izayoi


Knife Shot: A spread of knives thrown forward.
Misdirection: Kunai which bounce off the edges of the screen.
Illusion Existence: Kunai which wrap around the edges of the screen.
The World: Spawns aimed knives around the opponent's current location.



Colorful Shot: Colored balls scatter outward randomly.
Icicle Fall: Shoots forward...but not straight in front of you.
Hailstorm: Shards of ice shoot outward in a circle.
Perfect Freeze: Freezes bullets fired with Colorful Shot and redirects them randomly.

Flandre Scarlet


Scarlet Shoot: Shots spread outward in a circle.
Cranberry Trap: Unaimed shots fire from the four corners of the map.
Forbidden Barrage: Shoots large 2x2 bubble bullets.
Four of a Kind: Spawns stationary clones that are able to use Scarlet Shoot before disappearing.

Lily White


Happiness of Spring: An arc of accelerating circular bullets on the right side.
Joy of Spring: An arc of accelerating circular bullets on the left side.
Spring Shower: A spread of small pellets, slightly focused in front.
Sakura Bloom: Shoots flower petals with a slight homing capability.

Frequently Asked Questions
Q: Help!  The installer won't work/I get some really funky error when I try to launch the game!
A: This is the first XNA game I've released so I'm not quite too keen on what needs to happen in order to actually make an installer that does everything that it needs to.  But try grabbing the latest version of DirectX, installing the .NET framework and the XNA 4.0 Framework Redistributable, and make sure your graphics card is actually supported for XNA 4.0 games.

Q: What about Linux/Mac support?
A: I haven't tried yet and I'm not sure how painful it is to run XNA games on other OSes.  If you can get it working through Wine or something though, that would be great!

Q: Why isn't the AI doing anything?
A: The AI won't select characters by itself--you need to manually select a character for any AI-controlled player as you would if it were a human player.  Also note that the Minimax AI can take over 10 seconds to process a move even at a search depth of 3, so don't be surprised if your AI sits there and does nothing for a long time if you're trying to use that AI type.

Q: Why does the AI suck?
A: Yeah, sorry, it isn't quite -that- smart.  It's really not that bad at dodging though.  I usually just use the default AI settings (DodgeAgent, no heuristics, depth limit of 5) and it's good enough.  It's really bad at knowing how to attack effectively (since it just randomly shoots stuff towards you) and it does bad on small boards since it doesn't take into account future attacks.  It's also somewhat shortsighted in terms of dodging, but it's actually really good at maneuvering through tight spots when there's a way to survive.

Q: What class was this for?
A: CS221: Introduction to Artificial Intelligence at Stanford University.  To be honest, though, it was more an excuse for me to make something, since the actual AI component of the game really isn't quite that complex at all.

Q: Can I see the write-up?
A: Sure, it's right here.

Q: The characters are completely imbalanced! >=(
A: Yeah, they probably are.  I didn't make very much effort at all to balance them against each other and don't really know if I can be bothered to fix balance issues at this point.  I know that Sakuya is pretty strong because of her 4th attack, for example, and Reimu's needles are also pretty good, and I'm pretty sure Cirno is really weak.  Either just deal with it or get familiar with the game and let me know what the stat of things are (keep in mind that things probably need to be corrected on all 4 difficulties!).

Q: Why did you pick -these- characters!?  Why on earth would you leave out XYZ popular Touhou character?
A: Yeah, it was kind of random and on a whim.  Deal with it.  If you really want to know how my thought process went, it was basically like, oh, well you -have- to have Reimu and Marisa, right?  Then Sakuya seemed relatively prominent and she's a playable character in some of the Touhou games and I recognize her and I thought we could do neat things with the wraparound/bouncing kunai, so that happened.  Cirno was basically because we thought it would be really funny to have Icicle Fall in this game.  Then my partner is a really big fan of Flandre and Lily White happens to be my favorite Touhou character, so...yeah.

Q: How did you make PatientBarrage?
A: Short answer: C#.
Long answer: PatientBarrage was coded in C# using XNA Game Studio.  We used Visual Studio 2010 to develop and git for source control.  The artwork was created in GIMP, and the sounds and music were made using FL Studio.

Q: Is the source code available?
A: PatientBarrage is currently closed-source.

Q: Can I redistribute PatientBarrage?
A: Please just link people to this page instead.