It's very common in projects born as a proof of concept or experiments which suddenly become serious without: stopping to look what was done and how could be improved.
Yes, this project was made as PoC and it still is. It was never meant to be a full-fledged game, but it just happened that it almost became it. But that's the way it will be, because I'm not going to develop it in the future.
I have stopped many times and corrected the old code so that it would cooperate with future new functions, but I never thought about throwing away the project and starting again.
Then outline a basic diagram (anyone you think could help you), how you will allocate your resources and constants.
When they are needed variables are created and right after that they are released.
For example, if a given class is needed throughout the game, it is created during the creation of the main game class and released when it is released. If a class is needed, for example, only in one scene, it is created during the initialization of the scene and released when it is released.
I pay attention to this, so as not to leave unused resources unnecessary.
Question any global variable, constant, resource, and type: When are needed?
Practically throughout the entire process.
Which class or process needs it?
Many classes use the same constants, which is why they are global. If any constant is used only in one unit, it is local.
Is it OK that could bee seen or used in places where is not needed? etc.
No, it's not good, but there is no tragedy either. Sometimes there is no way to easily hide all the elements, that's why stays as global, without complicate the whole code.
Believe me. Probably the project needs it. You will be surprised of what you'll find: methods, functions and procedures which are not used which in turn use constants or types not used in other places, things that should be in other unit, etc.
Yesterday I took care of it and manually checked all constants and other identifiers. I found two unused constants and no unused class or routine. It cost me almost two hours, and with the help of a dedicated tool it would cost me a few seconds.
A tool or the compiler
[…]
You should open a Ticket in the bug tracker as requirement for the compiler....
I'm not sure. If the compiler will report such elements, then during the compilation of a regular library/package a lot of misleading suggestions will pop up. That's why I would prefer an IDE plugin and use it only when it makes sense.
But who knows, maybe some special option for the compiler (turned off by default) would be a better solution.
This project is quite specific. Certain constructions I used only to check how they will look in practice (because I have never used them before), and some exist only for a joke (e.g. one routine with
goto's instead of a regular loops). It is a one big experiment.
I think that with the code evaluation we will wait until the publication of the whole project, because in this thread such discussions do not make sense. But thanks for replies!