INTRODUCTION
A MMORPG is a very complex project, so in order to create a stable server, we will need to follow certain conventions.
These conventions:
-MUST BE FOLLOWED
-ARE NOT OPTIONAL.
They may be broken if one of these conditions are met:
-You have the required authorization level. (Minimum level on the right, in red).
-You have asked someone with the required authorization level about it, and he
confirms that you should be able to exceptionally break the convention.
(Please, if you let someone break a convention, if it is potentially dangerous, make sure that the person does it properly).
THE CONVENTIONS
(Restrictions)
-The declaration of pointers is not allowed. (Level 1).
-Using NEW is not allowed. (Level 2 – Authorized only for use on SMART POINTERS).
-The creation of new files or classes is not allowed. (Level 2).
-The usage of #DEFINE is not allowed. (Level 2).
-The usage of C-library functions which have a varying number of arguments is not allowed. (Level 3).
-NEW can ONLY be used to create a smart pointer (boost::shared_ptr / std::auto_ptr…). (Level 3).
-The usage of C-library functions which return a pointer is not allowed. (Level 3).
-The creation of global variables is not allowed. (Level 4).
-The usage of C-library functions which have a C++-library homologue is not allowed. (Level 4).
-Adding PUBLIC attributes or functions to a class which you have not created is not allowed. (Level 4).
-The usage of MALLOC, CALLOC or FREE is not allowed. (Level 5).
-The usage of C-Casts or reinterpret_cast is not allowed. (Level 5).
(Style) (All these are Level 0)
-Each file must contain a single class. The filename and the class name must be the same. When possible, the declaration of a class will be in a .h, and the definition in a .cpp file.
-Variables should have meaningful names.
-Functions should never crash.
THE AUTHORIZATION LEVELS
Authorization levels are in place mainly to assure that the less experienced C++ programmers use the right coding style, and that when they have to use potentially dangerous C++ constructs or techniques, they do it properly, guided by a more experienced C++ programmer. That way, the code will be more tidy and less bugs will appear, and new C++ programmers will be able to learn faster.
Note that, even if you have the authorization level required, many techniques or constructs are in the list because they are dangerous and shouldn’t be used without a good reason.
Level 0: Every member of the team has a Level 0 authorization level. This allows you to break Style conventions if needed, etc.
Level 1: Allows you to declare pointers, etc.
Level 2: Allows you to use #define, and NEW on smart pointers.
Level 3: Allows you to use certain C functions (refer to Conventions) and to use NEW freely.
Level 4: Allows you to create global variables, to add public attributes and functions to any class, and to use any C function except the ones related to Dynamic Memory Allocation.
Level 5: You can use C-casts, reinterpret_cast, MALLOC, CALLOC, FREE, and REALLOC.
GETTING A HIGHER AUTHORIZATION LEVEL
Authorization levels are only there for safety. If you know perfectly well the risks that the techniques / constructs in the Conventions try to avoid (which of course includes knowing perfectly well these techniques and constructs themselves), just tell me (zstars) which authorization level you want.
For example, if you know well how to use pointers, you know the risks (segmentation faults, excessive dereferencing, invalid pointers, double deleting, memory holes…) then you should have, at least, a level 1 authorization.
RATIONALE
If you want to know why these conventions are in place, and why they are important, feel free to ask me (zstars).