• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[API] Scripting Boss fights

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
Hi,

I don't suppose there's an API/library that deals with scripting boss fights?

I'd rather not want to re-invent the wheel if I don't have to.
 
There aren't any that I know of. I think boss fights vary so much that it is a bit limiting to use a particular system for it. Besides, they're fun to code. :D

I would just grab a projectile system, maybe some movement/sliding/knockback system, maybe a threat system (zwieb's is the only one I know of), and I'd code something to queue the orders/ability casts periodically (or randomly). If you need ideas on how to structure the boss fight in general, you might want to look at some sample boss scripts on ownedcore:
https://www.google.com/search?q=WoW...m&rlz=1C1DVCJ_enUS382US388&espv=210&es_sm=122
Those are for WoW (written in Lua), but they are easy to read and might give you some ideas on where to go with your system.
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
I just need a clean interface to code boss fights, rather than individually hard code each one.

Here's some "hypothetical" API:

JASS:
globals
//each represents a different kind of boss fight
//one might be survive the boss's attacks until he's vulnerable
//another might be destroy various objects empowering the boss
constant integer BOSS_TYPE_1 = 0
constant integer BOSS_TYPE_2 = 1
struct BossFight
...

static method create takes integer bossType returns thistype
...
endmethod

//starts the boss fight
method start takes nothing returns nothing
...
endmethod
...

endstruct
...

//constant integers representing different actions a boss does
//e.g. spawn a bunch of minions, use their AOE spell
//retreat underground, 
struct BossAction
...
endstruct

//represents discrete phases where the boss does certain actions
//e.g. the attacking phase, the boss uses many BossAction based on AOE
 
struct BossPhase
endstruct

With an API like this, scripting boss fights becomes a breeze...It's not comprehensive/complete, but I'm just trying to give an idea of what I mean. And it may seem limited, but you can just keep adding possible new types of Bosses, actions, and phases if you need to.
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
Its a good idea but its not easy to find a good balance between an API which is comfortable but not too restrictive.

One thing you could include is some kind of resource management. As bossfights are often reset (e.g. when all players die, or when the boss dies, ...) it is often required to remove objects related to that fight. E.g. units created as summons, buffs, destructables which alter the boss area, etc. Your system could keep track of these things and make sure they are all reset properly, no matter in which phase of the fight the boss is reset.
(The same idea can be applied to things like dungeons)
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
Of course the API is restrictive because you're basically defining what all possible boss fights could be, but I can't imagine boss fights in professional maps or even video games don't have some sort of API, at least if boss fights are a recurring theme in the game. I guess there are just none publicly available.
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
I don't think you will find a boss fight template, which really fits your needs. They are just too map dependent. However I can give you an insight what I once coded for a RPG map.
I diveded all Bosses into 4 classes.

1. SimpleBoss
Those were just better standart mobs. They were triggered with UnitInRangeEvent and the periodic timer stopped once they were dead.
All of them had 3 abilities with the same orderId based on meele or range. --> 1 and 2 meele and 3 range action.
Iirc I passed in the following arguments:
lowrange, highrange, ragetime, scaling(after ragetime), additionalAbility( most times a passive) .
I.e Taurus: targets within low range would be enganged with a strong hit or a knockback, those in highrange got charged. No targets would make him take a walk.

2. Horde (I really loved this one):
It was quite similar to SimpleBoss, but with an additional group behaviour and a group leader.

3. AdvancedBoss: (One scope per unit type.)
I used this one for units with head money, they were spawned based on quests.
It was a module, in contrast to the two above this module didn't perform unit actions, but instead gathered a huge amount of information around the boss: Closest target, injured targets, hp, realtive hp, last charged target, distance, previous distance (to the last target), meele or range, ...
Some of those parameters were evaluated and resulted in a recommended unit state --> attack, run, search, chase, ...
All ended in a static method onExpire which could be configurated individually for each UnitTypeId. Compare it to DDS where you have fields like damage, source, target, tagetId, origional damage ...
The timer was started with thistype.create() and stopped with this.destroy().

4. Individual script for a specified unit.
Final bosses should always have their very own script :).
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
I don't think you will find a boss fight template, which really fits your needs. They are just too map dependent. However I can give you an insight what I once coded for a RPG map.
I diveded all Bosses into 4 classes.

1. SimpleBoss
Those were just better standart mobs. They were triggered with UnitInRangeEvent and the periodic timer stopped once they were dead.
All of them had 3 abilities with the same orderId based on meele or range. --> 1 and 2 meele and 3 range action.
Iirc I passed in the following arguments:
lowrange, highrange, ragetime, scaling(after ragetime), additionalAbility( most times a passive) .
I.e Taurus: targets within low range would be enganged with a strong hit or a knockback, those in highrange got charged. No targets would make him take a walk.

2. Horde (I really loved this one):
It was quite similar to SimpleBoss, but with an additional group behaviour and a group leader.

3. AdvancedBoss: (One scope per unit type.)
I used this one for units with head money, they were spawned based on quests.
It was a module, in contrast to the two above this module didn't perform unit actions, but instead gathered a huge amount of information around the boss: Closest target, injured targets, hp, realtive hp, last charged target, distance, previous distance (to the last target), meele or range, ...
Some of those parameters were evaluated and resulted in a recommended unit state --> attack, run, search, chase, ...
All ended in a static method onExpire which could be configurated individually for each UnitTypeId. Compare it to DDS where you have fields like damage, source, target, tagetId, origional damage ...
The timer was started with thistype.create() and stopped with this.destroy().

4. Individual script for a specified unit.
Final bosses should always have their very own script :).

This is just what I was looking for. Glad to know it's been done before.

Just curious, did you design your boss fights so the player would only get defeated if they tried to lose on purpose or just plain dumb?

I know some games are like that, e.g. Metroid Prime, Pikmin (except the last boss), where the boss fights really seem to serve a purpose like "hey look at this awesome thing," rather than challenge what the player has learned in a serious way.

I am getting off topic I guess, but what are boss fights these days? Ways to showcase art and cool systems, or test the player to make sure they are ready to progress?
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
The map itself has never been released. It's a curse when you are author, coder, designer and the map size is epic ...
Just curious, did you design your boss fights so the player would only get defeated if they tried to lose on purpose or just plain dumb?
Rather the second one. The game devided into game difficulties, which were set by the host after map initialization. Based on that hp, attack and spell strength was adjusted.
Basically the bosses were always difficult to beat, but with lowered hp and attack power no match even for unexperienced players.

I haven't been playing any games lately, so I can't tell you how really good boss fights look nowadays.
 
Status
Not open for further replies.
Top