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

EP for activity generating code refactor #433

Open
MikeJeffers opened this issue Nov 13, 2021 · 1 comment
Open

EP for activity generating code refactor #433

MikeJeffers opened this issue Nov 13, 2021 · 1 comment
Labels
Difficulty: Moderate This issue is non-trivial but still well-defined but maybe broader scope performance Priority: Low This ticket is not part of any forseen need or upcoming roadmap item Refactor Code maintainability, style, or other non-functional changes

Comments

@MikeJeffers
Copy link

Much like threat, these happen all over the place, and have a lot of duplicate logic, and arbitrary modifiers that would be nice to consolidate into one place for each bespoke activity.
This will make balancing, debugging, and adding new EP activities easier!

Here are just some of the places you can find such code:
https://github.com/OpenPerpetuum/PerpetuumServer/blob/Development/src/Perpetuum/Services/Relics/Relics/AbstractRelic.cs#L141-L150 (note the zone check for x0 or x2)
https://github.com/OpenPerpetuum/PerpetuumServer/blob/Development/src/Perpetuum/Zones/Artifacts/Scanners/ArtifactScanner.cs#L59-L61
https://github.com/OpenPerpetuum/PerpetuumServer/blob/Development/src/Perpetuum/Modules/HarvesterModule.cs#L32-L39

and plenty more (find all references for EpForActivityType)

This one will not be as easy as there is a lot of logic based on some local state especially for missions etc. But there is likely an opportunity to create an abstraction, and maybe a delegate pattern to compute the bespoke EP value logic, and then handle the common manipulations.

2nd (optional) enhancement might be to do the insert in a separate task, but beware to pre-compute the values in the scope of the calling thread or transaction to avoid reading shared memory - where the main threat might (want to) be disposing, nulling, data you are reading(!). And make a separate transaction for the EP insert. Assess performance gains/losses for this and pursue accordingly - there may be occasions where many are getting EP activity rewards at once, and you might lose performance gain to the overhead of having them happen in separate transactions (where they were part of 1 big one of an NPC kill or mission completion).

@MikeJeffers MikeJeffers added Refactor Code maintainability, style, or other non-functional changes performance Difficulty: Moderate This issue is non-trivial but still well-defined but maybe broader scope Priority: Low This ticket is not part of any forseen need or upcoming roadmap item labels Nov 13, 2021
@Ramit110
Copy link

Ramit110 commented Sep 8, 2022

Started work on this in https://github.com/Ramit110/PerpetuumServer/tree/issue-%23433

@clouths clouths moved this to BACKLOG in Game Server Dec 17, 2023
@clouths clouths moved this from BACKLOG to Checkup in Game Server Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty: Moderate This issue is non-trivial but still well-defined but maybe broader scope performance Priority: Low This ticket is not part of any forseen need or upcoming roadmap item Refactor Code maintainability, style, or other non-functional changes
Projects
Status: Checkup
Development

No branches or pull requests

2 participants