Boss logic coding best practices/feedback

A place for people with an interest in developing new shmups.
Post Reply
User avatar
wondersonic
Posts: 253
Joined: Wed May 12, 2010 3:55 pm

Boss logic coding best practices/feedback

Post by wondersonic »

Hello all,
I really would appreciate best practices/feedback about the way you code Boss fight logic.

Do you use finite state machine, other stuffs? And how do you implement them?

For the first boss I'm coding, I've started with 3 entities talking to each others. I've started finite state machine coding using switch statements. Is it the right way to go :?:

Anyway, feedback welcomed!

Cheers
WS
User avatar
wondersonic
Posts: 253
Joined: Wed May 12, 2010 3:55 pm

Re: Boss logic coding best practices/feedback

Post by wondersonic »

One good thing, denote boss life points using colors (red = almost finished).
User avatar
Rozyrg
Posts: 918
Joined: Wed Feb 11, 2009 12:03 am
Location: Southeast USA

Re: Boss logic coding best practices/feedback

Post by Rozyrg »

Hmmm...I'm not that familiar with AI terminology; but I *think* I know what you're talking about. What would be the alternative to the finite state method?

The bosses I've done up to this point are limited to, say, changing behavior (movement) and firing patterns based on their damage condition and the condition of any their subordinate parts/segments. The point being to keep the fight challenging and fun no matter what gets blown off. :D For instance, if you had a huge battleship with a bunch of turrets, you couldn't just shoot them all off and have it sitting there completely defenseless. It might make sense that way, sure; but it's not necessarily fun. It has to maintain that same threat level regardless... maybe even amplify it.

I'm still learning all this stuff, of course though... so what I've made thus far is pretty rudimentary. The last one I worked on was something like:

Section A (head):
- if either subpart is undamaged, use weak pattern
- if both subparts are damaged, use medium pattern
-regardless of the condition of other parts, use strong pattern if damaged (near death)

Section B (sub 1) and Section C (sub 2):
- if other subpart is undamaged, use weak pattern
- if other subpart is damaged, use strong pattern

Very basic stuff, I know; but figuring all this out can definitely be a slow process. :)
User avatar
wondersonic
Posts: 253
Joined: Wed May 12, 2010 3:55 pm

Re: Boss logic coding best practices/feedback

Post by wondersonic »

I think the important part of your post is "keep it fun and challenging"; thanks!

Although I just released my first boss, I hope I suceed in both :roll:

2 weeks of development but I know some points can be enhanced.

And I'm not familiar with AI too :| However managing numerous state variables, I've mixed:
- knowledge about player weapons to increase boss parts life points
- 3 kinds of ennemies
- 1 to 3 patterns for the ennemies
- "communication" between ennemies

Also, I'll add challenge in future boss by implementing boss patterns for fighting (ala zelda: each boss has to be killed one different way).

For this first boss, I've put a guardian that fire constantly to protect pods-weak points.
User avatar
Dave_K.
Posts: 4570
Joined: Wed Jan 26, 2005 5:43 am
Location: SF Bay Area
Contact:

Re: Boss logic coding best practices/feedback

Post by Dave_K. »

wondersonic wrote:- knowledge about player weapons to increase boss parts life points
I'm curious of your reasoning for doing this, is it a kind of crude rank? Is this supposed to motivate the player to avoid powerups making the level harder and reward the player with an easier boss?
User avatar
Rozyrg
Posts: 918
Joined: Wed Feb 11, 2009 12:03 am
Location: Southeast USA

Re: Boss logic coding best practices/feedback

Post by Rozyrg »

I could be wrong; but my thought was he meant automatically compensating for differences in each weapon's damage, so that one does not have a particular advantage over another and the pace of the battle remains the same.

I know that 's probably an odd way to do it; but that's what I tried on my first attempt. Basically, whenever you collected a different weapon or powered up your current one, all larger enemies on the screen would adjust their health to match any increase in damage. It worked ok for the time; but it was pretty messy.
User avatar
wondersonic
Posts: 253
Joined: Wed May 12, 2010 3:55 pm

Re: Boss logic coding best practices/feedback

Post by wondersonic »

That's like Rozyrg said.

I see this point more like (very limited) AI. The boss had time to see you coming all along the level so he knows about how powerful you are and instead of taking his usually leather suit, he takes his full plate armor because you are looking furiously dangerous ;)

The point however is that in game where you loose fire power when you die the boss life points have already been setted... and now the game become harder. Three ways are possible:
- adjust again boss life point
- don't make weapon loose power when dying
- don't set ennemy life point according to player fire power

I'll see in future how this will evolve...
User avatar
Dave_K.
Posts: 4570
Joined: Wed Jan 26, 2005 5:43 am
Location: SF Bay Area
Contact:

Re: Boss logic coding best practices/feedback

Post by Dave_K. »

Apologize for my novice thinking here, but I'm still not following. Why have powerups in your game when all the enemy instantly increase their HP to accommodate for the extra damage? Shouldn't the motivation for the player to collect powerups be to not get raped by the boss? The boss should be programmed to fight a fully powered up player regardless. If the player doesn't sufficiently power up during the level, then he will be gently reminded as his ass is handed back to him to try better next time.

About the only thing that kind of makes sense is automatically compensating for when a player looses his life/powerups, to give him a better chance of surviving, and this can be done in several additional ways then just lowering enemy HP. Again, sorry if I'm being too naive here.
User avatar
Rozyrg
Posts: 918
Joined: Wed Feb 11, 2009 12:03 am
Location: Southeast USA

Re: Boss logic coding best practices/feedback

Post by Rozyrg »

Ideally, yes; but as for this kind of under-the-hood stuff, it really depends on the course you've taken. You still aim for the ideal (ie. everything perfectly balance), you just run with whatever makes sense at the time...lol.
User avatar
wondersonic
Posts: 253
Joined: Wed May 12, 2010 3:55 pm

Re: Boss logic coding best practices/feedback

Post by wondersonic »

I don't think this should apply to *all* ennemies ;) Just the most importants.

Giving bonus to the player for a whole level doesn't necessarily imply the boss as well.

As an example, when given the Sever laser, damages increased by 6 but I don't want the boss
to be theoretically destroyed x6 times faster. Only x3 is enough so life points adjustment is
one possibility to balance the boss; and a fast one because adding new bullet patterns or boss
parts takes more time (but results in better experience IMHO).

Yes balancing is hard; and game success is linked to it (and I know what I'm talking about :( ).
Montoli
Posts: 7
Joined: Thu Sep 16, 2010 2:01 am

Re: Boss logic coding best practices/feedback

Post by Montoli »

Interestingly, recent Touhou games have done pretty much the opposite: Instead of having bosses adjust their hp to match your power level, instead the power ups don't do as much as they look like they do. for example, you might think that having 4 options firing lasers (in Touhou 12) meant that you were doing x4 as much damage. You would be wrong though! You are doing like 30% more damage. You just look much cooler while doing it, and cover a wider area of the screen with your shots when unfocused.

This is because the bullet damage changes per power level.

At first I thought this was silly, but there is a flipside - it DOES mean that the slope isn't quite as slippery when you die. Since you lose powerups when you die, it means that you do not get totally oblitterated if the boss tags you once or twice.
MSW
Posts: 9
Joined: Mon Aug 15, 2005 10:19 pm

Re: Boss logic coding best practices/feedback

Post by MSW »

wondersonic wrote:I don't think this should apply to *all* ennemies ;) Just the most importants.

Giving bonus to the player for a whole level doesn't necessarily imply the boss as well.

As an example, when given the Sever laser, damages increased by 6 but I don't want the boss
to be theoretically destroyed x6 times faster. Only x3 is enough so life points adjustment is
one possibility to balance the boss; and a fast one because adding new bullet patterns or boss
parts takes more time (but results in better experience IMHO).

Yes balancing is hard; and game success is linked to it (and I know what I'm talking about :( ).
There are far simpler and more effective ways to balance your game than messing around with boss hitpoints...

Starts with balanceing your players weapons...

If the player's basic pea shooter does 1 point of damage...and on full auto rapid fire only shoots 30 times a second. The weapon deals 30 points of damage per second.

If the sever laser does 6 (6X) damage, but fires 10 times a second. The weapon deals 60 points of damage per second. Even though this laser does six times the damage per hit, but at best it is only TWICE as effective overall against the same boss.



This isn't to say that the rate-of-fire is the most interesting method to balanceing player weapons. But it is effective and dead simple to code
User avatar
Rozyrg
Posts: 918
Joined: Wed Feb 11, 2009 12:03 am
Location: Southeast USA

Re: Boss logic coding best practices/feedback

Post by Rozyrg »

Montoli wrote: instead the power ups don't do as much as they look like they do. for example, you might think that having 4 options firing lasers (in Touhou 12) meant that you were doing x4 as much damage. You would be wrong though! You are doing like 30% more damage. You just look much cooler while doing it, and cover a wider area of the screen with your shots when unfocused.

This is because the bullet damage changes per power level.
Exactly what I do. The power increase per bullet might only be fractional, or the overall damage (perhaps increased slightly) might just be more spread out between them.

I think being 'powered up' has as much to do with the feeling of being powerful (ie. from the game giving you visual feedback) as it does with dealing out lots of damage. If stuff dies too fast, you hardly have the time to relish it. :D
Post Reply