Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add concept of "entity cost" to perks #81

Open
Phil25 opened this issue Dec 12, 2023 · 0 comments
Open

Add concept of "entity cost" to perks #81

Phil25 opened this issue Dec 12, 2023 · 0 comments
Labels
request :: general New feature or request
Milestone

Comments

@Phil25
Copy link
Owner

Phil25 commented Dec 12, 2023

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 being 0.
  • [S2] If cost is specified but not found, it will result in it being 99 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 high rate is.
  • Non positive values should be specified as 99 and throw an error in the log.
@Phil25 Phil25 added this to the 3.0.0 milestone Dec 12, 2023
@Phil25 Phil25 added the request :: general New feature or request label Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request :: general New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant