RTD
RTD copied to clipboard
Add concept of "entity cost" to perks
Add a field to perk config indicating how costly every perk can be on the entity count.
Suggestion 1
Perks will have a new field called entity_cost
which tells RTD roughly how many perk-spawned entities are possible to exist at one time. It can be written in the form of a formula which includes perk settings as variables. For example:
-
Smite:
"entity_cost" "1" // proxy entity for effects
-
A Call Beyond:
"entity_cost" "%amount% * 6 / %rate%" // rough estimate given the amount and spam potential
Suggestion 2
Perks will have a new field called cost
which specifies the name of the function that RTD can call in order to retrieve the entity cost of a perk. The function will accept the Perk
instance from which it can read its variables.
-
Smite:
"cost" "Smite_Cost"
int Smite_Cost(const Perk perk) { return 1; } // proxy entity for effects
-
A Call Beyond:
"cost" "ACallBeyond_Cost"
int ACallBeyond_Cost(const Perk perk) { // rough estimate given the amount and spam potential return perk.GetPrefCell("amount") * Ceil(6.0 / perk.GetPrefFloat("rate")); }
Use case
If anyone is crazy enough to run RTD on a 60 or 100 player servers, there can be a ConVar sm_rtd2_entity_cost_limit
(default 99) which will disable every perk beyond the specified limit. Setting this ConVar will show exactly which perks were disabled including their cost.
Implementation notes
- [S1] Supporting formulas and variables can be a quite a burden on implementation. I need to look at every perk but hopefully everything will be implementable without worrying about order of evaluation (so no addition/subtraction or braces).
- [S1] Division by 0 will fail the parsing and result in
99
entity cost. - [S2] Lack of the
cost
specification will result in it being0
. - [S2] If
cost
is specified but not found, it will result in it being99
and a message in the error log. - Every float returning operation must be rounded up in order to avoid zero-ing out the result. For example
1 / %rate%
must be 1 regardless of how highrate
is. - Non positive values should be specified as
99
and throw an error in the log.