• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Suggestion] Get away from those single file gamemodes
#3
Even if you compel people to write modular scripts, everyone has an individual take on "modular" - at least when it comes to Pawn, imho. And, as far as I can see, this is due to a couple of reasons:



  1. People get confused because there is no uniform approach to modular programming in Pawn and they're afraid to make things wrong.

  2. People think that due to the increased length of the script when modularizing the gamemode, this somehow negatively affects performance, readability and their ability to find things in their gamemode.

  3. People get confused as to how to break things down and which order to include them in. They think that if two or more systems interact or rely on each other, they may as well merge them into one file.


Bottom line is, these people need to be taught, and that's a community effort. There's a need for a first and foremost SIMPLE approach to modular programming in Pawn. Here's how I do it:


  • Hooks of natives are included on the very top of the main script.

  • Systems are broken down into two files:

    1. Data Getters/Setters to access the data?(if necessary)

    2. Implementation (functions and callbacks)

  • In case some data is needed in a file that was included after the file that accesses it (and this forcing a reparse), I just forward the particular function in the file that tries to access it.

  Reply


Messages In This Thread
RE: Get away from those single file gamemodes - by Manyula - 2019-06-01, 05:24 PM

Forum Jump: