ID:1935902
 
(See the best response by Stephen001.)
Heya, so I am aware that some Byond game's developers make use of configuration files (.cfg extension). What is the point on using those kind of files? Why would I use cfg files instead of the source itself?

For example, I saw a project that defined the administrators with a configuration file. Why would they use a cfg file instead of defining the admins in the source? var/list/admins = list("Adm1","Adm2")


Thanks as always for your attention,
,MistY
Well, mostly to let you change it without recompiling. Particularly handy if you're distributing host files to others to use.
Ok so Imagine these 2 scenarios:

Scenario A:
I create a list on my project that will store the admins' name. var/list/Admins = list("Admin1","Admin2")
Then I create a AddAdim and RemoveAdmin verbs so I can manage that list.

Scenario B:
I create a configuration file with the admins' name.
If I want to Add or Remove an Admin I would directly change it in the configuration file.

Which of these scenarios would be more efficient? Which would use more CPU?
Efficiency is irrelevant for something like this, because it only happens once.

There's nothing wrong with simply hard-defining the list in your code. When/if you get the time to mess with config files, you can replace that, but I'd focus on stuff that matters for gameplay first.
Best response
Both would use a trivial amount of CPU, but they would obviously have differing behaviours. In particular in scenario A, you have no persistence of your runtime changes between reboots, where-as in scenario B, you do have.

Odds are, you'd probably do a variant on both as it is. Load cfg file on start-up into list, modify list with verbs at run-time, update cfg file on shutdown based on list values. And if would still use a trivial amount of CPU as it happens once / rarely.

Generally, you're not legitimately adding/removing 10's of admins per second, or rebooting your world 10's of times per second, and the execution time of any of the scenarios we've described isn't noticeable to a human being, so no-one cares. And that's really what practical optimisation is about, defining acceptability criteria (eg. Does anyone care if it's X slow?) and working to that.

The question more-so is "Given my game, and how it plays, and how I'd like it administered and hosted, is it convenient/sensible/worthwhile to have admins configurable without recompiling the world, and does that configuration need to persist between reboots?"

Usually, for most games, the answer is "Yes" and at least some kind of cfg file comes into play. However, it's usually not number 1 on everyone's priority list when developing a new game, it comes a bit later, when you've ... you know, got a game people want to play a bit.