Jump to content

Custom INI and better setting comments


JDDoesIT

Recommended Posts

CUSTOM INI

 

Most of the settings in the INI file will remain at defaults for most of my playthroughs, so why not enable us to remove the entries to make the file more compact? Settings like:

 

  • PingLimit
  • DropOffWhiteListAfterDeath
  • AnnounceDeath
  • KickFastPlayers
  • SteamVAC

 

could all be omitted from the file if they are going to be left at the default setting. Of course the list will vary from setup to setup, but the idea remains the same.

 

I have tested this and the results are that the INI file can be missing any setting that you want to leave at default. I used PingLimit as my test setting by commenting out that line and it still was set to 400 when the game started.

 

Another way that I would like to be able to customize the INI file is to move settings up or down in the list. Why not move the Mod, WorkshopID and Maps lines right next to each other so that you can troubleshoot them without having the scroll through the whole file.

 

Again, I have tested this and you are able to move the lines wherever you want as long as they are formatted properly... But as soon as it is read the next thing that I see in the logs is the settings getting rewritten back to the INI file and your edits are gone. Every single line that you removed/commented has been added back. Every line that you moved is right back where it was.

 

So here is my suggestion on how to address this:

 

  1. Simply stop the writing back to the file after it is read into memory. I do not see the reason why this has to be done unless there is some reason why the file has be be consumed and then replaced, but that does not make sense.
  2. If the file has to be read and written (or in the even an admin changes a setting while the server is running) you can try this
    • It seems that the settings are parsed and stored in a key:value dictionary. If that is the case...
      • Create a dictionary with all the default settings.
      • Create another dictionary that parses the ini file
        • These settings get copied over to the dictionary that is being used by the server
      • So if you need to write back to the INI file you only write back the second dictionary
    • In the event someone changes a value in the main settings dictionary you push that onto the end of the second one so that only the changed/non-default information gets written to the INI.

 

 

COMMENTS

 

I am fairly new to Project Zomboid, but not new to setting up systems. It has taken me days to get a dedicated server that I am hosting up and running due to information not being clear. Every setting in the INI file should have a set of comments that clearly expresses how to use them.

 

Here is a good example:


 

# The minimum tile distance over which VOIP sounds can be heard.\nMinimum=0.00 Maximum=100000.00 Default=10.00

VoiceMinDistance=10.0

 

This clearly states what it is used for and what it can be set to.

 

Here is a bad example:

 

ChatStreams=s,r,a,w,y,sh,f,all

 

There is nothing that shows what each option is for.

 

Another bad example is:

 

# Enter the mod loading ID here. It can be found in \Steam\steamapps\workshop\modID\mods\modName\info.txt
Mods=

 

It does not state that there will be multiple IDs and that they should be separated with a semicolon.

 

And finally... The one that caused me the most trouble...

 

# Enter the foldername of the mod found in \Steam\steamapps\workshop\modID\mods\modName\media\maps\
Map=

 

It does not mention the semicolon, nor does it mention that they need to be listed before Muldraugh, KY in the list.

 

Please let me know if you have any questions.

 

Edited by JDDoesIT
Link to comment
Share on other sites

  • 2 weeks later...
On 11/27/2023 at 5:26 AM, EnigmaGrey said:

This seems like an incredible amount of work for no gain. Why do you need this?

 

Before I saw who replied to this I planned out a thoughtful response because I thought that this was just another user that was asking a question because they did not understand what I wrote. Now that I see who it is I will say this.

 

I have posted the algorithm overview so it is plain to to see that this is indeed not a lot of work at all. If I were given the load and save functions for PZ I could get this back to you in 24 hours.

 

And I have answered why I want (not need) this. So that I can put in the INI file only what I want to change in an order that makes more sense. It does not make any sense why all the mod settings are not right next to each other.

 

It also keeps me from accidentally fouling up another setting value.

Link to comment
Share on other sites

I just don't think most, if anyone, would expect an ini file to work that way, even if I understand the desire to customize and organize it yourself.

 

I'm all for making it more orderly, organized, and providing clearer comments where appropriate, just the rest of this suggestion feels like an opportunity to shoot ourselves in the foot.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...