beyond-all-reason / Beyond-All-Reason

Main game repository for Beyond All Reason.
https://www.beyondallreason.info/
Other
1.64k stars 269 forks source link

Power Calculation Gadget/API? for Dynamic Difficulty and Game Progression calcs #3379

Closed SethDGamre closed 1 month ago

SethDGamre commented 1 month ago

This gadget aims to compile all team power-related tracking in a single gadget to prevent the necessity for redundant power-related tracking. It also provides an array of global functions to be used by other gadgets.

The purpose of power-related calculations is to provide a framework to approximate metrics such as tech progression, relative power levels between teams, campaign event triggering and PvE dynamic difficulty adjustment, and eventually to replace the redundant function that inspired this from unit_evolution.lua

I went through and tested every function. They all work (with admittedly less rigorous testing on the human-specific functions because I'm but one human)

SethDGamre commented 1 month ago

What does TPW mean? Avoid use of acronyms and abbreviations as they are unclear to other developers.

All the TPW functions are declared as globals, they should be locals and declared before they are called. Any API functionality to be exposed should be added to the GG table.

I did as you asked, and will be putting them in a sub-table of global GG. functions like discussed in discord Thanks

WatchTheFort commented 1 month ago

Power calculations only update on unit created and destroyed, what happens when a unit is captured? Do you actually want to use MetaUnitAdded and MetaUnitRemoved?

SethDGamre commented 1 month ago

Power calculations only update on unit created and destroyed, what happens when a unit is captured? Do you actually want to use MetaUnitAdded and MetaUnitRemoved?

I don't see a callin for this on recoil or spring website. I can't concieve of this oversight causing nil errors and a few units leaking here or there isn't a big worry of mine. I DO want to find and impliment a more accurate solution that handles these edgecases though.

WatchTheFort commented 1 month ago

I don't see a callin for this on recoil or spring website. I can't concieve of this oversight causing nil errors and a few units leaking here or there isn't a big worry of mine. I DO want to find and impliment a more accurate solution that handles these edgecases though.

Those callins are custom ones implemented within BAR Lua, with the goal of covering all situations with a single callin.

SethDGamre commented 1 month ago

I don't see a callin for this on recoil or spring website. I can't concieve of this oversight causing nil errors and a few units leaking here or there isn't a big worry of mine. I DO want to find and impliment a more accurate solution that handles these edgecases though.

Those callins are custom ones implemented within BAR Lua, with the goal of covering all situations with a single callin.

Donezo

SethDGamre commented 1 month ago

Comments should be formatted to have a space after the --

Whenever calculating an average, ensure divide-by-zero errors are prevented.

This is done

SethDGamre commented 1 month ago

Wrong button, didn't mean to close