Understanding Ketsui Bullet Pattern

A place for people with an interest in developing new shmups.
Post Reply
psoslayer

Understanding Ketsui Bullet Pattern

Post by psoslayer »

Alright, as we all know Ketsui and partially some other CAVE games had these organic moving bullet patterns. But does anybody knows how they really work? Are they "connected" to the player ship movement? What's the algorythm behind them?
User avatar
ciox
Posts: 1008
Joined: Sun Feb 12, 2012 5:29 pm
Location: Romania

Re: Understanding Ketsui Bullet Pattern

Post by ciox »

The motions are complex enough that either each bullet has its own script, or there's a 'controller' for each set of bullets that forms a pattern, either of these will start a frame counter.

The vast majority of "pretty" Ketsui patterns work in two phases
a) spread out the bullets, radially or in an arc or spiral or some other pattern, trigonometry functions will give you these and let you aim them at the player as well, if needed
b) make the bullets start moving towards the player

So the script just checks the current frame and decides what phase it's in, spreading or going for the player.

There's plenty of exceptions though, the 4th boss has a pattern made out of two walls that simultaneously both tracks the player AND follows its own sequence to move left or right every once in a while, meaning you can partially control it but if you aren't careful it will crush you.
Overall the player's position is used in a lot of patterns, but usually it's pretty transparent that it's only in a "second phase".
psoslayer

Re: Understanding Ketsui Bullet Pattern

Post by psoslayer »

^Great post, thank you, helps me a lot. :) I wonder though why not more gams have these patterns.
User avatar
n0rtygames
Posts: 1001
Joined: Thu Mar 15, 2012 11:46 pm
Contact:

Re: Understanding Ketsui Bullet Pattern

Post by n0rtygames »

psoslayer wrote:^Great post, thank you, helps me a lot. :) I wonder though why not more gams have these patterns.
I think a lot of it has to do with the fact there's a tendency for shmups to try and improve on each other by increasing the quantity of bullets over other titles on the platform. When you're dealing with a relatively low budget (a console with a low end graphics card, low memory -- all compared to a PC) then there's a lot of work involved to get your game looking nice while rendering large quantities of objects on to the screen.

When you throw in to that the 'cost' of doing things like making each bullet face the player, you end up with a fair amount going on. In the case of a bullet that just gets told its direction once and once only - it's not so bad, but if you're aiming for homing missiles etc, you end up with the following going on:

* Bullet has to acquire the players position (cheap)
* Bullet has to get a direction to the player (PlayerPos - BulletPos)
* Bullet has to normalise the vector it just received (expensive)
* Bullet has to also update its sprite rotation and turn a vector in to a float via Atan2 -- again, not cheap

For the most part, bullet quantity can be attained relatively easily using a decent hierarchical collision system to cut down on the number of intersection checks you're doing in a given frame (i.e only testing bullets that are near the player, for player vs bullet collisions) -- however when you start to approach several hundred bullets on screen all trying to home in on the player, things begin to get a little bit strenuous.

Of course it's possible, we've seen Ketsui do it -- but I believe Ketsui had an upper limit of 200 or so projectiles on screen didn't it? This is obviously a fantastic argument in favour of "less is more" -- as some of those Ketsui patterns are known for being batshit insane. So a developer doesn't necessarily need to worry about touching upon thousands of bullets.

Each style presents its own challenges when you're working on limited hardware and can be very fun to get stuck in to.

TL;DR
If you're going to take anything from this post, it should be "Keep it as simple as possible". You don't want your bullets to start 'thinking' too much. It may not be a problem on your machine if you're running an intel i7 920+ with two nvidia cards and extreme cooling in place... but try to be efficient! :)
facebook: Facebook
psoslayer

Re: Understanding Ketsui Bullet Pattern

Post by psoslayer »

Thinking bullets, tehee. :D

With current technology it was no problem to pull of thousands of particle based bullets or even 3D bullet patterns, but it will be hard to archive to make them all dodge-able and fun.
User avatar
nasty_wolverine
Posts: 1371
Joined: Sun Oct 09, 2011 11:44 pm

Re: Understanding Ketsui Bullet Pattern

Post by nasty_wolverine »

most ketsui patterns are bullets spawning bullets...
not really hard to do programming wise, but pretty insane just to come up with them over a cup of coffee... or LSD...

types of pattern
1) fixed - this means, it is fixed independent of where you are. few ketsui patterns seem to follows this. one exception maybe stage 3 boss final pattern, from what i think its really independent of your position. trig functions can be used.
2) aimed - all small and some medium enemies in ketsui and even some bosses fire aimed shots. that means fixed patterns that are fired in your direction. some may have embedded trig functions in them that make them curve. but most are aimed straight shots or shots off an angle.
3) accel shots - shots that accelerate. stage 3 suicidal planes which leave blue arrow bullets which are accelerating, but from what i have seen, they look like they have a capping on maximum speed.

now combine the above patterns in any manner and you can get any bullet pattern in ketsui.

for example, doom's final pattern. its a fixed four(a pair at 180 degrees) rotating pattern of bullets, which further spawn bullets which have a slight trig curve on the perpendicular to the original bullets with accel properties.

think about it. elementary properties generating complex emergent behaviour.
Elysian Door - Naraka (my WIP PC STG) in development hell for the moment
User avatar
BPzeBanshee
Posts: 4859
Joined: Sun Feb 08, 2009 3:59 am

Re: Understanding Ketsui Bullet Pattern

Post by BPzeBanshee »

nasty_wolverine's pretty much hit the jackpot: that's exactly how S20-TBL replicated Evacanneer Doom's patterns in earlier builds of GMOSSE. The scripts and special bullet type (which has a set of different case statements to cover different Cave bullet types) are still in new builds but the Doom-like ones aren't used at the moment.
Post Reply