How to properly design a large game mode (structure wise)?

Hello,

I am asking this because I have seen many scripts/gamemodes written quite differently. The two main structures I see for gamemodes are like this:

Resources
gamemode folder
 client folder
   gui folder
     -gui_c.lua
 server folder
    gui folder
     -gui_s.lua

In this way everything is contained into 1 resource/script and the say 20-30 other modules or scripts would be contained in there

Resources
gamemode_gui folder
 - gui_s.lua
 - gui_c.lua
gamemode_spawn folder
 - spawn_s.lua
 - spawn_c.lua

In this case the gamemode is fragmented into different resources and started seperately

Resources
gamemode folder
 - main_client.lua
 - main_server.lua 

In this case all the code is literally put into 2 lua files which could be very large and hard to organize

Is one design better than the other? In terms of performance? I know for my fragmented resources is better/more organized in my opinion, but with the combined gamemode resource you are getting 1 resource thats being loaded and it is more clean

When you make it one folder for the gamemode you can share functions and such but with the fragmented one you have to repeat certain functions

I’ve been combining resources since i knew it could be done. I think its better for performance not so good for organization. But an enjoyable experience for the player is the ultimate goal.

i doubt performance matter much, i just manage it depending on resource size, if the resource requires 8+ files then i’ll usually have subfolders for specific type of scripts, otherwise have them in the root directory, i never ever put scripts with multiple purposes into one script.

however you do it is up to you, you can’t do much wrong.

So lets say we had a money system like

gamemode_money

making a weapon shop would be better to make it seperately like
gamemode_wepshop

and then include using @ any other resource you need from gamemode_money?

1 Like