Hard Light Productions Forums

FreeSpace Releases => Scripting Releases => Topic started by: X3N0-Life-Form on June 09, 2016, 09:49:20 am

Title: [Alpha Release] Ability Management Framework
Post by: X3N0-Life-Form on June 09, 2016, 09:49:20 am
Ability Management Framework

Version 1.0 "Alpha" (https://github.com/X3N0-Life-Form/AbilityManagerDemo/releases/tag/v1.0)

Download link (https://github.com/X3N0-Life-Form/AbilityManagerDemo/releases/tag/v1.0).

Modpack includes :
- All the framework scripts
- Sample config files
- A user manual
- A sample mission that uses a number of abilities, including player-triggered ones
- A bunch of mostly irrelevant stuff due to me ripping this modpack out of another and not bothering to clean up too much


I've written a user manual that details a bit how things work, but here is the abridged version of it :

Required files
- data/scripts
   * parse.lua
   * abilityManager.lua
   * abilityLibrary.lua (--> new ability templates go there)
   * shipVariant.lua
   * shipVariantMissionWide.lua
- data/tables
- data/config
   * abilities.tbl
   * ship_variants.tbl (--> not actually related to abilities (for now))
   * ship_variants_mission_wide.tbl (aka SVMW.tbl)

SEXP calls
- Set abilities for everybody = setShipVariant('some category name from SVMW.tbl')
- Set ability for someone = ability_attachAbility(className, shipName, isManuallyFired)
- Manual trigger = ability_trigger(' AWAXEM::DISCO FURY') (-->ship name::ability name)


The full version of the user manual is located in the doc folder of the modpack.

Outside the user manual itself, each script has its own documentation, with further explainations & specs.

Keep in mind that I am classifying the as an "Alpha" version, meaning that there's still a lot of room for improvement and it hasn't been thoroughly tested yet.
I'm still honing my lua skills, and some areas are likely to get refactored down the line.


Still, I'm kind of proud of what I've done so far, and I hope I'll get more time to work on it next year.

Please feel comment, criticise, report bugs, offer suggestions, cookies, or post whatever crazy ability you come with :)



============ Original post ============
Quote
Hello folks,

For a little while now, I've been toying with the idea of making some sort of generic ability manager framework.

Basically, have something that loads up all sorts of data regarding special abilities (name, cooldown, valid target types, etc.), that would allow a modder to specify either through a script-eval or a custom table that a specific ship has an ability and determine when that ship is allowed to cast that ability.

A modder would then only have to plug in his/her own script that fires up that ability.

I'm still thinking up about use cases, but here is the table spec I have so far, along with a couple of note :

Code: [Select]
$Name: string
$Target Type:   list of string (self, fighter, corvette, tagged, buff:buffType)
$Target Team: list of string (hostile, friendly, neutral, relative to the caster)
$Range: integer (optional)
  +Min: integer (minimum range) (optional)
$Target change condition: string (destroyed, every shot, target no longer valid)
$Cost: integer/list of integer (tied to diffculty level) (optional)
  +Cost type: string (weapon energy reserve, "ammo" specific to that ability, "mana" reserve shared by all abilities) (optional)
$Buff: list of string (optional)

Title: Re: [CONCEPTION] Ability Management Framework
Post by: mjn.mixael on June 09, 2016, 11:01:46 am
This will be inserted into JAD in 3...2...1...
Title: Re: [CONCEPTION] Ability Management Framework
Post by: General Battuta on June 09, 2016, 11:42:32 am
Axem's madness runs far deeper
Title: Discussing scripting vs sexps in missions
Post by: Axem on June 09, 2016, 12:14:03 pm
Heh, I've actually made my own already, but it's heavily intwined with my powerup system right now (so it can do stuff like regenerating health or unlimited weapon energy over a period of time). A perfectly generic system was on my to-do list but I can see it's already being handled nicely. ;) (You can check it out in the JAD2.22 demo release, itemdrop2-sct.tbm or something.)

My suggestion would be instead of Buff, call it Action so you can have abilities like calling in newly spawned fighters or instant teleport or anything else.

And what is $Target change condition: supposed to do? Destroyed/Target no longer valid are basically identical conditions.
Title: Re: [CONCEPTION] Ability Management Framework
Post by: X3N0-Life-Form on June 10, 2016, 12:58:14 am
Heh, I've actually made my own already, but it's heavily intwined with my powerup system right now (so it can do stuff like regenerating health or unlimited weapon energy over a period of time). A perfectly generic system was on my to-do list but I can see it's already being handled nicely. ;) (You can check it out in the JAD2.22 demo release, itemdrop2-sct.tbm or something.)
I figured you must have had to build something in that spirit for JAD. I'll be sure to check that out.

Quote
My suggestion would be instead of Buff, call it Action so you can have abilities like calling in newly spawned fighters or instant teleport or anything else.
I'm still not too clear on what I want buffs to do or be handled, I vaguely envisioned them as some sort of status effect or TAG-like thing that could then be used to trigger other abilities. Kinda like the stuff you'd do in say, Warcraft 3 when building new spells : have a spell apply a buff that does nothing on its target, then have a trigger handle the actual effect.

Quote
And what is $Target change condition: supposed to do? Destroyed/Target no longer valid are basically identical conditions.
That one's related to target management, which I'm still not clear on how to handle, so there's bound to be some redundancy related to that while in the design phase :). The idea was to provide more targetting conditions unrelated to target type, but without a clear use case in mind, it's probably better to shelve it.


Speaking of use cases, since I'm still in the design phase, I'm in dire need of those. For the moment, I've got 1 specific ability in mind, automated SSM strikes, with possibly a couple of others in the fog (short jumps, cloaking), but since I want the thing to be as generic as possible, I need clear boundaries for it.
Title: Re: [CONCEPTION] Ability Management Framework
Post by: X3N0-Life-Form on June 29, 2016, 02:59:38 pm
Alright, I've had some more time to think about all this and started implementing the basics (emphasis on started).

I'm still not sure how to handle always on or global abilities and a few other details, but I've got a clearer idea of what I want to do.

On the technical side, I seem to have gotten over my multi-dimensional array madness and started using proper data structures, so that's a plus (although it does make me want to go back to my parsing script and fix the giant table blob -_-).

It's going slowly, but I'm hoping to have some sort of basic working prototype by the end of July.


Anyway, here is the table prototype:
Code: [Select]
#Abilities

; $Name: string
; $Target Type:   list of string (self, fighter, corvette, tagged, buff:buffType)
; $Target Team: list of string (hostile, friendly, neutral, relative to the caster)
; $Range: integer (optional)
;   +Min: integer (minimum range) (optional)
; $Cost: integer/list of integer (tied to diffculty level) (optional)
;   +Cost type: string (weapon energy reserve, "ammo" specific to that ability, "mana" reserve shared by all abilities) (optional)
; $Buff: list of string (optional)
; $Duration: list of int (optional)
; $Ability Data: metadata used by whatever script actually uses the ability

$Name:          SSM-moloch
$Target Type:   big ship
$Target Team:   Hostile
$Cost:          1
  +Cost Type:   global-ammo:SSM-moloch-ammo/ammo
;; how about having multiple cost types ?
$Ability Data:
  +Strike Type: Shivan SSM Strike

$Name:          Shivan Command aura ;; TODO: ai buff ?
$Target Type:   fighter, bomber
$Target Team:   Friendly
$Range:         4000
$Buff:          command aura
$Ability Data:
  +Max AI:      Colonel

$Name:          Energy Dampening Field ;; TODO : energy drain thingy
$Target Type:   fighter, bomber
$Target Team:   Hostile
$Range:         1500
$Cost:          70
  +Cost Type:   energy:weapon
$Cooldown:      90
$Duration:      15


#End

The script itself so far:
Code: [Select]

------------------------
--- Global Variables ---
------------------------

ability_classes = {}
ability_instances = {}


-- set to true to enable prints
ability_enableDebugPrints = true

----------------------
--- ??? Functions ---
----------------------


function ability_fireAllPossible()
-- TODO : cycle through ability instances & fire them
end

-------------------------
--- Utility Functions ---
-------------------------

function dPrint_ability(message)
if (ability_enableDebugPrints) then
ba.print("[abilityManager.lua] "..message)
end
end

--[[
Return the specified class as a string.

@param className : name of the class
]]
function ability_getClassAsString(className)
--TODO
end

----------------------
--- Core Functions ---
----------------------


function ability_createClass(name, attributes)
-- Initialize the class
ability_classes[name] = {
  Name = name,
  TargetType = attributes['Target Type']['value'],
  TargetTeam = attributes['Target Team']['value'],
  Cooldown = nil,
  Duration = nil,
  Range = -1,
  Cost = 0,
  CostType = nil
}

if not (attributes['Cooldown'] == nil) then
ability_classes[name].Cooldown = attributes['Cooldown']['value']
end

if not (attributes['Range'] == nil) then
ability_classes[name].Range = attributes['Range']['value']
end

if not (attributes['Cost'] == nil) then
ability_classes[name].Cost = attributes['Cost']['value']
if not (attributes['Cost']['sub'] == nil) then --TODO : utility function to grab a sub attributes' value ???
if not (attributes['Cost']['sub']['Cost Type'] == nil) then
ability_classes[name].CostType = attributes['Cost']['sub']['Cost Type']
end
end
end

if not (attributes['Duration'] == nil) then
ability_classes[name].Duration = attributes['Duration']['value']
end

-- Print class
dPrint_ability(ability_getClassAsString(name))
end

--[[
Reset the instance array. Should be called $On Gameplay Start.
]]
function ability_resetInstances()
ability_instances = {}
end


--[[
Create an instance of the specified ability and tie it to the specified shipName.

@param instanceId : unique identifier for this instance
@param className : name of the ability
@param shipName : ship to tie the ability to. Can be nil.
]]
function ability_createInstance(instanceId, className, shipName)
ability_instances[instanceId] = {
Class = className,
Ship = shipName,
LastFired = 0,
Active = true,
Manual = false, --if that instance must be fire manually
Ammo = -1 --needs to be set after creation if necessarys
}
end

--[[
Verify that this ability instance can be fired

@param instanceId : id of the ability instance to test
@return true if it can
]]
function ability_canBeFired(instanceId)
-- Check that this is a valid idea
if (ability_instances[instanceId] == nil) then
ba.warning("[abilityManager.lua] Unknown instance id : "..instanceId)
return false
end

local instance = ability_instances[instanceId]
local class = ability_classes[instance.Class]
-- Verify that this instance is active
if (instance.Active) then
-- Verify cooldown
local missionTime = mn.getMissionTime()
local cooldown = class.Cooldown
if (instance.LastFired + cooldown >= missionTime) then
--TODO : Verify cost
return true
end
end

-- Default
return false
end

------------
--- main ---
------------

abilityTable = parseTableFile("data/config/", "abilities.tbl")

ba.print(getTableObjectAsString(abilityTable))


for name, attributes in pairs(abilityTable['Abilities']) do
ability_createClass(name, attributes)
end
Title: Re: [CONCEPTION] Ability Management Framework
Post by: Axem on June 29, 2016, 08:26:59 pm
The only thing that leaps out at me right now is...

abilityTable = parseTableFile("data/config/", "abilities.tbl")

Beware, while it may work for you in testing, FreeSpace will not look for a tbl file in /config/ in a VP file. FS will only look at cfg files in config, and tbl/tbm in tables. (Atleast if I'm correct in guessing that first argument is what directory to look in?)
Title: Re: [CONCEPTION] Ability Management Framework
Post by: AdmiralRalwood on June 29, 2016, 09:50:45 pm
Code: [Select]
$Name:          Energy Dampening Field ;; TODO : energy drain thingy
$Target Type:   fighter, bomber
$Target Team:   Hostile
$Range:         1500
$Cost:          70
  +Cost Type:   energy:weapon
$Cooldown:      90
$Duration:      15
Wouldn't the cost be paid by the caster, not the targets? It would be rather odd if an energy dampening field drained its bearer's weapon energy for every hostile strikecraft in range...
Title: Re: [CONCEPTION] Ability Management Framework
Post by: X3N0-Life-Form on June 30, 2016, 12:44:54 am
Well obviously firing the thing is supposed to have a cost. I'm still far away from having the abilities actually do anything, so I haven't put anything related to the "Energy Dampening Field"'s actual effects.

Basically, the script is meant to determine when an ability can be fired, then call the actual function meant to apply the effects, and finally do a bit of book keeping like draining the caster's energy reserve/ammo/whatever.

EDIT - Stuff related to ability's effects would go under $Ability Data:

The only thing that leaps out at me right now is...

abilityTable = parseTableFile("data/config/", "abilities.tbl")

Beware, while it may work for you in testing, FreeSpace will not look for a tbl file in /config/ in a VP file. FS will only look at cfg files in config, and tbl/tbm in tables. (Atleast if I'm correct in guessing that first argument is what directory to look in?)

Huh, I wasn't aware of that. Well I guess that it's something else I need to put on my TODO list ...
Title: Re: [CONCEPTION] Ability Management Framework
Post by: X3N0-Life-Form on July 14, 2016, 12:18:36 pm
Hello folks, it's time to post a small update.

The thing's really starting to take shape :
- The core data structures are close to final, along with all sorts of utility functions to help debug things as I go along.
- This also allowed me to stress test my old parsing script a bit and fix a couple of bugs, the most notable one being sub-attributes not being parsed. I've also added a couple of utility functions + improved the debugging messages in there as well. (Which means that it might be a good idea to post a new release of the parsing script as soon as things stabilize a bit.)
- Data parsing is basically done (see updated table below).
- Ability instanciation is working
- Preliminary tests indicate that the canBeFired function seems to be working


So, the next big steps are:
- Target handling
- Write a basic fire function
- Write a function that loops through all active instances and fires the abilities that can be fired
- Complete cost type handling
- Store ability data properly
- Write a basic ability function to test all of the above


The next big milestone's gonna be target handling, the rest should be fairly trivial in comparison.


Updated table:
Code: [Select]
#Abilities

; $Name: string
; $Target Type:   list of string (self, fighter, corvette, tagged, buff:buffType)
; $Target Team: list of string (hostile, friendly, neutral, relative to the caster)
; $Range: integer (optional)
;   +Min: integer (minimum range) (optional)
; $Cost: integer/list of integer (tied to diffculty level) (optional)
;   +Cost type: string (weapon energy reserve, what ammo consumption system is to be used) (optional)
; $Buff: list of string (optional)
; $Cooldown:      90
; $Duration: list of int (optional)
; $Ability Data: metadata used by whatever script actually uses the ability

$Name: SSM-moloch-std
$Target Type:   big ship
$Target Team:   Hostile
$Cooldown: 24, 20, 17, 15, 13
$Ability Data:
  +Strike Type: Shivan SSM Strike

$Name:          SSM-moloch-std-global ;; concept : global ammo
$Target Type:   big ship
$Target Team:   Hostile
$Cost:          1
  +Cost Type:   global:SSM-moloch-ammo
  +Starting Reserve: 15;;TODO : handle + add to the spec above
$Cooldown: 24, 20, 17, 15, 13
$Ability Data:
  +Strike Type: Shivan SSM Strike

$Name:          Shivan Command aura ;; concept : passive ability
$Target Type:   fighter, bomber
$Target Team:   Friendly
$Range:         4000
$Buff:          command aura
$Ability Data:
  +Max AI:      Colonel

$Name:          Energy Dampening Field ;; concept : energy cost type
$Target Type:   fighter, bomber
$Target Team:   Hostile
$Range:         1500
$Cost:          70
  +Cost Type:   energy:weapon
$Cooldown:      90
$Duration:      15


#End

Latest version of the script is here (https://github.com/X3N0-Life-Form/AVPoV/blob/master/data/scripts/abilityManager.lua).
Title: Re: [CONCEPTION] Ability Management Framework
Post by: Admiral MS on July 14, 2016, 02:50:48 pm
So I'm not 100% sure what exactly this script can do and what not (I didn't look at the script itself). It seems to track a bunch of conditions and checks wether an ability could be used.
What I don't see is how the player gets to know that he can fire something and what triggers any skill activation, either for the player or an ai controlled ship. The exception are automatic activation abilities like the passive ability in your list.

Why I'm asking: The RTS script contains something similar but not as modular and tied to the interface. So there are ability - interface element (like a button or menu element) combinations and any ship fulfilling the conditions for an ability, like microjumps, will have the activation interface element usable/displayed when selected. I was thinking about replacing some parts of it with your scirpt so it is easier to add new ship abilities and stuff that is not player controlled or needs no interface element.
Title: Re: [CONCEPTION] Ability Management Framework
Post by: X3N0-Life-Form on July 15, 2016, 05:13:46 am
Quote
It seems to track a bunch of conditions and checks wether an ability could be used.
This in a nushell covers my initial needs for this script : provide a basic set of functions that I could rely on when designing special abilities elsewhere.

To try to sum up my use case : "Hey can this ship fire this ability ?" --> "Sure" --> "Can he fire it at that target ?" --> "Sure" --> "OK, let's fire it then" --> "OK, I'll pass your demand to ability_fire(), if it knows what your ability is, it'll call the right guy"

Quote
What I don't see is how the player gets to know that he can fire something and what triggers any skill activation, either for the player or an ai controlled ship. The exception are automatic activation abilities like the passive ability in your list.
With this script alone ? The player doesn't, although whipping up a custom HUD gauge or lua display giving the status of the ability would probably not be too difficult. My initial need was for automated SSM calls while certain ships are present (now that I think about it, I'm pretty sure I forgot the "is that ship in mission" condition in the canBeFired function  :banghead:), so I didn't have any kind of player interaction in mind.

How is an ability triggered ? I'm gonna have a fireIfPossible() function to wrap the use case detailed above. Skill activation is probably gonna be done through SEXPs at first, but I'd like to be able to automate target selection + firing for AI ships.
Title: Re: [CONCEPTION] Ability Management Framework
Post by: X3N0-Life-Form on August 02, 2016, 06:13:42 am
So, it's been two weeks of doing mostly nothing due to busy week-ends, but there has been some tiny progress script-wise :
- aside from an IFF check, canBeFiredAt() is done and ready for testing
- implemented the "energy" cost type, making an ability drain a ship's weapon energy (I'm thinking about adding AB & shield)

I've also added a bunch of small TODOs to make the framework a bit more reliable & usable.
Title: Re: [CONCEPTION] Ability Management Framework
Post by: X3N0-Life-Form on September 10, 2016, 03:42:46 pm
So, this morning I woke up with a bunch of things to do. Near the bottom of that list was 'get some work done on the ability manager script'. Surprisingly, I got most of what was on that list done, and was feeling motivated enough to work on Freespace-related matters.

Even more surprisingly, I managed to get it to actually work. Sure, I've still got about a dozen features I'd like to get in, and it needs a lot more testing, but the ground work is now done. Next step is making sure it is as modder-friendly as possible, implement missing features and write up some crazy abilities.


Notable features I'd like to get in next :
- More sensible targeting options. Right now, I'm iterating through the mission ship list and grabbing the first valid target I can find. I'd love to be able to specify a list of target, or maybe pick the closest target. Some targeting persistence could be nice too, like "keep firing at target while it's valid

- Go through all the remaining TODOs related to ammo/energy management.

- Figure out the best way to automate the firing cycle. Right now, I have to set up repeating event in FRED that call the "fireAllPossible" function. I'd like to make it so that the function gets called at regular intervals without having to set it up every mission.
Done.

- Integrate into the ship variant script. I'm already using part of it actually to instanciate abilities on a per-mission basis. I'd like to be able to instanciate on a per-variant basis, like "all standard AWACS can use X", "SOC variants can use X & Y", etc.

- Put a basic showcase mod together and release that.



I'll post updated specs & scripts at a later date.
Title: Re: [CONCEPTION] Ability Management Framework
Post by: X3N0-Life-Form on October 16, 2016, 03:45:23 pm
Alpha stage + demo mod coming soon(ish) !

I've had the chance to a couple more proof-of-concept abilities, which allowed me to uncover & fix a number of bugs. I've also made a number of under-the-hood improvements to make the code more robust and more extendable.

I've streamlined the ability definition process a bit so that modders wouldn't have to mess with the core framework file at all, and the only function in there that should be of any interest is ability_trigger(), which is to be used for manually fired abilities.

Here are the things I want to do before putting together a demo mod :
- Proof of concept : ability targetting friendlies
- Proof of concept : ability targetting the caster itself
- (optional) Write up some quick-and-dirty hud feedback regarding an ability's status

Next steps:
- Over-time effects
- Allow multiple targets per cast
- More ability concepts
- Any other smaller feature on my TODO-list
Title: Re: [Work in Progress] Ability Management Framework
Post by: X3N0-Life-Form on October 20, 2016, 03:42:37 pm
Quote
Here are the things I want to do before putting together a demo mod :
- Proof of concept : ability targetting friendlies
- Proof of concept : ability targetting the caster itself
- (optional) Write up some quick-and-dirty hud feedback regarding an ability's status

Aaand done :
(https://ibin.co/2z9qzpoYk0cW.png)

Alpha + demo mod out before the end of the month !

I've got all I need feature-wise now for an "alpha" release.

I'd like to have more thorough documentation describing how all the **** works and what function might be of interest to modders, but that's a bonus at this point. I've already written up an updated table spec + 6 simple abilities using 3 different archetypes, so what I need to do now is : make a prettier version of my test mission, make a pretty diagram explaining how to get started, put together a bare-bone mod, and finally write up a release post.


For reference, here are the features on my TODO list after that:
- Duration & Over-time effects
- Support for sound effects
- Allow multiple targets per cast
- Add more target selection algorithms

Also, if anyone has cool ability concepts in mind, please do share :)
Title: Re: [Work in Progress] Ability Management Framework
Post by: T-Man on October 21, 2016, 05:42:02 pm
This is looking awesome X3N0, huge congrats on the progress so far :yes:. I sense a 'Command an AWACS' mission in our near future :pimp:. Out of interest can the targeting work for objects other than ships? (could you have an ability targeting nearby secondaries/plasma bolts etc?



Can think of a few potential ability types/ideas this could branch off into, for later on down the line when your thinking;

Beam overloads may make a nice ability to first work in and seem to be a cap-ship mission rage; for a period a beam cannon is swapped for a specified alternative weapon. Perhaps the ability could have a 'heat danger' rating that you need to keep an eye on while using it; if you use it too much or for too long the weapon melts down or the ship guts itself?

Another might be ships that have different 'modes' they can switch between at a button press, like a fighter that switches it's power grid from an 'interceptor mode' (powering an extra set of engines) to an 'Assault mode' (diverts the power to an extra set of weapons instead)?

Could you have abilities that interact with one-another positively or negatively? Like ECM/ECCM duels or an ability that aids other ships using their own abilities?

Far far down the line am thinking a big potential for this might be strike craft management on cap missions; the system stores info on the wings the player has on board and you can select wings to launch and recall, and it can track how long wings will take to land/launch etc. Would probably be a complex code but if capship missions become the rage may be useful for mission-makers.


Regardless though, what you have so far is quite the achievement in itself! Nice one. :yes:
Title: Re: [Work in Progress] Ability Management Framework
Post by: X3N0-Life-Form on October 22, 2016, 05:09:54 am
Thanks for the feedback, that's exactly the kind of thing I need ! :)


Out of interest can the targeting work for objects other than ships? (could you have an ability targeting nearby secondaries/plasma bolts etc?
That's one of the big points on my TODO list, right after over-time effects & multi-targetting. Right now, it's limited to ships, with valid targets determined by ship types, but I want to expand on this down the line to include other object types and ship flags.


Nice bunch of ideas, The first two should be fairly straightforward, the third sounds similar to stuff I've had in mind for a while, but would probably require a couple more features to be doable.

Strike craft management would be a much more complex endeavour, it would basically require writing a strikecraft management framework, and then have abilities that interact with it. Food for thought...
Title: Re: [Work in Progress] Ability Management Framework
Post by: X3N0-Life-Form on November 30, 2016, 03:55:00 pm
So, continuing in the theme of sitting on **** that's 90% complete, all I have left on my TODO list is to clean the modpack of irrelevant **** & have the user manual proof-read...

Obviously, since I have not done either of those over the past 3 weeks or so, I figured that if I want to release something before the end of the year, I might as well go for it now.

So, here it is, have fun  :) :
Ability Management Framework

Version 1.0 "Alpha" (https://github.com/X3N0-Life-Form/AbilityManagerDemo/releases/tag/v1.0)

Download link (https://github.com/X3N0-Life-Form/AbilityManagerDemo/releases/tag/v1.0).

Modpack includes :
- All the framework scripts
- Sample config files
- A user manual
- A sample mission that uses a number of abilities, including player-triggered ones
- A bunch of mostly irrelevant stuff due to me ripping this modpack out of another and not bothering to clean up too much


I've written a user manual that details a bit how things work, but here is the abridged version of it :

Required files
- data/scripts
   * parse.lua
   * abilityManager.lua
   * abilityLibrary.lua (--> new ability templates go there)
   * shipVariant.lua
   * shipVariantMissionWide.lua
- data/tables
- data/config
   * abilities.tbl
   * ship_variants.tbl (--> not actually related to abilities (for now))
   * ship_variants_mission_wide.tbl (aka SVMW.tbl)

SEXP calls
- Set abilities for everybody = setShipVariant('some category name from SVMW.tbl')
- Set ability for someone = ability_attachAbility(className, shipName, isManuallyFired)
- Manual trigger = ability_trigger(' AWAXEM::DISCO FURY') (-->ship name::ability name)


The full version of the user manual is located in the doc folder of the modpack.

Outside the user manual itself, each script has its own documentation, with further explainations & specs.

Keep in mind that I am classifying the as an "Alpha" version, meaning that there's still a lot of room for improvement and it hasn't been thoroughly tested yet.
I'm still honing my lua skills, and some areas are likely to get refactored down the line.


Still, I'm kind of proud of what I've done so far, and I hope I'll get more time to work on it next year.

Please feel comment, criticise, report bugs, offer suggestions, cookies, or post whatever crazy ability you come with :)



Title: Re: [Alpha Release] Ability Management Framework
Post by: Erebus Alpha on December 01, 2016, 11:36:59 pm
Wow, I am definitely going to have to check this out in detail. It's a good thing I did not finish my glorious tangled mess of SEXP-based spaceship abilities, which I intended to copy & paste into every mission of my upcoming campaign.

SEXP's are restricted to only the host, but if my understanding is correct, this ability manager wouldn't have that limitation? Meaning that it's even multiplayer-compatible?

I need to jump on this leading edge of coding awesomeness.

One of the biggest features of my upcoming campaign is that all the player-flyable Shivan fighters can do tactical subspace jumps. Can your ability manager handle teleportation? Getting reusable & combat-useful player subspace jumps with SEXP's was a bit of a challenge.

Most of the other abilities I have planned are pretty straightforward, and rely on playing with weapon energy, afterburner energy, armor types, and switching weapons around.

EDIT:
Oh, there are a few oddballs, like the shivan stealth fighter that needs to be able to switch the stealth flag on & off, and designate SSM strike targets. There is also a bomber that gets the invulnerable flag for one of its abilities.
Title: Re: [Alpha Release] Ability Management Framework
Post by: X3N0-Life-Form on December 02, 2016, 12:54:17 am
SEXP's are restricted to only the host, but if my understanding is correct, this ability manager wouldn't have that limitation? Meaning that it's even multiplayer-compatible?
I have no idea how FSO handles scripting in multiplayer, so I don't know.

Quote
One of the biggest features of my upcoming campaign is that all the player-flyable Shivan fighters can do tactical subspace jumps. Can your ability manager handle teleportation? Getting reusable & combat-useful player subspace jumps with SEXP's was a bit of a challenge.
The framework can handle any type of ability that requires a single target, so as long as you write all the warping subroutines it shouldn't be an issue.

It's actually an ability I had in mind for Shivan fighter but never got around to write, so I'd be happy to help you out on that :D.
Title: Re: [Alpha Release] Ability Management Framework
Post by: Erebus Alpha on December 02, 2016, 10:17:23 am
The SEXP jump system I have set up at the moment distinguishes between an attack-jump and a retreat-jump, based on whether or not you are facing a target. Unfortunately, because of the way FRED handles things, I have to make a list of combat-warp-attackable targets for every mission, usually capships.

An attack jump teleports you in the direction you are facing, to the distance to target, minus 2000 meters. It's great for rapidly closing the distance & making things dead, and also great for escort missions when you need to get back to your escort targets.

The retreat jump just teleports you 7500 meters in the direction you are facing, if you try and jump when the attack jump criteria are not met.

Currently the subspace jumps are hooked to a timer. After executing one, a ship can't use any of its other abilities until it's recharged. Depending on how flexible this new ability system is, I wonder if it's possible to set up an ability energy bar, and have stuff begin malfunctioning severely if it falls below zero.

In the campaign I'm designing, the Shivans are masters of quantum ****ery. If they need to extract 40 units of energy from a bucket that only has 30, they will find a way to artificially induce it by screwing with the fabric of space-time. Energy reserves 'going negative' for short periods of time are not that unusual.
Title: Re: [Alpha Release] Ability Management Framework
Post by: X3N0-Life-Form on December 08, 2016, 03:39:48 am
@Erebus Alpha:
Sounds interesting, you've basically two sets of possible actions when the ability is triggered. Do you have a prototype mission/mod I could look at & see if I can reproduce the ability using the manager framework ?



In other news, I've given some more thoughts on "over time effects", ie. buffs, damage/heal-over-time & other things. (Now I need to decide whether I should try to implement the buff system before or after I rewrite the parsing script...)

Current TODO list :
- rewrite parsing script
- implement buff system
--> write armor/AI buff, DoT & HoT abilities
- add proper AOE support
- clean up modpack
- think about adding some generic sfx/vfx support
- expand targetting options
--> don't be limited to ships
--> don't be limited to ship types
--> think about more complex target selection algorithms

EDIT - derped that message instead of posting a new one
Title: Re: [Alpha Release] Ability Management Framework
Post by: Erebus Alpha on December 10, 2016, 04:59:35 pm
Indeed, I'll make a copy of my prototype mission, clean up the events so that there are no unnecessary half-finished things floating around in it, package up the mod in a .vp file, and post it on the net.

Only the Manticore has completed HUD elements at the moment, because I have been busy making exponentially prettier beam, weapon, and explosion porn.
Title: Re: [Alpha Release] Ability Management Framework
Post by: X3N0-Life-Form on February 20, 2017, 09:31:12 am
Not dead yet ! I managed to find a bit of time this week-end to implement the "buff" system. It's pretty neat, although I haven't had time to test it in depth yet. I'd like to try mimicking some of the abilities I've come across in other mods, such as BP's One Future & The Blade Itself.

I'd like to implement a basic buff status HUD display, akin to what I did with abilities.

I've also looked into adding "casting" sound effects, to give it more flavor. "Impact" SFX + VFX in general are being shelved for now.


However, there's a bunch of refactoring I want to do before going further. Buffs & abilities share a number of similarities, so I want to switch to a proper OOP approach, plus reorganizing my scripts. And I still need to rewrite the old parsing script.


Current TODO list :
- refactor Buffs & Abilities into Objects
- reorganize scripting library
- rewrite parsing script
- implement buff system
- test buff system
--> write armor/AI buff, DoT & HoT abilities
- streamline ability library functions & remove redundancies
- extract constants into table parameters
- add proper AOE support
- clean up modpack
- add some generic sfx/vfx support
- expand targeting options
--> don't be limited to ships
--> don't be limited to ship types
--> think about more complex target selection algorithms

Priority levels: high, medium, low, very low, done, cute
Title: Re: [Alpha Release] Ability Management Framework
Post by: X3N0-Life-Form on July 14, 2019, 06:03:27 pm
*Meanwhile, two years later*

Yeah, I kinda got sidetracked...
In any case, I'm back to working on this apparently, which theoretically should go a bit more smoothly now that I solved the Lua-OOP stuff.

So what's new since 2017 ? Nothing really, I switched my dev environment to Knossos, and I rewrote bit of my table parser so that it doesn't destroy my brain every time I try to use it. Next step is converting all my table tables to table objects, then essentially do the same thing with all my ability stuff, then either expanding the buff system, or add proper vfx/sfx support, whichever feels more fun.


Current TODO list :
- switch all table horrors to TableObjects
- switch mod to Knossos
- refactor Buffs & Abilities into Objects
- add SEXP support
- reorganize scripting library
- rewrite parsing script
- implement buff system
- test buff system
--> write armor/AI buff, DoT & HoT abilities
- streamline ability library functions & remove redundancies
- extract constants into table parameters
- add proper AOE support
- clean up modpack
- add some generic sfx/vfx support
- expand targeting options
--> don't be limited to ships
--> don't be limited to ship types
--> think about more complex target selection algorithms

Priority levels: high, medium, low, very low, done, cute
Title: Re: [Alpha Release] Ability Management Framework
Post by: X3N0-Life-Form on July 21, 2019, 02:12:34 pm
switch all table horrors to TableObject - done

I am officially back to where I was at 2 years ago, only things are less vomit-inducing under the hood. I'd still like to refactor the buffs & abilities the same way I did the parser, but that should be much easier. Right now, I'm more excited about getting some sound and/or visual effect support in.

Current TODO list :
- switch all table horrors to TableObjects
- switch mod to Knossos
- refactor Buffs & Abilities into Objects
- add SEXP support
- reorganize scripting library
- rewrite parsing script
- implement buff system
- test buff system
--> write armor/AI buff, DoT & HoT abilities
- streamline ability library functions & remove redundancies
- extract constants into table parameters
- add proper AOE support
- clean up modpack
- add some generic sfx/vfx support
- expand targeting options
--> don't be limited to ships
--> don't be limited to ship types
--> think about more complex target selection algorithms
- Make support ships resupply ammo reserves

Priority levels: high, medium, low, very low, done, cute
Title: Re: [Alpha Release] Ability Management Framework
Post by: X3N0-Life-Form on January 08, 2020, 08:41:47 am
Well then, I've had quite a bit of fun since the last time I posted here. I've had time to test the buff system quite extensively and started to go a bit nuts with it, giving me the opportunity to find & fix a few bugs here & there. I finished writing in a basic sound & visual effects system, allowing the modder to specify whether a 3d sound or animation should play when an ability is cast, or when a buff is applied, ticks and expires.

Now I'd really like to SEXP-fy my FRED scripting calls, as it would make things sooo much cleaner in there, as well as finishing my Object refactoring.
I'd also love to have buff-placing weapons, though I'm still not 100% sure how I'm going to go about it.
Plus, there's some new abilities that I'd fancy implementing :P

(Also, I'm thinking this thread would be more at home in the Scripting Workshop rather than in releases)

Current TODO list :
- refactor Buffs & Abilities into Objects
- add SEXP support
- test buff system
--> write armor/AI buff, DoT & HoT abilities
- extract constants into table parameters
- add proper AOE support
- add some generic sfx/vfx support
- expand targeting options
--> don't be limited to ships
--> don't be limited to ship types
--> think about more complex target selection algorithms
- make support ships resupply ammo reserves
- *new* add custom key support
- *new* improve player ability display
--> ease up on the debug log prints when necessary
- *new* implement new abilities
--> *new* Kage Bunshin no Jutsu
     * need to poof the clones before expiration (eg. make buff expire on death)
--> *new* Tracer-style Recall
     * needs to look & sound more impressive
     * need to test how it scales up to more ships
     * need to restore primary & secondary ammo
--> Tracer-style Blink
--> Bloodlust
--> Destructor Ray
--> Oh look at it go!
--> Time stop
--> In-mission jump
--> Warp-in respawn
--> Dispell
--> Metamorphosis
--> For Khaz Modan!
--> Diva's Defense Matrix
- *new* add buff placing weapons
- *new* address buff stacking
- *new* add *.tbm support to the table parser
- switch all table horrors to TableObjects
- switch mod to Knossos
- clean up modpack
- rewrite parsing script
- implement buff system

Priority levels: high, medium, low, very low, done, cute
Title: Re: [Alpha Release] Ability Management Framework
Post by: Darius on January 08, 2020, 09:50:14 am
As with all script releases, I would be very glad for sexp support, it provides an accessible way to quickly work out how a script works which in turn increases confidence for someone not script-savvy (like me) to add in custom parameters later  :yes:
Title: Re: [Alpha Release] Ability Management Framework
Post by: X3N0-Life-Form on January 17, 2020, 04:13:40 am
I've added SEXP support for the most important functionalities of the ability framework and ship variant system, though I haven't had time to verify that everything works as intended yet.

Now I'd like to finish up my object oriented refactoring to bring the buff system in line with everything else. I think it's also time I take a look at bringing in area (volume?) of effect and buff-placing attacks, then dive back into spell-making a bit for a little while to have fun with that.


Also, could this be moved back into the scripting workshop ? This is more of a development thread that happens to include an "alpha release" as proof of concept rather than a proper release.

Current TODO list :
- refactor Buffs into Objects
- add SEXP support
- extract constants into table parameters
- add proper AOE support
- expand targeting options
--> don't be limited to ships
--> don't be limited to ship types
--> think about more complex target selection algorithms
- make support ships resupply ammo reserves
- add custom key support
- improve player ability display
--> ease up on the debug log prints when necessary
- implement new abilities
--> Kage Bunshin no Jutsu
     * need to poof the clones when dying before expiration (eg. make buff expire on death)
--> Tracer-style Recall
     * needs to look & sound more impressive
     * need to test how it scales up to more ships
     * need to restore primary & secondary ammo
--> Tracer-style Blink
--> Bloodlust
--> Destructor Ray
--> Oh look at it go!
--> Time stop
--> In-mission jump
--> Warp-in respawn
--> Dispell
--> Metamorphosis
--> For Khaz Modan!
--> Diva's Defense Matrix
- add buff placing weapons
- address buff stacking
- add *.tbm support to the table parser
- switch all table horrors to TableObjects
- switch mod to Knossos
- clean up modpack
- rewrite parsing script
- implement buff system
- add some generic sfx/vfx support
- test buff system
--> write armor/AI buff, DoT & HoT abilities
- refactor Abilities into Objects

Priority levels: high, medium, low, very low, done, cute