Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm currently creating a top-down shooter like Touhou. The most important factor of the game is that there are many diverse patterns and ways at which bullets are generated and shot at the player, see this video: http://www.youtube.com/watch?v=4Nb5Ohbt1Sg#start=0:60;end=9:53;

At the moment, I'm using a class "Pattern" which has a series of steps on moving and shooting. However, I feel this method is quite laborous as I have to create a new Pattern for each attack and perhaps new Bullet classes that will implement a certain behavior.

This question received a comment suggesting I should look into BulletML for easy creation and storage of bullets with a specific pattern. It looks decent, but it led me to wonder, what other solutions do you have that I should take into consideration?


My current design is as follows:

An example of an implemented pattern:

My GigasPattern first executes a teleport which moves Alice to a certain point (X, Y) on the screen. After this is completed, the pattern starts using the Mover to move the sprite around (whereas teleporting has separate effects and animation). These are of no concern, really, as they are quite simple.

The Shooter also creates various Attacks, which are classes again that the Shooter can use to create various patterns of bullets, much like the one in the question I posted. Once the Mover has reached it's destination, both it and the shooter stop and return to an inactive state. The pattern completes, is removed by the AI and a new one gets chosen.

share|improve this question

3 Answers 3

It is going to be laborious no matter what, creating such a level seems like an easy task, and it may not all that difficult, but it will always take a lot of time. (A very rough estimate: 1000 times the playtime for something as cool as that video.)

If you use a scripting language you still have to write exactly the same code, just in a different language, the advantage is that you can make scripted levels without messing with the compiled code. If you work in a big team you'd definitely want that, but as a sole developer it usually doesn't make a big difference.

BulletML is not an answer in itself, you need a working implementation in your language, which must interface with the rest of your game. And still there is a huge job of writing all those XML files.

I'm inclined to say that you should stick to programming the desired patterns in classes as you do, but perhaps you could reveal some samples of your current structure, there might be improvements to make.

There may be one realization which could simplify things a bit, and give you a slightly better toolbox. You could describe an AI as being a pattern, ideally there should be just one type of entity, but any such entity may choose to invoke another entity of the same type to do the job. This will rid you of any limits to how deep you can nest responsibility propagation and give you one less type of class to think about.

At least that is what I gather from the diagram. While you rightly should limit the amount of code you include in a question, there is never a complete substitute for seeing some actual code.

share|improve this answer
Sure, thanks for the help. I've included a simplified UML diagram of my current design as well as an example application of the design in action. I hope it helps! –  IAE Nov 14 '11 at 16:58
+1 for "must interface with the rest of your game". –  Nick Wiggill Nov 14 '11 at 17:48

Maybe you could implement an own, small script language for your game. Then you would be able to script bullet behaviours by just add new scripts. The advantage of an own script language is that you could use that at other parts of you game. Or you could try to use Lua (I don't know what language/framework you are using). But in my opinion Lua would be an overkill if you just want to have movin patterns.

Between: I did this already for a space shooter, but for the enemy behaviour. It worked well, so you really could just try that.

share|improve this answer
I'm using AS and it doesn't lend itself too well to using any local resources, however using a scripting language or XML might be of value to me, so thanks for the suggestion. –  IAE Nov 14 '11 at 16:59

I was in the exact same situation a while ago and started implementing my own architecture for bullet patterns. I gave up, though, because I came across an implementation of BulletML for C#/XNA: BulletML C#

I had to make a few changes, but now creating patterns that look spectacular are really really easy. There is a great demo here that shows you how, a few lines of XML, can create awesome patterns.

If you are working on C#, I highly recommend avoiding re-inventing the wheel. Especially if you want to have very complex patterns. It may take some time to wrap your head around BulletML, but, in my opinion, it is well worth your time.

However, if you decide not to use BulletML, then, at the very least, have a look at the C# code and get an idea of its architecture. It might give you some ideas.

share|improve this answer
Thanks! I just started moving away from ActionScript for this project and am now writing it in C# / XNA. I'll definitely have a look at the code, thanks. –  IAE Dec 1 '11 at 8:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.