Gamemode by include
#1

Hello. I'm wondering if it's not better to make a gameode with only include.
Example:
- MainFolder
-- Players
--- VariablesSaveLoading
--- Other
-- Vehicle
...
And all of them included in one gamemode.
Reply
#2

Quote:
Originally Posted by Dayrion
View Post
Hello. I'm wondering if it's not better to make a gameode with only include.
Example:
- MainFolder
-- Players
--- VariablesSaveLoading
--- Other
-- Vehicle
...
And all of them included in one gamemode.
Actually that's how big projects should be made so it will be too easier to edit / manage the scrip.
So yeah it is better for sure.
Reply
#3

Quote:
Originally Posted by jlalt
View Post
Actually that's how big projects should be made so it will be too easier to edit / manage the scrip.
So yeah it is better for sure.
For debugging or stuff like that, it's not more harder ?
Reply
#4

Quote:
Originally Posted by Dayrion
View Post
For debugging or stuff like that, it's not more harder ?
Its depends on how you wanna debug, like by crashdetect result would be much easy to find the error and solve it but if you wanna put a print to see where is a system not doing well then you gotta put prints on different parts of the system and it would be a bit harder as you gotta open and edit file by file....
However nothing is complete and everything has good and bad things, you have by yourself according to what you wanna do, have to decid to use includes or only one big file...
Reply
#5

Quote:
Originally Posted by jlalt
View Post
Its depends on how you wanna debug, like by crashdetect result would be much easy to find the error and solve it but if you wanna put a print to see where is a system not doing well then you gotta put prints on different parts of the system and it would be a bit harder as you gotta open and edit file by file....
However nothing is complete and everything has good and bad things, you have by yourself according to what you wanna do, have to decid to use includes or only one big file...
Mhmm.. I see, thanks.
It's about a team developer. Work together on a gamemode and we probably will do like that. So I'm wondering if we are going on the right way or not.
- Mhm.. Make a command, system, or stuff like that on a local server and put it on the global gamemode will avoid the problem of debugging by printing?
Reply
#6

Quote:
Originally Posted by Dayrion
View Post
Mhmm.. I see, thanks.
It's about a team developer. Work together on a gamemode and we probably will do like that. So I'm wondering if we are going on the right way or not.
- Mhm.. Make a command, system, or stuff like that on a local server and put it on the global gamemode will avoid the problem of debugging by printing?
I think yes probably.
Reply
#7

What does one include even mean? if you are gonna put all of it in one include, why not put it in the GM itself? it literally makes no difference and doesn't even make sense.

If by that you mean dividing modules into includes, search forums for modular gamemodes (modular programming) and you'll get your answers.
Reply
#8

Modular is useless in PAWN to be honest. I would recommend creating gamemodes in C++ or C# which is much more BETTER than the PAWN language.
Reply
#9

Hush, he's looking into how he can do things, and many better gamemodes were made in this way.

If done correctly, they work out.
Reply
#10

I hate to keep too few files and I also hate to keep too many files. Write your code and split your code into files as you need. Don't do it the other way round, i.e: making several files and then whining that you have to have 10000 tabs open at a time.

Do it if you need it.
Reply
#11

Quote:
Originally Posted by Sew_Sumi
View Post
Hush, he's looking into how he can do things, and many better gamemodes were made in this way.

If done correctly, they work out.
That's so rude, I'm saying my opinion since it's an open "discussion". I've tried Modular even after implementing several syntax similar to object-oriented syntax and it didn't work out, I'm sure what I did wasn't just adding some hooks in different files.
Reply
#12

Mhm.. It's not only for me, it's for working in group. We are few dev' so we need to work on the same file at the same time which is a problem.
Modular programm seems to be a good way and why Pawn isn't good at modular programming?
Reply
#13

Quote:
Originally Posted by PawnHunter
View Post
That's so rude, I'm saying my opinion since it's an open "discussion". I've tried Modular even after implementing several syntax similar to object-oriented syntax and it didn't work out, I'm sure what I did wasn't just adding some hooks in different files.
Just because it didn't work for you, doesn't mean the rest of us can't make it work.


As for being rude, what is rude is simply coming into a thread where he's asking about how to do it, and making out it's useless.

It's a common method, and wouldn't you look at GL... That does it in a sense, so before you start taking things personally and make out that the response is rude, maybe you should check what's being done, before assuming that your failure is shared by the rest.
Reply
#14

Quote:
Originally Posted by Dayrion
View Post
Mhm.. It's not only for me, it's for working in group. We are few dev' so we need to work on the same file at the same time which is a problem.
Modular programm seems to be a good way and why Pawn isn't good at modular programming?
Because PAWN is not object oriented, PAWN is simple, PAWN is outdated (the version SAMP uses is probably 10 years old), and more ..

Quote:
Originally Posted by Sew_Sumi
View Post
Just because it didn't work for you, doesn't mean the rest of us can't make it work.


As for being rude, what is rude is simply coming into a thread where he's asking about how to do it, and making out it's useless.

It's a common method, and wouldn't you look at GL... That does it in a sense, so before you start taking things personally and make out that the response is rude, maybe you should check what's being done, before assuming that your failure is shared by the rest.
I didn't "fail", I've been testing PAWN limits for months now, and I'm saying there is no way to process with a REAL modular design, yeah you could shit yourself and make some files called "callbacks, commands, header" separate then include to main file, but this isn't modular. I'm not just a beginner scripter, it's just the language that lacks the required features to make it modular. Adding some hooks and functions in different files, isn't what Modular design is. Anyways, that's my last reply here, I've said what I wanted to.
Reply
#15

Checkout Scavenge and Survive by Shoutclaws on github (https://github.com/Southclaws/ScavengeSurvive)
Reply
#16

Quote:
Originally Posted by PawnHunter
View Post
I didn't "fail", I've been testing PAWN limits for months now, and I'm saying there is no way to process with a REAL modular design, yeah you could shit yourself and make some files called "callbacks, commands, header" separate then include to main file, but this isn't modular. I'm not just a beginner scripter, it's just the language that lacks the required features to make it modular. Adding some hooks and functions in different files, isn't what Modular design is. Anyways, that's my last reply here, I've said what I wanted to.
Nope, plain out nope... GTO was a highly worked modular gamemode which many couldn't work out, and that did a lot more advanced workings than what you even mention here.

I'm not "shitting myself", I know that mode had great potential, and others just didn't understand it.
Reply
#17

Quote:
Originally Posted by PawnHunter
View Post
Because PAWN is not object oriented, PAWN is simple, PAWN is outdated (the version SAMP uses is probably 10 years old), and more ..



I didn't "fail", I've been testing PAWN limits for months now, and I'm saying there is no way to process with a REAL modular design, yeah you could shit yourself and make some files called "callbacks, commands, header" separate then include to main file, but this isn't modular. I'm not just a beginner scripter, it's just the language that lacks the required features to make it modular. Adding some hooks and functions in different files, isn't what Modular design is. Anyways, that's my last reply here, I've said what I wanted to.
There is a difference in "modular scripting" and "object oriented scripting".
The word module is self explanatory. It means spliting your script, either by hooking way(which i recommend) or simple splitting.

Also another way out is using filterscripts and (S)PVars fpr script integration. The only reason you do modular type of scripting is for:
- Script integration (like you want to get player admin level in more than one module, like you have login dialog in login.pwn and want to access that variable in say houses.pwn)

- Making a part more readable and editable, like you know in future you want to change textdraws, you can make a function "CreateSelectionTextDraws" in a seperate module so it will be easy for modifying the tds)

- Plug'n'play features, they are same as filterscripts (like maps or objects; a custom vending machine script etc)

I remade serversided.inc using modular scripting technique, if you want a refrence here it is: https://github.com/Agneese-Saini/SA-...de/serversided
Reply
#18

Quote:
Originally Posted by DRIFT_HUNTER
View Post
Checkout Scavenge and Survive by Shoutclaws on github (https://github.com/Southclaws/ScavengeSurvive)
Pretty impressive script.
Also, why does he needs to do that?
PHP Code:
public OnGameModeInit()
{
    print(
"[OnGameModeInit] Initialising 'Main'...");
    
OnGameModeInit_Setup(); // why does he make a function instead of putting the code here?
    #if defined main_OnGameModeInit
        
return main_OnGameModeInit();
    
#else
        
return 1;
    
#endif
}
#if defined _ALS_OnGameModeInit
    #undef OnGameModeInit
#else
    #define _ALS_OnGameModeInit
#endif
#define OnGameModeInit main_OnGameModeInit
#if defined main_OnGameModeInit
    
forward main_OnGameModeInit();
#endif 
Reply
#19

Quote:
Originally Posted by Dayrion
View Post
Pretty impressive script.
Also, why does he needs to do that?
PHP Code:
public OnGameModeInit()
{
    print(
"[OnGameModeInit] Initialising 'Main'...");
    
OnGameModeInit_Setup(); // why does he make a function instead of putting the code here?
    #if defined main_OnGameModeInit
        
return main_OnGameModeInit();
    
#else
        
return 1;
    
#endif
}
#if defined _ALS_OnGameModeInit
    #undef OnGameModeInit
#else
    #define _ALS_OnGameModeInit
#endif
#define OnGameModeInit main_OnGameModeInit
#if defined main_OnGameModeInit
    
forward main_OnGameModeInit();
#endif 
Easier to debug and extend later.
Reply
#20

Quote:
Originally Posted by Dayrion
View Post
Pretty impressive script.
Also, why does he needs to do that?
PHP Code:
public OnGameModeInit()
{
    print(
"[OnGameModeInit] Initialising 'Main'...");
    
OnGameModeInit_Setup(); // why does he make a function instead of putting the code here?
    #if defined main_OnGameModeInit
        
return main_OnGameModeInit();
    
#else
        
return 1;
    
#endif
}
#if defined _ALS_OnGameModeInit
    #undef OnGameModeInit
#else
    #define _ALS_OnGameModeInit
#endif
#define OnGameModeInit main_OnGameModeInit
#if defined main_OnGameModeInit
    
forward main_OnGameModeInit();
#endif 
Quote:
Originally Posted by DRIFT_HUNTER
View Post
Easier to debug and extend later.
There's actually a meaning to that and this is from one of my work..

Reference: https://github.com/pds2k12/San-Fierr...r/main.pwn#L10

Code:
/* - 
	How it happens behind the console
	--------------------------------------
	* OnGameModeInitEx - first
		* hooks of OnGameModeInit - second
	--------------------------------------
	"OnGameModeInitEx" will be called first to avoid crashes and confusion within the hooks.
	Everything that you have to do regarding OnGameModeInit
	You have to place them in "OnGameModeInitEx" to make sure other hooks will not mess up on start up.
*/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)