tung362 / RoR2PVP

Risk of Rain 2 PVP Mod
https://thunderstore.io/package/60dfb16d5e944afc/RoR2PVP/
5 stars 0 forks source link

Enhancement Request - big refactoring requested for better extendability #12

Closed davidstevenrose closed 3 years ago

davidstevenrose commented 3 years ago

Is it possible to enhance the source code of this mod with a big refactoring? Specifically, I noticed areas of the source code that is lacking both reusable and extendable modules. For example:

  1. The class Hooks in Hooks.cs is not extendable since it is a static class. Therefore, none of the methods in Hooks are extendable.
  2. The class PVPMode is responsible for the behavior of more than one gamemode, which is very poor cohesion. Again, the class is also static. I think that an acceptable solution to this issue would result in an easy process of adding custom gamemodes and rules for developers by simply extending the code rather than modifying the code.
tung362 commented 3 years ago

Hi, the source code was originally ment for a single game mode which was "Team PVP" at the time, "Free For All" was a recent addition and the source did not take into account multiple game modes so it was just integrated internally. I do agree that the source does need to be refactored. Due to the anniversary update many small bugs that I have fixed in the past have reemerged and would have to be fixed beforehand.

I have thought about turning this mod into a extension library that would extend the API's functionality in the past but decided due to it not worth the effort and the lack of interest with the mod from the community in general I decided not to go that route.

I'm currently busy with other projects but when I have free time I might consider turning this mod into a library but it probably won't be for a while.

Also thanks for giving me feedback! Your suggestions shines light on the flaws of the current system and will help me to improve it in the future :D

davidstevenrose commented 3 years ago

Thank you for the response. I'm glad that my feedback shined some light some of the flaws of the current system.

tung362 commented 3 years ago

Hey, I know this is a bit late but just an update: I have refactored the mod as well as made a game mode API. For those that are interested in extending the pvp mod, making your own game modes, or just want a library with some helpful utilities this update should help!

As going along with the standards of the PVP mod the API will also support vanilla along with modded clients. It should also be able to support multiple mods and run fine even if others don't have all the same mods installed that uses the API's functionalities.

Currently the update is not ready yet so I haven't made the commits yet since I'm still working on the documentations and testing for bugs but expect a release in a few days!

tung362 commented 3 years ago

New version is released!

I have refactored the pvp mod and as well made a new API for creating your own game mode. Link to the new API: https://github.com/tung362/RoR2GameModeAPI

If you have any more suggestions or requests feel free to notify me with another issue request!